I tried to control bb9 to turn 90 degrees by the following code:
from geometry_msgs.msg import Twist, Vector3
from math import pi
pub = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
move = Twist()
move.linear.x = 0.0
move.linear.y = 0.0
duration = 10
move.angular.z = pi*2/4/duration
move.angular.z = 0
but it turned out that it rotated clearly far more than 90 degrees.
Can someone give a hint what is the problem here?
thank you so much!
I had the same problem. The issue is that if you turn too fast, things dont work. Also the robot has to accelerate to that speed and then decelerate, making it inaccurate. Try setting your angular speed to 0.2 and turning it for 4 seconds and adjust going from there.
Another tip: when implementing this later in a loop to move in a square path, make sure you use rospy.Rate(10).sleep()
If you send /cmd_vel commands too quickly, things get fucked.
use linear and angular speed smaller than 0.3
use a rate of 10hz for your loops
Thank you very much for your tips!