My team is switching from C++ to java this year and to be honest I have actually no idea what I am doing
We have set up eclipse (64 bit version) and are now trying to program our testbed, and the sample program seems to run fine until we try defining the IDs, where if the code is uncommented we get this error in the driver station:
ERROR Unhandled exception instantiating robot org.usfirst.frc.team2517.robot.Robot
edu.wpi.first.wpilibj.can.CANMessageNotFoundException at [edu.wpi.first.wpilibj.CANJaguar.<init>(CANJaguar.java:210),
org.usfirst.frc.team2517.robot.Robot.<init>(Robot.java:26),
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method),
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62),
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45),
java.lang.reflect.Constructor.newInstance(Constructor.java:408), java.lang.Class.newInstance(Class.java:433),
edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:197)]
The code we are using:
package org.usfirst.frc.team2517.robot;
import edu.wpi.first.wpilibj.*;
/*
* This sample program shows how to control a motor using a joystick. In the operator
* control part of the program, the joystick is read and the value is written to the motor.
*
* Joystick analog values range from -1 to 1 and speed controller inputs also range from -1
* to 1 making it easy to work together. The program also delays a short time in the loop
* to allow other threads to run. This is generally a good idea, especially since the joystick
* values are only transmitted from the Driver Station once every 20ms.
*/
public class Robot extends SampleRobot {
private SpeedController motorTurn;
private SpeedController motorMove;
private Joystick stick;
private final double k_updatePeriod = 0.005; // update every 0.005 seconds/5 milliseconds (200Hz)
public Robot() {
// motorTurn = new CANJaguar(4);
motorMove = new CANJaguar(13);
stick = new Joystick(0); // initialize the joystick on port 0
}
/*
* Runs the motor from a joystick.
*/
public void operatorControl() {
while (isOperatorControl() && isEnabled()) {
// Set the motor's output.
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed going forward)
motorTurn.set(stick.getRawAxis(2));
motorMove.set(stick.getRawAxis(1));
Timer.delay(k_updatePeriod); // wait 5ms to the next update
}
}
}
I have tried replacing SpeedController with CANJaguar but as far as the robot is concerned both results are exactly the same.
EDIT: Formatting