// call this after updating base. void parse() { use_convergence = !convergence_epsilon_str.empty(); if (use_convergence) { string_to(convergence_epsilon_str, convergence_epsilon); if (convergence_epsilon == PT::start()) use_convergence = false; } }
bool string_to_bool(const std::string & str, Foo & foo) { bool bar; if( ! string_to(str, bar)) return false; foo = bar ? 1 : 0; return true; }
static inline void from_strings(std::vector<std::string> const& s, Val& val) { if (s.size() == 1) string_to(s.front(), val); else throw std::runtime_error("from_strings: non-container value expected exactly one source string"); }
void expo_parameters_load(expo_parameters & params, boost::shared_ptr<sfl::OptionDictionary> opt) { string_to(opt->GetOption("model_security_distance"), params.model_security_distance); string_to(opt->GetOption("model_wheelbase"), params.model_wheelbase); string_to(opt->GetOption("model_wheelradius"), params.model_wheelradius); string_to(opt->GetOption("model_qd_max"), params.model_qd_max); string_to(opt->GetOption("model_qdd_max"), params.model_qdd_max); string_to(opt->GetOption("model_sd_max"), params.model_sd_max); string_to(opt->GetOption("model_thetad_max"), params.model_thetad_max); string_to(opt->GetOption("model_sdd_max"), params.model_sdd_max); string_to(opt->GetOption("model_thetadd_max"), params.model_thetadd_max); string_to(opt->GetOption("dwa_dimension"), params.dwa_dimension); string_to(opt->GetOption("dwa_grid_width"), params.dwa_grid_width); string_to(opt->GetOption("dwa_grid_height"), params.dwa_grid_height); string_to(opt->GetOption("dwa_grid_resolution"), params.dwa_grid_resolution); string_to(opt->GetOption("dwa_alpha_distance"), params.dwa_alpha_distance); string_to(opt->GetOption("dwa_alpha_heading"), params.dwa_alpha_heading); string_to(opt->GetOption("dwa_alpha_speed"), params.dwa_alpha_speed); string_to_bool(opt->GetOption("dwa_use_tobi_distobj"), params.dwa_use_tobi_distobj); string_to(opt->GetOption("dwa_tobi_distobj_blur"), params.dwa_tobi_distobj_blur); string_to_bool(opt->GetOption("bband_enabled"), params.bband_enabled); string_to(opt->GetOption("bband_shortpath"), params.bband_shortpath); string_to(opt->GetOption("bband_longpath"), params.bband_longpath); string_to(opt->GetOption("bband_maxignoredistance"), params.bband_maxignoredistance); string_to(opt->GetOption("mp_dtheta_starthoming"), params.mp_dtheta_starthoming); string_to(opt->GetOption("mp_dtheta_startaiming"), params.mp_dtheta_startaiming); }
friend void string_to_impl(std::string const& str,default_true & x) { string_to(str,x.v); }
friend void string_to_impl(std::string const& str,flag & x) { string_to(str,x.v); }
bool token_to(tokenlist_t const & tokenlist, size_t index, value_t & value) { if (index >= tokenlist.size()) return false; return string_to(tokenlist[index], value); }