diff --git a/include/qrw/Params.hpp b/include/qrw/Params.hpp index 6857dcd7dc8f3346804b5661af41b3b21585c553..6599341ae2665c85a8f2f0206bcf3a090269025e 100644 --- a/include/qrw/Params.hpp +++ b/include/qrw/Params.hpp @@ -48,6 +48,7 @@ class Params { // See .yaml file for meaning of parameters // General parameters + std::string config_file; // Name of the yaml file containing hardware information std::string interface; // Name of the communication interface (check with ifconfig) bool SIMULATION; // Enable/disable PyBullet simulation or running on real robot bool LOGGING; // Enable/disable logging during the experiment diff --git a/python/gepadd.cpp b/python/gepadd.cpp index d9fc8a7d13e741c1098e052de8c00193ca3e84d6..1af730f6021c54fc9ca540f7a5104a78544e8bde 100644 --- a/python/gepadd.cpp +++ b/python/gepadd.cpp @@ -429,6 +429,7 @@ struct ParamsPythonVisitor : public bp::def_visitor<ParamsPythonVisitor<Params>> "Initialize Params from Python.\n") // Read Params from Python + .def_readwrite("config_file", &Params::config_file) .def_readwrite("interface", &Params::interface) .def_readwrite("SIMULATION", &Params::SIMULATION) .def_readwrite("LOGGING", &Params::LOGGING) diff --git a/scripts/main_solo12_control.py b/scripts/main_solo12_control.py index db15be6df48bf624369790ce21ad4ec3c903c4af..266c43a276471f38d0692adce81319c397eafb9b 100644 --- a/scripts/main_solo12_control.py +++ b/scripts/main_solo12_control.py @@ -121,7 +121,7 @@ def control_loop(name_interface_clone=None, des_vel_analysis=None): device = PyBulletSimulator() qc = None else: - device = oci.robot_from_yaml_file('config_solo12.yaml') + device = oci.robot_from_yaml_file(params.config_file) qc = QualisysClient(ip="140.93.16.160", body_id=0) if name_interface_clone is not None: diff --git a/src/Params.cpp b/src/Params.cpp index 66a529a9b71a9dad271453f01fbc8d0a3d3f54a3..d9f3bd438d7efa0e30733b9df4b5d6db134410c0 100644 --- a/src/Params.cpp +++ b/src/Params.cpp @@ -3,7 +3,8 @@ using namespace yaml_control_interface; Params::Params() - : interface(""), + : config_file(""), + interface(""), SIMULATION(false), LOGGING(false), PLOTTING(false), @@ -74,6 +75,9 @@ void Params::initialize(const std::string& file_path) { const YAML::Node& robot_node = param["robot"]; // Retrieve robot parameters + assert_yaml_parsing(robot_node, "robot", "config_file"); + config_file = robot_node["config_file"].as<std::string>(); + assert_yaml_parsing(robot_node, "robot", "interface"); interface = robot_node["interface"].as<std::string>(); diff --git a/src/config_solo12.yaml b/src/config_solo12.yaml index 39367cd484c31e3de62a18512056119bbb2ea6df..e0f93df3f51ab5f253faabaf70f9c881407182e4 100644 --- a/src/config_solo12.yaml +++ b/src/config_solo12.yaml @@ -1,5 +1,6 @@ robot: # General parameters + config_file: config_solo12.yaml # Name of the yaml file containing hardware information interface: enp2s0 # Name of the communication interface (check with ifconfig) SIMULATION: true # Enable/disable PyBullet simulation or running on real robot LOGGING: false # Enable/disable logging during the experiment