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

Converting to geometry_msgs/twist

asked 2012-07-25 05:51:39 -0600

allenh1 gravatar image

updated 2012-07-26 05:28:32 -0600

joq gravatar image

So I have a question about sending velocity commands. I have a tcp interpreter that breaks down a normal tcp string with a regular expression and sends it as a ros string. I want it to publish a command velocity as a geometry_msgs/twist. My problem comes from the message type...

The recieved string is a linear velocity in m/sec and an angular velocity in rad/sec. How does one convert this to a Twist message?

thanks,

-Hunter A.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2012-07-25 05:57:01 -0600

Lorenz gravatar image

In general, I would try to avoid using strings because you might run into problems because of number encoding and maybe truncated digits.

To fill the twist message, just set twist.linear.x to your linear velocity and twist.angular.z to your angular velocity.

edit flag offensive delete link more

Comments

Thanks! The reason for the strings is the lab down the hall... They don't write code for robots and they use windows. I code the interface for the robots, and it uses tcp (just like ros) to communicate. It worked in player, so I just changed it to work in ros.

allenh1 gravatar image allenh1  ( 2012-07-25 06:19:07 -0600 )edit

Question Tools

Stats

Asked: 2012-07-25 05:51:39 -0600

Seen: 1,818 times

Last updated: Jul 25 '12