stack-of-tasks / sot-core

Hierarchical task solver plug-in for dynamic-graph
BSD 2-Clause "Simplified" License
19 stars 32 forks source link

Add set_parameter and get_parameter to ParameterServer #135

Closed olivier-stasse closed 4 years ago

olivier-stasse commented 4 years ago

Using the new Command template in dynamic-graph, this PR implements a simple parameter server using a map of strings (the key is also a std::string).

It allows writing

param_server.setParameter("urdf_model",urdf_rrbot_model_string)
model2_string=param_server.getParameter("urdf_model")

A unit test is implemented. clang-format has been applied.

nim65s commented 4 years ago

Is the test actually testing anything, or just printing things for now ?

olivier-stasse commented 4 years ago

Is the test actually testing anything, or just printing things for now ?

It is testing the set_parameter and get_parameter member function of the ParameterServer class. The test should check that the string is the same through the two methods.

nim65s commented 4 years ago

I can't see where anything is tested. I can only see some print.

If you do

param_server.setParameter("urdf_model", urdf_rrbot_model_string)
model2_string = param_server.getParameter("urdf_model")

I would expect something like a self.assertEqual(urdf_rrbot_model_string, model2_string), somewhere.

olivier-stasse commented 4 years ago

One important point. This works only with https://github.com/stack-of-tasks/dynamic-graph/pull/65

nim65s commented 4 years ago

I though that this would not work until a new release on dynamic-graph. In this case, it would have been better to wait that before merging, or to explain why would you need to do so, as it will break the CI for all future work on the devel branch.