View Single Post
  #9   Spotlight this post!  
Unread 02-04-2013, 15:13
slibert slibert is offline
Software Mentor
AKA: Scott Libert
FRC #2465 (Kauaibots)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2005
Location: Kauai, Hawaii
Posts: 347
slibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud of
Re: Crio C++ Preferences -> How to See/Edit these values in the Smart Dashboard

We're still struggling to get the C++ Preferences class to actually save values to a file on the CRio. We've verified we're using the latest (3/4/2013) WPILibrary update and v47 of the Crio firmware.

Here's the robot startup code that populates the preferences:

*****

double steer_L_F_offset_angle = prefs->GetDouble("L_F_Steer_Offset_Angle", -126.0);
double steer_L_B_offset_angle = prefs->GetDouble("L_B_Steer_Offset_Angle", -70.0);
double steer_R_F_offset_angle = prefs->GetDouble("R_F_Steer_Offset_Angle", 170.0);
double steer_R_B_offset_angle = prefs->GetDouble("R_B_Steer_Offset_Angle", -140.0);

prefs->PutDouble("L_F_Steer_Offset_Angle", steer_L_F_offset_angle);
prefs->PutDouble("L_B_Steer_Offset_Angle", steer_L_B_offset_angle);
prefs->PutDouble("R_F_Steer_Offset_Angle", steer_R_F_offset_angle);
prefs->PutDouble("R_B_Steer_Offset_Angle", steer_R_B_offset_angle);

prefs->Save();

*****

- The Preference values, which are added by the robot at startup and are showing upon the Dashboard, show up in and can successfully be edited in the "Robot Preferences" control.
- We deleted the preferences file (wpilib-preferences.ini) on the robot and restarted the robot, and the file gets re-created by the robot startup code. However it still only has the [Preferences] header and no key/value entries in it.

The "PutDouble" code invoked by the robot startup code definitely populates the values into the NetworkTables (since they show up on the dashboard).

So in summary, since the Preferences class is actually re-creating a preferences file after we had previously deleted it, and is populating the NetworkTables, but no key/value pairs are written to the preferences file, it appears that the "PutDouble" code in the robot is *not* putting the values into the internal m_values table. We've also verified the string names of the variables being added to the Preferences are unique.
Reply With Quote