I would like to implement a planning algorithm on ROSbot XL, since it has omnidirectional wheels, and I was wondering if we have access to the speed of the motors individually. If so, what topic should we publish the commands to for each motor? Thank you so much!
You can control individual wheels directly, but safety functions make unrestricted use difficult. The feature you’re looking for is available via the /_motors_cmd topic. You can publish messages to this topic using the following command:
The data field represents the angular velocity for each wheel in rad/s, in the following order: Rear Right (RR), Rear Left (RL), Front Right (FR), Front Left (FL).
Important Notes
When you launch the ROS driver, either the diff_drive_controller or mecanum_controller will start by default (you can enable the mecanum_controller by adding the mecanum:=true flag in compose.yaml). Both controllers will send zero values by default if no commands are received on cmd_vel, which effectively stops the robot if the connection is lost. This could cause any data you send via the topic to be overridden by the zero values from the controller. To avoid this:
You can run the microros service by itself, without the rosbot_ros service (use docker compose up microros). However, this will cause other topics to disappear.
thank you so much for your complete answer! It definitely helps a lot. I will try to do as you said. I was wondering only about the part we will need to edit in the code at the repository to stop overwriting on the controller we are developing/disabling the default controller for the robot. Thank you!
There is no ready-made python code example for your purposes.
As for modifications, it’s hard for me to say what you should do because I don’t know what exactly you want to achieve.
a) If yo u are not satisfied with the operation of mecanum_controller, it would be best to edit it as you wish or fine-tune its parameters. From the controller level you have access to hardware interfaces.
as promised, I checked publishing on /_motors_cmd and what I realized is that if the frequency of publishing on this node is high enough, it can overwrite the other node that is trying to stop the motors. Of course, it is a lazy approach but it works! In the future, I will try rebuilding the source file with that modification and running the robot with it and see if we get any improvements. Thank you!