This is a substantial refactoring of the configuration process: instead of taking a Controller::Params structure, then parsing yaml file, we now take YAML::Nodereferences.
The general idea is that YAML::Node is a general purpose map that can be used to store our parameters in a generic way.
This makes it possible to:
remove the redundant Controller::Params and parameters in yaml files
avoid parsing the file several times
have a different yaml file for the controller and the behaviors
change the value in the map at runtime, for instance:
auto controller_config = IWBC_CHECK(YAML::LoadFile(controller_path));
// do some modifications
controller_config["CONTROLLER"]["base_path"] = "../etc";// we assume that we run in ./build
controller_config["CONTROLLER"]["urdf"] = robot->model_filename();
controller_config["CONTROLLER"]["mimic_dof_names"] = robot->mimic_dof_names();
auto controller_name = IWBC_CHECK(controller_config["CONTROLLER"]["name"].as<std::string>());
auto controller = inria_wbc::controllers::Factory::instance().create(controller_name, controller_config);
One open question is to keep the CONTROLLER and BEHAVIOR sections (since they are typically in different files). I kept them because I find it clearer/convenient to have CONTROLLER as the first line of a file that describe parameters of controllers, instead of a bunch of parameters. But this makes some code a bit less elegant.
Last, be careful that test_controller now has a -c option for the controller and -b option for the behavior.
This is a substantial refactoring of the configuration process: instead of taking a Controller::Params structure, then parsing yaml file, we now take
YAML::Node
references.The general idea is that
YAML::Node
is a general purpose map that can be used to store our parameters in a generic way.This makes it possible to:
Controller::Params
and parameters in yaml filesOne open question is to keep the
CONTROLLER
andBEHAVIOR
sections (since they are typically in different files). I kept them because I find it clearer/convenient to have CONTROLLER as the first line of a file that describe parameters of controllers, instead of a bunch of parameters. But this makes some code a bit less elegant.Last, be careful that
test_controller
now has a-c
option for the controller and-b
option for the behavior.