cmd_vel and motor command

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 close merge delete

Sort by ยป oldest newest most voted

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...

more

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:

( 2013-06-09 22:23:32 -0600 )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?

( 2013-06-09 22:23:48 -0600 )edit