Similar to what @gerthworm said regarding the Talon SRX, there are more ways to do it.
Set up the Talon SRX and call the configSelectedFeedbackSensor method to connect that Talon SRX and the magnetic encoder it uses.
Once you finish there, you can call the “getter” method as needed. I recommend using something similar to the following:
WPI_TalonSRX myTalon = new WPI_TalonSRX(0); // Create the talon object.
double position = myTalon.getSelectedSensorPosition(); // Get the position of the talon object.
This should be the correct Java code. Java is not my “first language”!
Anyway, the shuffleboard application relies on network table values. Assuming you have a table created (if it’s commandbased I recommend that you have a table per subsystem), you can call something similar to the following:
// In the constructor:
NetworkTable table = inst.getTable("drivetrain");
double p = table.getEntry("position");
// Later in the code:
The code above would, in theory, populate a network table entry with a key of “position” and a value of the encoder reading.
The shuffleboard application can use this with something similar to the following:
SmartDashboard.putNumber("Encoder position", p.setDouble(myTalon.getSelectedSensorPosition()));
I hope this provides some clarity. You can read more about smart dashboard here!
Feel free to respond with any more questions!