Ask Your Question

Converting to geometry_msgs/twist

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

allenh1 gravatar image

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

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?


-Hunter A.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

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

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


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 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


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

Seen: 1,370 times

Last updated: Jul 25 '12