I wanted to implement a datastore call to be able to set the PD gains for all joints from within any mc-rtc controller.
Right now I'm doing works well with what is shown in the patch below.
Since later I want to implement the same call (with the exact same signature) in mc-openrtm too,
I would like to know your suggestions on whether this is the best way to implement it.
How to call
```
// set new pd gains
bool mod_servo_success = false;
if(ctl.datastore().has("set_pdgains::" + ctl.robot().name()))
{
mod_servo_success = ctl.datastore().call("set_pdgains::" + ctl.robot().name(), kp, kd);
}
if (!mod_servo_success)
{
mc_rtc::log::warning("[{}] Could not set PD gains through datastore call!!!", name());
}
```
maybe similar functions for reading/setting individual gains (i.e. for one joint, not setting P or D individually)
I would reverse the name and switch to CamelCase i.e. robot().name() + "::SetPDGains"
the implementation of the call should print a message if there is an error with the parameters (i.e. size of kp or size of kd is wrong) to save time in case of issues.
Hi @gergondet
I wanted to implement a datastore call to be able to set the PD gains for all joints from within any mc-rtc controller. Right now I'm doing works well with what is shown in the patch below.
Since later I want to implement the same call (with the exact same signature) in mc-openrtm too,
I would like to know your suggestions on whether this is the best way to implement it.
How to call
``` // set new pd gains bool mod_servo_success = false; if(ctl.datastore().has("set_pdgains::" + ctl.robot().name())) { mod_servo_success = ctl.datastore().call