@@ -47,6 +47,14 @@ void TomlConfigClient::loadConfig()
4747 {" battery_voltage" , " 0.0" },
4848 {" current_draw" , " 0.0" },
4949 {" cap_voltage" , " 0.0" },
50+ {" position_controller_kp" , " 1.2" },
51+ {" position_controller_ki" , " 0.1" },
52+ {" position_controller_kd" , " 0.0" },
53+ {" position_controller_max_integral" , " 10.0" },
54+ {" orientation_controller_kp" , " 0.4" },
55+ {" orientation_controller_ki" , " 0.0" },
56+ {" orientation_controller_kd" , " 0.0" },
57+ {" orientation_controller_max_integral" , " 0.0" },
5058 };
5159 writeConfig ();
5260 return ;
@@ -81,7 +89,7 @@ void TomlConfigClient::writeConfig()
8189 has_pending_changes_ = false ;
8290}
8391
84- std::string TomlConfigClient::get (const std::string& key)
92+ std::string TomlConfigClient::get (const std::string& key, const std::string& default_value )
8593{
8694 std::lock_guard<std::mutex> lock (config_mutex_);
8795
@@ -106,14 +114,17 @@ std::string TomlConfigClient::get(const std::string& key)
106114 }
107115 else
108116 {
109- LOG (WARNING ) << " TOML key '" << key << " ' exists but is not a supported type" ;
110- return " " ;
117+ LOG (WARNING ) << " TOML key '" << key
118+ << " ' exists but is not a supported type, using default value '"
119+ << default_value << " '" ;
120+ return default_value;
111121 }
112122 }
113123 catch (const std::exception& e)
114124 {
115- LOG (WARNING ) << " TOML key '" << key << " ' not found: " << e.what ();
116- return " " ;
125+ LOG (WARNING ) << " TOML key '" << key << " ' not found, using default value '"
126+ << default_value << " ': " << e.what ();
127+ return default_value;
117128 }
118129}
119130
0 commit comments