rbonghi / roboteq_control

⚙️ Driver for Roboteq devices using ros_control

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timing issue: Access too often to Param Server

AlexisTM opened this issue · comments

The following reads the ratio whenever called.
It is bad for runtime as it is a blocking networking task.
Instead, the parameter should be read at the start of the node, also because it is very likely that this value will not change.

/**
* Conversion of radians to encoder ticks.
*
* @param x Angular position in radians.
* @return Angular position in encoder ticks.
*/
double Motor::to_encoder_ticks(double x)
{
double reduction = 0;
// Get ratio
mNh.getParam(mMotorName + "/ratio", reduction);
//ROS_INFO_STREAM("to_encoder_ticks:" << reduction);
// apply the reduction convertion
if(_sensor != NULL)
reduction = _sensor->getConversion(reduction);
// Return the value converted
return x * (reduction) / (2 * M_PI);
}

Gotcha!
I will start to fix soon!

Hi @AlexisTM,

I know, you don't believe on my message, but I'm fixing this issue! Yes, we are close to easter, the weather is not bad, but maybe will snow today :-D

I move the reduction parameter on Motor initialization. I'm already testing, but look like fine this fix.
6c59d5d

I will close this issue for this week, if everything is fine.

Definitely better :)

The issue was extremely clear when having a remote master. With a local master, it is bad practice but still works (as you have something like 40Gb/s bandwidth)