0
$\begingroup$

Rosanswers logo

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


Originally posted by Jason Perry on ROS Answers with karma: 3 on 2013-06-08

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by ayush_dewan with karma: 1610 on 2013-06-08

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Jason Perry on 2013-06-09:
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:

Comment by Jason Perry on 2013-06-09:
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?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.