sending variables from driver station to robot?

I have been experimenting with some PID loops for our drive this year and want to be able change the setpoint and/or the p, i and d values from the driver station instead of having to upload new code each time. I have been able to figure out how to use the send-able chooser but that only allows me to choose preset things like an autonomous chooser. How might I go about being able to change these variables on the smart dashboard? Btw I am using Java and am currently coding using the iterative robot template.

In general, you can call SmartDashboard.putNumber in an init method (so that it gets loaded on the SmartDashboard), and then call SmartDashboard.getNumber to read the current value on the Smart Dashboard.

If you are using the PIDController class, there is already a PID widget on Smart Dashobard that lets you change P, I, and D, and the setpoint. You can add the PIDController as an actuator with LiveWindow, and test whatever you want.

See:
http://wpilib.screenstepslive.com/s/3120/m/7932/l/84110-displaying-livewindow-values
http://wpilib.screenstepslive.com/s/3120/m/7932/l/81113-pid-tuning-with-smartdashboard

How about using the virtual inputs on the driver’s IO tab station? I used them a few years ago for tuning a PID loop. After I had good values, I hard coded them so they couldn’t be changed.

How might I go about using these? I have known about them for a little while but have no idea how to program them. Would it just be like an if statement where if virtual_joystick button 1 = true, then…

Please pardon me if my question seams redundant.

We are using Java for our cRIO and the Java version of the Smart Dashboard. How can we have an operator/driver enter number values
in the Smart Dashboard (or other software interface) and have them “pushed” to the cRIO as values to use in certain parts of the code?

For example, we have an ultrasonic sensor that feeds the cRIO an analog signal based on how far the sensor is from the wall (front mount). We know that we need our robot to be 7’/84" from the wall to shoot for and make the high goal. In autonomous, I would like to have the ability for the driver to enter that value in the driver station and have it passed to that filed in the autonomous code to allow on site tweaking w/o having to do multiple downloads to the cRIO.

Thanks.