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

Revision history [back]

This is an example of publishing some command topics with a threaded ros node. Basically, the message format is:

sim_velocity  = nh.advertise<geometry_msgs::Twist>("/cmd_vel", 100);

geometry_msgs::Twist cmd_msg;
cmd_msg.linear.x = m_speed;
cmd_msg.angular.z = m_angle;

sim_velocity.publish(msg);

The above is published each time ROS spins. m_speed and m_angle are doubles that are member variables to the thread, but you could use global variables in a non class-based approach. Questions? I don't mind answering! Just comment and I'll revise this answer. Best of luck, and welcome to ROS!