本文整理汇总了C++中Preferences::GetDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ Preferences::GetDouble方法的具体用法?C++ Preferences::GetDouble怎么用?C++ Preferences::GetDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::GetDouble方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RobotInit
// Executed at Robot power-on
void RobotInit(){
//move initial code from inside operator controll
m_display_page_1 = false;
Wait(.5); //Give dashboard preferences time to load.
double P = dashboardPreferences->GetDouble("P");
double I = dashboardPreferences->GetDouble("I");
double D = dashboardPreferences->GetDouble("D");
double angleMeasure = dashboardPreferences->GetDouble("Angle");
double length = dashboardPreferences->GetDouble("Length");
double grabberMeasure = dashboardPreferences->GetDouble("Grabber");
double extra1 = dashboardPreferences->GetDouble("Extra1");
double extra2 = dashboardPreferences->GetDouble("Extra2");
double extra3 = dashboardPreferences->GetDouble("Extra3");
double slider1 = dashboardPreferences->GetDouble("Slider1");
SmartDashboard::PutNumber("P", P);
SmartDashboard::PutNumber("I", I);
SmartDashboard::PutNumber("D", D);
SmartDashboard::PutNumber("Angle", angleMeasure);
SmartDashboard::PutNumber("Length", length);
SmartDashboard::PutNumber("Grabber", grabberMeasure);
SmartDashboard::PutNumber("Extra1", extra1);
SmartDashboard::PutNumber("Extra2", extra2);
SmartDashboard::PutNumber("Extra3", extra3);
SmartDashboard::PutNumber("Slider 1", slider1);
m_FromAutonomous = false;
}
示例2: preferencesFile
/**
* If we write a new networktables.ini with some sample values, test that
* we get those same values back using the Preference class.
*/
TEST(PreferencesTest, ReadPreferencesFromFile) {
NetworkTable::Shutdown();
std::remove(kFileName);
std::ofstream preferencesFile(kFileName);
preferencesFile << "[NetworkTables Storage 3.0]" << std::endl;
preferencesFile
<< "string \"/Preferences/testFileGetString\"=\"Hello, preferences file\""
<< std::endl;
preferencesFile << "double \"/Preferences/testFileGetInt\"=1" << std::endl;
preferencesFile << "double \"/Preferences/testFileGetDouble\"=0.5"
<< std::endl;
preferencesFile << "double \"/Preferences/testFileGetFloat\"=0.25"
<< std::endl;
preferencesFile << "boolean \"/Preferences/testFileGetBoolean\"=true"
<< std::endl;
preferencesFile
<< "double \"/Preferences/testFileGetLong\"=1000000000000000000"
<< std::endl;
preferencesFile.close();
NetworkTable::Initialize();
Preferences* preferences = Preferences::GetInstance();
EXPECT_EQ("Hello, preferences file",
preferences->GetString("testFileGetString"));
EXPECT_EQ(1, preferences->GetInt("testFileGetInt"));
EXPECT_FLOAT_EQ(0.5, preferences->GetDouble("testFileGetDouble"));
EXPECT_FLOAT_EQ(0.25f, preferences->GetFloat("testFileGetFloat"));
EXPECT_TRUE(preferences->GetBoolean("testFileGetBoolean"));
EXPECT_EQ(1000000000000000000ll, preferences->GetLong("testFileGetLong"));
}
示例3: InitShooter
void Shooter::InitShooter()
{
Stop();
Preferences *pref = Preferences::GetInstance();
pid_p = pref->GetDouble( "Shooter.pid_p", SHOOTER_P );
pid_i = pref->GetDouble( "Shooter.pid_i", SHOOTER_I );
pid_d = pref->GetDouble( "Shooter.pid_d", SHOOTER_D );
drive_ratio = pref->GetDouble( "Shooter.drive_ratio", DRIVE_RATIO );
tolerance = pref->GetDouble( "Shooter.tolerance", TOLERANCE );
shot_time = pref->GetDouble( "Shooter.shot_time", SHOT_TIME );
release_time = pref->GetDouble( "Shooter.release_time", RELEASE_TIME );
printf("InitShooter: pid_p = %7.4f\n", pid_p);
printf("InitShooter: pid_i = %7.4f\n", pid_i);
printf("InitShooter: pid_d = %7.4f\n", pid_d);
printf("InitShooter: drive_ratio = %5.2f\n", drive_ratio);
printf("InitShooter: tolerance = %4.1f\n", tolerance);
printf("InitShooter: shot_time = %4.1f\n", shot_time);
printf("InitShooter: release_time = %4.1f\n", release_time);
pid_bottom.SetInputRange( 0.0F, MAX_PPS );
// PWMController doesn't like it when we use "1.0F" as the maximum.
pid_bottom.SetOutputRange( 0.0F, 0.99F );
// This needs some calibration...
pid_bottom.SetTolerance( tolerance );
pid_bottom.SetPID( pid_p, pid_i, pid_d );
pid_top.SetInputRange( 0.0F, MAX_PPS );
// PWMController doesn't like it when we use "1.0F" as the maximum.
pid_top.SetOutputRange( 0.0F, 0.99F );
// This needs some calibration...
pid_top.SetTolerance( tolerance );
pid_top.SetPID( pid_p, pid_i, pid_d );
geartooth_bottom.SetAverageSize( 8 );
geartooth_top.SetAverageSize( 8 );
geartooth_bottom.Start();
geartooth_top.Start();
motor_timer.Start();
shot_timer.Start();
}
示例4: LoadPreferences
/*
* Load preferences from config file
*/
void PrefsDialog::LoadPreferences(void)
{
Preferences* pPrefs = ((MyApp*)wxTheApp)->GetPrefs();
assert(pPrefs != NULL);
/*
* Load preferences.
*/
mConfigFile = ((MyApp*)wxTheApp)->GetConfigFileName();
pPrefs->GetDouble("gamma", &mGammaCorrection);
pPrefs->GetString("debugger", /*ref*/ mDebugger);
pPrefs->GetString("valgrinder", /*ref*/ mValgrinder);
pPrefs->GetBool("auto-power-on", &mAutoPowerOn);
pPrefs->GetBool("enable-sound", &mEnableSound);
pPrefs->GetBool("enable-fake-camera", &mEnableFakeCamera);
}
示例5: getPreferences
// Read data from the Preferences Panel
void getPreferences()
{
kLeftP = prefs->GetDouble("kLeftP", 0.025);
kLeftI = prefs->GetDouble("kLeftI", 0.0);
kLeftD = prefs->GetDouble("kLeftD", 0.2);
kLeftF = prefs->GetDouble("kLeftF", 0.03);
kLeftLowRPM = prefs->GetDouble("kLeftLowRPM", -1000.0);
kLeftHighRPM = prefs->GetDouble("kLeftHighRPM", -2400.0);
kRightP = prefs->GetDouble("kRightP", 0.025);
kRightI = prefs->GetDouble("kRightI", 0.0);
kRightD = prefs->GetDouble("kRightD", 0.2);
kRightF = prefs->GetDouble("kRightF", 0.03);
kRightLowRPM = prefs->GetDouble("kRightLowRPM", 1000.0);
kRightHighRPM = prefs->GetDouble("kRightHighRPM", 2400.0);
kLaunchP = prefs->GetDouble("kLaunchP", 0.2);
kLaunchI = prefs->GetDouble("kLaunchI", 0.004);
kLaunchD = prefs->GetDouble("kLaunchD", 0.5);
kLaunchF = prefs->GetDouble("kLaunchF", 0.0);
kGatherP = prefs->GetDouble("kGatherP", 0.05);
kGatherI = prefs->GetDouble("kGatherI", 0.0);
kGatherD = prefs->GetDouble("kGatherD", 0.1);
kGatherF = prefs->GetDouble("kGatherF", 0.0);
kTurnP = prefs->GetDouble("kTurnP", 0.025);
kTurnI = prefs->GetDouble("kTurnI", 0.004);
kTurnD = prefs->GetDouble("kTurnD", 0.06);
kTurnF = prefs->GetDouble("kTurnF", 0.0);
kGatherAngle = prefs->GetDouble("kGatherAngle", 113.0);
kLaunchMinAngle = prefs->GetDouble("kLaunchMinAngle", 23.5);
kLaunchMaxAngle = prefs->GetDouble("kLaunchMaxAngle", 36.7);
kLaunchAngle = prefs->GetDouble("kLaunchAngle", 30.0);
kCoeff0 = prefs->GetDouble("kCoeff0", 0.144);
kCoeff1 = prefs->GetDouble("kCoeff1", 19.8);
kLogLevel = prefs->GetString("kLogLevel", "INFO");
Log::SetLevel(Log::FromString(kLogLevel));
LOGGER(INFO) << "[getPreferences] LeftRPM:" << kLeftHighRPM << " RightRPM: " << kRightHighRPM;
}