Velocities Turtlebot cmd_vel
Hi, I have a doubt concerning the velocities, especially the angular one. If I want to make Turtlebot spin 90 degrees for a second, for example, what angular vel. should I set? Would it change something if I also set the linear one?
I have this code:
ros::Rate loop_rate(1); //Frecuencia de realización del bucle (10 Hz)
while (ros::ok()) //Bucle mientras no se reciba "Ctrl+C"
{
vel.linear.x = 0; //velocidad de avance
vel.angular.z = 1.57; //velocidad de giro
vel_pub_.publish(vel);
loop_rate.sleep();
}
I guess that with this code, each message arrives each second. How should I modify this code to make the robot spin 90 degrees in one second?
Yes, this would send 1 msg/second. That is usually insufficient for controlling a robot as there are (hopefully) safety timeouts in place that stop any movement without data after something like 100ms. Send the message more frequently and stop after 1 second or do it properly with a controller as @joq suggested.