Go to Post "I'm not going to tell you all that you all are winners. At this point you are smart enough to know whether you are or you aren't." -Woodie Flowers - Barry Bonzack [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 05-02-2014, 20:29
Mr.Roboto3335's Avatar
Mr.Roboto3335 Mr.Roboto3335 is offline
Wait, What?
AKA: Jimmy
FRC #3335 (Cy-Borgs)
Team Role: Programmer
 
Join Date: Nov 2011
Rookie Year: 2011
Location: Texas
Posts: 47
Mr.Roboto3335 is an unknown quantity at this point
Robots don't quit

When I try to upload the code it says "Robots don't quit!" I would like to know why it does that and how to fix it. Thanks!
Code:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/
/* Written by T0xicFail                                                       */
/* (c) 2014                                                                   */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.DriverStationLCD;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Timer;

public class Voltage2014 extends IterativeRobot {

    private RobotDrive Drive;
    private Solenoid LeftLowGear, LeftHighGear, RightLowGear, RightHighGear; // Gear Shift
    private Joystick Controller;
    private Compressor Compressor;
    private SpeedController FrontLeft, FrontRight, BackLeft, BackRight;
    private final DriverStationLCD lcd = DriverStationLCD.getInstance();
    private boolean HasShifted;

    public void robotInit() {
        RobotDriveInit();
        CompressorInit();
        ControllerInit();
        TalonInit();

        HasShifted = false;
    }
    

    public void RobotDriveInit() {
        Drive = new RobotDrive(FrontLeft, FrontRight, BackLeft, BackRight);
    }

    public void CompressorInit() {
        Compressor = new Compressor(1, 1);// Digital I/O, Relay
        LeftLowGear = new Solenoid(2);
        LeftHighGear = new Solenoid(3);
        RightLowGear = new Solenoid(4);
        RightHighGear = new Solenoid(5);
    }

    public void ControllerInit() {
        Controller = new Joystick(1);
    }

    public void TalonInit() {
        FrontLeft = new Talon(1);
        FrontRight = new Talon(2);
        BackLeft = new Talon(3);
        BackRight = new Talon(4);
    }

    public void autonomousPeriodic() {
    }

    public void teleopPeriodic() {
        //Drive
        Drive.arcadeDrive(getDeadZone(Controller.getY(), 0.25),
                getDeadZone(Controller.getThrottle(), 0.25) * 0);

        // Compressor
        if (Controller.getRawButton(1)) {
            Compressor.start();
            lcd.println(DriverStationLCD.Line.kUser1, 1, "Compressor: ON ");
        } else if (Controller.getRawButton(2)) {
            Compressor.stop();
            lcd.println(DriverStationLCD.Line.kUser1, 1, "Compressor: OFF");
        }

        // Shifter
        if (Controller.getRawButton(5) && !HasShifted) {
            LeftHighGear.set(true);
            RightHighGear.set(true);
            Timer.delay(0.1);
            LeftLowGear.set(false);
            RightLowGear.set(false);
            HasShifted = true;
            lcd.println(DriverStationLCD.Line.kUser2, 1, "Speed: High");
            lcd.updateLCD();
        } else if (Controller.getRawButton(5) && HasShifted) {
            LeftLowGear.set(true);
            RightLowGear.set(true);
            Timer.delay(0.1);
            LeftHighGear.set(false);
            RightHighGear.set(false);
            HasShifted = false;
            lcd.println(DriverStationLCD.Line.kUser2, 1, "Speed: Low ");
            lcd.updateLCD();
        }

    }

    private double getDeadZone(double num, double dead) {
        if (num < 0) {
            if (num < dead) {
                return num;
            } else {
                return 0;
            }
        } else {
            if (num > dead) {
                return num;
            } else {
                return 0;
            }
        }
    }

    public void testPeriodic() {

    }

}
__________________
Wait, what?
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:06.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi