0
$\begingroup$

Rosanswers logo

I have been using the ros_control interface to implement a position controller to use both in Simulation (Gazebo) and on a real robot. My implementation inherits from control_base.h and I implement hardware_interface::PositionJointInterface.

My problem is that I would like to know the frequency of the update rate (base class code shown below) such to perform interpolation between desired and target joint positions such to follow a desired velocity.

 /// Calls \ref update only if this controller is running.
 void updateRequest(const ros::Time& time, const ros::Duration& period)
{
if (state_ == RUNNING)
  update(time, period);
 }

Is there a method that gives me back the update rate of this function (above). Is it in the Time and Duration variables ? I have so fare failed to find a good tutorial which explains in detail the usage of control_base.h etc.. any pointers would be welcome.


Originally posted by gpldecha on ROS Answers with karma: 285 on 2015-12-10

Post score: 0


Original comments

Comment by gvdhoorn on 2015-12-10:
I may be misunderstanding you, but isn't period the inverse of what you are asking?

Comment by gpldecha on 2015-12-10:
yes, it is have just figured it out.. was not use to using ros::time and ros::Duration

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Simply can get the frequency by doing period.toSec();


Originally posted by gpldecha with karma: 285 on 2015-12-10

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.