so I am the new programmer for my team. problem is I’m new to this FRC thing.
At the moment I am trying to code our robot so that we can drive in tank drive, and have a relay spike control one of our motors (in the future have 3 relay spikes control 3 motors) that will bring the ball off ground like a crane.
This is my code:
// Define user inputs
Joystick leftStick = new Joystick(1);
Joystick rightStick = new Joystick(2);
// Define the motor controllers. Uses the Jaguar PWM Modules
Jaguar left = new Jaguar(1);
Jaguar right = new Jaguar(2);
RobotDrive drive = new RobotDrive(1, 3, 2, 4);
//relay modules please
Relay lowBall = new Relay(5);
//Relay upBall = new Relay(6); //future 2 relay's
//Relay shootBall = new Relay(7);
public void operatorControl() { //new control
//
//----------
// Human Operation Mode
//----------
while (isEnabled()) {
//
Watchdog.getInstance().feed();
DriverStationLCD.getInstance().updateLCD();
drive.tankDrive(leftStick, rightStick);
// if button pressed reverse the specified ballMotor.
if(leftStick.getRawButton(2))
lowBall.set(Relay.Value.kReverse);
else
lowBall.set(Relay.Value.kForward);
//if(leftStick.getRawButton(3))
// upBall.set(Relay.Value.kReverse);
//else
// upBall.set(Relay.Value.kForward);
//if(rightStick.getTrigger())
// shootBall.set(Relay.Value.kForward);
//else
// shootBall.set(Relay.Value.kOff);
}
}
I have all the necessary imports, I hope, here they are if it helps:
import edu.wpi.first.wpilibj.camera.AxisCamera;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Watchdog;
import edu.wpi.first.wpilibj.DriverStationLCD;
import edu.wpi.first.wpilibj.Joystick.AxisType;
Issue:
for some reason, after this code is uploaded to the cRIO, nothing happens.
nothing functions, I cannot even drive it, no motors work, nothing works.
I’ve tried many things, like switching from, extends SimpleRobot, to extends IterativeRobot. I’ve checked, re-installed, re-everything the plug-ins and what not. We have connection, and our computer is talking with the cRIO. But still nothing happens.
Question:
Does anyone know why our cRIO (robot) isn’t functioning? thanks for the help in advance.