• Diff for "pr2_mechanism/Tutorials/Communicating with a realtime joint controller"
Differences between revisions 20 and 21
Revision 20 as of 2009-10-14 21:10:33
Size: 2370
Editor: wim
Comment:
Revision 21 as of 2009-10-14 21:10:38
Size: 2306
Editor: wim
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from controllers/Tutorials/MakingControllers

Note: This tutorial assumes that you have completed the previous tutorials: Running a realtime joint controller.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Communicating with a realtime joint controller

Description: This tutorial teaches you how to communicate with a controller over ROS.

Tutorial Level: INTERMEDIATE

Next Tutorial: Adding a PID to a realtime joint controller

External Communication

Your controller can communicate with the outside world using ROS. The controller can publish and receive messages like any other node, however, you must be careful to ensure that you do not break realtime nor introduce any race conditions. To achieve this goal, there exist specialized mechanisms for publishing and receiving messages that hide much of the complexity.

The RealtimePublisher provides an easy interface for publishing messages safely from realtime. Call trylock, and then fill in the fields of msg_, and then the message will be published soon after calling unlockAndPublish.

Getting information from received messages into the realtime process is slightly more difficult. You should subscribe to the topic as you would in any node. ROS will pass you the message in a callback (like usual) that runs in the ROS-thread, a non-realtime thread. You can use the RealtimeInfuser to get the message information into the realtime thread. In non-realtime, place the data into the realtime infuser using the set method, and read it out by calling next at the beginning of each realtime iteration.

Tools

Pids

KDL

Filters

Wiki: pr2_mechanism/Tutorials/Communicating with a realtime joint controller (last edited 2016-08-14 04:17:21 by Crescent)