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

Revision history [back]

A quick and dirty method to achieve this is using a system call to execute the rostopic command line utility.

The command:

rostopic pub -1 my_topic geometry_msgs/vector3 '{x: 0.1, y: 1.1, z: 2.1}'

Will publish a single message of the topic then return. You can execute this command from a non ROS c program using the system function from stdlib.h. There are better ways of achieving this but none of them are as simple as this.

It's worth noting that you can execute ROS nodes by simply executing the binary as well as using rosrun. It's just a bit trickier to find where those binaries actually exist if you're not used to the directory structure.

Hope this helps.