ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
From the documentation, this is the definition of a geometry_msgs/Twist
message:
# This expresses velocity in free space broken into its linear and angular parts.
Vector3 linear
Vector3 angular
So to fill it, you only have to set it like this (the same way than within a normal ROS node):
geometry_msgs::Twist msg;
msg.linear.x = 1.0; // m/s
msg.angular.z = 0.5; // rad/s
Then you can publish it with your already defined publisher (note that we pass a pointer with rosserial_arduino
):
cmd_pub.publish(&msg);
To see an publisher example on rosserial_arduino
, please, look at this tutorial.