ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Is there any complete example on velocity_controllers/JointTrajectoryController ?

asked 2021-12-11 18:36:00 -0500

xman236 gravatar image

updated 2022-02-18 13:20:48 -0500

lucasw gravatar image

I am trying to understand how to implement this velocity_controllers/JointTrajectoryController.

More specifically, I am curious about the part after generating the control points. For instance, how to control a real robot in using this controller:

  • How to forward the velocity value to the robot
  • How to keep the trajectory using the feedback information
  • How to keep the planned execution time and so on.

I understand that this will strongly vary on types of robots, since it involves the direct low-level control. However, is there any valid example of this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-02-18 15:36:00 -0500

lucasw gravatar image

https://github.com/ros-controls/ros_c... may be a useful example for you, rrbot.cpp has a RobotHW- you have to implement sending the velocity value to the robot yourself, but in that file you can see that it creates a pos_cmd_ member variable, which is then given to the controller via the registerHandle()- then when the write method is called after a controller manager update you are able to read pos_cmd_ and do what is needed to get it to hardware (possibly publish it on a regular ros topic, though in glancing at rrbot.cpp I'm not sure what it is doing).

The feedback arrives via joint states, I'd have to double check but I think a subscriber to JointState messages is created for you by setting up a joint state interface.

There are a lot of components in play so it is confusing what data goes where, what entity owns it and when it is safe to read or write, how it was updated, what you have to do vs. what is take care of. The use of plugins that are loaded at run time via service call also adds another layer to get through (though you can hard code the loading of plugins in your controller manager instead).

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-12-11 18:36:00 -0500

Seen: 181 times

Last updated: Feb 18 '22