Ask Your Question
0

cmd_vel and motor command

asked 2013-06-08 00:57:24 -0500

Jason Perry gravatar image

updated 2013-11-18 07:27:36 -0500

tfoote gravatar image

Hi Our robot has 2 motors and 4 wheels , there's no odometry or encoder. I've ran Hector exploration (in gazebo) successfully and I can get cmd_vel twist message but the problem is I have no idea about how to change cmd_vel twist message to "our custom commands for motors". we can only send 4 bytes to low level of our robot to drive the robot and they're : { direction of left wheel(forward or backward) , direction of right wheel (forward or backward) , speed of left wheel , speed of right wheel } "speed of left and right wheel is in range of 0 to 100 and there's no unit for them". I was wondering if there's anyone who can help me out and tell me How I can change linear.x and angular.z into our custom speed? Thanks in advance

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-06-08 01:46:42 -0500

For moving straight you can choose the direction for wheels by considering the sign of linear.x and for the speed u have to figure through experimentation that what command in linear.x will correspond to a value between 0-100. Same goes for angular motion.

Until and unless you know what 0-100 value has effect on motors, you have to stick with experimentation.

You can through theory of forward kinematics for mobile robots for some theory on similar concept.

Hope this helps...

edit flag offensive delete link more

Comments

ayush_dewan thanks for your answer,I've already done some experiments. The robot spins once at the speed of 100 about 3 secs so the max ang vel = (2*pi)/3=2.094(rad/sec) and the robot's lin_vel=0.72(m/s).I modified the cmd_vel generator code as below:

Jason Perry gravatar imageJason Perry ( 2013-06-09 22:23:32 -0500 )edit

max_vel_lin= 0.72 max_vel_th = 2.094 min_vel_lin= 0.0 min_vel_th = 0.0 and the motor node : int mybot_ang_wheel_vel = (fabs(msg->angular.z)100)/(2.094); int mybot_lin_wheel_vel = (fabs(msg->linear.x)100)/(0.72);

Is it right?

Jason Perry gravatar imageJason Perry ( 2013-06-09 22:23:48 -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

1 follower

Stats

Asked: 2013-06-08 00:57:24 -0500

Seen: 1,840 times

Last updated: Jun 08 '13