Skip to content

Subscribers and Publishers

chris-smith edited this page Aug 27, 2013 · 12 revisions

Subscribers and Publishers are generally written using two of the following three vis: ROS_Topic_Init, ROS_Topic_Read, and ROS_Topic_Write.

The initialize function takes in the topic name and pushes out a cluster called Baxter Out, which is wired to either the read or write function. So a vi to nod Baxter’s head would look like this

head nod vi

If no node is specified, the default node in BaxterDefinition will be used. The Nod Command in this case is simply a Boolean, so a 1 or a 0 can be wired straight into the write function. You may find that after wiring a number of publishers and subscribers together, that some of the publishers aren’t publishing as frequently as you need them to. For example, Baxter’s Position Controllers timeout after 0.05s, so messages need to be published at 20Hz. If you’re not able to get that rate in your main program, you can replace ROS_Topic_Write with ROS_Topic_Write_Continuous. The continuous vi will make the topic server running in the background publish the most recently received message as quickly as possible. There is currently a known bug when multiple publishers are run in a loop, where some of them will never complete the connection after registering.

A vi to subscribe to Baxter’s joint states would look like this

Joint State vi

Clone this wiki locally