Greetings! We’re trying to program our Jaguar, but it does not respond to the commands that we copied from the official PDF. Can someone please take a look:
The fact that you’re not getting any errors means that testJoystick is declared, but does it have a value? Are you saying
testJoystick = new Joystick(portNumber);
If you’re not, you’d be getting a null pointer exception in the console.
Now, you probably want to put it in TeleopPeriodic(). If you put it in any ----Init() method, it will run it only once. Periodic methods run at a rate that’s clocked to the FPGA, and continuous methods run as fast as possible. You want to put most of your code in periodic.
Do not put your code in AutonomousContinuous or AutonomousPeriodic… These routines never get updates from the operator interface. You should use TeleopPeriodic this gets called only when there is a new message from the operator interface. (Been there, done that.)
You said the light was blinking on the jaguar, that means it is not getting the code, find electrical to check wires and make sure you have the right ports!
as mentioned before… if you enable the robot and the light on the jags are still blinking then that means the jag is not properly receiving communication from the digital side car… it should go solid even if your joystick didn’t work or if you had no joystick at all.
A blinking light indicated bad comms. This is true for jags and victors.
I would start by making sure your cables work and plugged in correctly. Make sure you are plugged into the PWM slot and not the DIO slot for example.
Then I would look so see where you are instantiating the new jag… you should be instantiating the new jag in RobotInit, AutoInit, or Teleop Init…
Once you have a solid light when the robot is enabled then I would make sure to call the set() method in a loop like teleop period, and you might want to use joystick.getrawaxis( # ) instead of gety() if you still cant command the jags.