Alright folks,
I've got answers....
Indeed - we agree that SmartDashboard::GetInstance()->GetDouble("name") does not work...however, we did find that GetString() **DOES** work. So, here's an iterative solution...
1) You **MUST** use the smartdashboard app on a separate computer due to the fact that hitting ENTER will disable the robot.
2) You must retrieve your "double values" as strings and then convert them to double/float values... see below...
3) When in operation, you simply tune your PID values by entering a new value into one of the boxes and hitting ENTER (on the 2nd laptop....see #1) and the new value will be put into the PIDController immediately so you can see the difference. When you're happy with the results, record your P,I, and D and put those into your real code. Tada.
Bob...
Code:
PIDController pid(0.00, 0.00, 0.00, &encoder, &motor);
SmartDashboard* smarty=SmartDashboard::GetInstance();
// Initially gotta put some value in order to get SmartDashboard
// to create a textbox for the value...
// Simply calling GetString() will not produce a box...
smarty->PutString("P-value", "0.0");
smarty->PutString("D-value", "0.0");
smarty->PutString("D-value", "0.0");
std::string tempstring;
float p, i, d;
// Initialize the pid...these values I cannot tell you ....
// They depend on your situation
pid.SetInputRange(.....);
pid.SetOutputRange(.....);
pid.SetSetpoint(.....);
pid.Enable();
while (IsOperatorControl())
{
tempstring = smarty->GetString("P-value");
sscanf(tempstring.c_str(), "%f", &p);
tempstring = smarty->GetString("I-value");
sscanf(tempstring.c_str(), "%f", &i);
tempstring = smarty->GetString("D-value");
sscanf(tempstring.c_str(), "%f", &d);
pid.SetPID(p, i, d);
}