Ask Your Question
0

How to cmd_vel a 90 degree turn?

asked 2020-02-15 18:58:34 -0500

hannah1 gravatar image

updated 2020-02-16 04:50:42 -0500

gvdhoorn gravatar image

i want to command the robot like this but to turn just 90 degrees, then stop

rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 0.75, y: 0.0, z: 0.0}, angular:{x: 0.0, y: 0.0,z: 1.57}}'
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-02-15 20:15:03 -0500

updated 2020-02-15 20:16:01 -0500

You can create a relatively simple ROS node (or function) to do this with the following steps:

  • Create a TF listener and cmd_vel publisher
  • Ask TF the current odometric position (odom -> base link)
  • In a while loop:
    • publish some rotation command to cmd_vel, for instance 0.5 radians / second
    • Check TF to see the current pose, compute the amount you've rotated
    • If within a threshold, break from the loop
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-02-15 18:58:34 -0500

Seen: 28 times

Last updated: Feb 16