Ask Your Question
0

How to compute angular velocity from linear velocity?

asked 2021-07-23 03:07:34 -0500

ThaiLe79_NA gravatar image

updated 2021-07-23 20:29:40 -0500

Hi, I get linear velocity (linear.x and linear.y) in geometry_msgs/Twist message. But the robot is controlled by linear.x and angular.z. So I want to ask how to calculate angular.z from linear.x and linear.y.

edit retag flag offensive close merge delete

Comments

Please edit your question and explain why you want to do this. Are you using move_base? In a properly configured move_base, this calculation should not be necessary because the Local Planner is expected to comply with the robot's physical motion restrictions.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-07-23 15:18:59 -0500 )edit

My problem is in pedsim. I want to control the robot there. In pedsim, controllable by rqt_robot_steering. However, there is an algorithm to calculate robot control parameters in this environment . Its results are in topic /pedsim_simulator/robot_position. I want to use this result for control. In this topic, there are 2 parameters: linear.x and linear.y. But controlling the robot in pedsim will use linear.x and angular.z. So I want to find a way to convert this.

ThaiLe79_NA gravatar image ThaiLe79_NA  ( 2021-07-23 20:24:05 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-24 07:22:34 -0500

Mike Scheutzow gravatar image

Mathematically, there is no direct conversion from (linear.x, linear.y) to (linear.x_, angular.z). However, if what you need to do is have the robot follow the same path, you can fake it by a rotate operation, followed by a drive_forward operation.

Treat the two input x,y values as vectors, and find the vector sum. In step 1, rotate the robot in place to point in the same direction as this new vector. In step 2, move forward using a linear.x_ value based on the length of the vector. (I call it x_ to emphasize that in most cases it is not the same value as the input linear.x.)

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: 2021-07-23 03:07:34 -0500

Seen: 222 times

Last updated: Jul 24 '21