I’ve been having issues with the 2018 edition of SmartDashboard. I’ve been trying to read the motor’s raw velocity from the encoder and then convert it to the SI standard of m/s. I can output the raw encoder data to the SmartDashboard as usual, but multiplying it or passing a static variable outputs nothing.
You’re doing integer division - 600/4096 rounds down to zero instead of 0.146484 because both operands are of type ‘int’. Adding a “.0” or “D” to the end of at least one of the numbers will make it floating-point division and return the value you expect:
public static final double RPM = lifterMotor.getSelectedSensorVelocity(0) * (600.0/4096.0);
SmartDashboard.putNumber("Lifter position", RPM);
You’re also assigning the RPM value once, when the class is initialized. This may cause a NullPointerException if the lift motor hasn’t been initialized at that time. It should be a local variable, inside whatever method you’re putting the RPM into SmartDashboard.
Even something like the following kills it:
SmartDashboard.putNumber("Lifter position", 3);
How does that “kill it”? Is there no “Lifter position” entry? Is its value incorrect?