We ran across this same issue at one point. I don't have the robot in front of me, but I think the solution was to add a line in the robot initialization code to set a initial value for each SmartDashboard key name we wanted to retrieve before we started retrieving it.
Here's a example (from a SimpleRobot based perspective):
Code:
private int shooterSpeed = 0;
public void robotInit() {
// Tell SmartDashboard to register a "Shooter Speed" key and initial value.
SmartDashboard.putInt("Shooter Speed", shooterSpeed);
}
public void operatorControl() {
while (isOperatorControl() && isEnabled()) {
// Read value of "Shooter Speed" back from the dashboard
int newSpeed = SmartDashboard.getInt("Shooter Speed", shooterSpeed);
// If operator wants a new speed, update robot state to accomodate
if (newSpeed != shooterSpeed) {
doWhatYouNeedToDoOnASpeedChange(newSpeed);
}
Timer.delay(0.01);
}
}