ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Hi!
I've tested your code (the rotation part) and it works nice except for 1 bug, here:
if(clockwise)
vel_msg.angular.z = -abs(angular_speed);
else
vel_msg.angular.z = abs(angular_speed);
These abs() functions will return 0 for all values between 0 and +-1. So, for instance, if the angular velocity is 0.5 rad/s, you will get a 0 there, thus the robot won't rotate. It can be easily solved though, just removing the abs() functions:
if(clockwise)
vel_msg.angular.z = -angular_speed;
else
vel_msg.angular.z = angular_speed;
It should work perfect with this change. You can check the following post if you want to see how I tested your code.
Cheers!