|
Can you please check our code? - FRC Java
I am the new programming lead in my team and well i did not learn much last year about programming so I kinda expected this to happen. When I put this code into the robot only BRDrive motor moves and very slowly. This happens when i turn on autonomous or telop. That motor is the only one on and i do not even touch any of the controls even in telop. I have no idea why this is happening. If you do not think that it is the programming please tell me hat you think it could be whether it be electrically or something when inputing the code into the robot or whatever.
Code:
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class RobotTemplate extends SimpleRobot {
public Joystick joyStick = new Joystick(1);
public RobotDrive tankDrive = new RobotDrive(1,2,3,4);
public Jaguar FLDrive = new Jaguar(1);
public Jaguar FRDrive = new Jaguar(2);
public Jaguar BLDrive = new Jaguar(3);
public Victor BRDrive = new Victor(4);
public Victor PickerFront = new Victor(5);
public Victor PickerRear = new Victor(6);
/**
* This function is called once each time the robot enters autonomous mode.
*/
public void autonomous() {
PickerFront.set(1.0);
PickerRear.set(1.0);
FLDrive.set(1.0);
FRDrive.set(1.0);
BLDrive.set(1.0);
BRDrive.set(1.0);
}
/**
* This function is called once each time the robot enters operator control.
*/
public void checkUserInputs() {
tankDrive.tankDrive((-joyStick.getY()), (-joyStick.getRawAxis(5)));
if (joyStick.getRawButton(1) == true) {
PickerFront.set(1.0);
} else if (joyStick.getRawButton(4) == true) {
PickerFront.set(-1.0);
} else if (joyStick.getRawButton(1) == true & joyStick.getRawButton(4) == true) {
PickerFront.set(0.0);
} else {
PickerFront.set(0.0);
}
if (joyStick.getRawButton(3) == true) {
PickerRear.set(1.0);
} else if (joyStick.getRawButton(2) == true) {
PickerRear.set(-1.0);
} else if (joyStick.getRawButton(3) == true & joyStick.getRawButton(2) == true) {
PickerRear.set(0.0);
} else {
PickerRear.set(0.0);
}
}
/**
* This function is called once each time the robot enters test mode.
*/
}
Last edited by Team2634 : 25-10-2014 at 22:56.
|