Hey guys… I’m new to the java for FRC and i was wondering if you guys can help me out with the basic code for our iterative robot project. We have 2 jaguars on pwn 1 and 2 on the DSC and arcade drive. Also we have encoders for the drive system and i dont know how to do them either. Can you guys point me in the right direction? Thanks!
Though i don’t know how to use encoders, there is a first made tutorial based on them. I do however know how to program a basic arcade drive.
one joystick:
public class Main extends IterativeRobot {
AxisCamera camera = AxisCamera.getInstance();
Joystick leftStick = new Joystick(1);
Joystick rightStick = new Joystick(2);
Joystick joypad = new Joystick(3);
CriteriaCollection cc;
RobotDrive robotDrive = new RobotDrive(1,2,3,4);
//Encoder shooterSpeed = new Encoder(1,2);
//float Kp = 3.f;
//float Ki = 0.f;
//float Kd = 0.f;
//private final PIDController shooterPID;
public void robotInit() {
cc = new CriteriaCollection();
cc.addCriteria(NIVision.MeasurementType.IMAQ_MT_AREA, 30, 400, false);
cc.addCriteria(NIVision.MeasurementType.IMAQ_MT_AREA, 40, 400, false);
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
robotDrive.arcadeDrive(leftStick);
2 Joysticks
public class Main extends IterativeRobot {
AxisCamera camera = AxisCamera.getInstance();
Joystick leftStick = new Joystick(1);
Joystick rightStick = new Joystick(2);
Joystick joypad = new Joystick(3);
CriteriaCollection cc;
RobotDrive robotDrive = new RobotDrive(1,2,3,4);
//Encoder shooterSpeed = new Encoder(1,2);
//float Kp = 3.f;
//float Ki = 0.f;
//float Kd = 0.f;
//private final PIDController shooterPID;
public void robotInit() {
cc = new CriteriaCollection();
cc.addCriteria(NIVision.MeasurementType.IMAQ_MT_AREA, 30, 400, false);
cc.addCriteria(NIVision.MeasurementType.IMAQ_MT_AREA, 40, 400, false);
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
robotDrive.arcadeDrive(leftStick, rightStick);