ROS control library dive deep

Created At: 2024-04-25 02:46:48 Updated At: 2024-04-25 16:06:10

Here we will dive deep into ROS control and learn how to configure and load the library to the parameter server. In ROS control.launch file is used load yaml configuration file. A basic yaml file may contain the below information to actuate robots left and right wheel. In this example, let's see the yaml file.

ros configuration yaml file

Our first job is to load the yaml configuration file to the parameter server and then we will start the controller manager.

A launch is used to load the parameters to the server and this file always starts with launch tag.

Within the launch tag we will have rosparam tag to load a configuration file and at the same time we will mention the load command.

See the from the picture above, the first rosparam loads our configruation file about the wheels, and the second one joint_state_publisher will constantly publish the state of the wheel to the joint_state topic.

And after that we will publish our joint_state_publisher node which comes from joint_state_publisher package. The same is used to visual robot in RVIZ.

joint_state_publisher node also retrieves the urdf model of the robot from the parameter server and publish the information in a ROS topic.

Then we started the ROS controller manager from the ROS control library. Node controller_manager starts the controller of the robot.

Then we see there is args tag. This tag loads all the wheel controller (wheel_left_controller and wheel_right_controller) for the wheel controller manager. We also loaded joint_state_controller that will publish the status of the join in the joint_state topic.

Now the controller file is ready and could be launched by running the gazebo.launch file and then roslaunch command by mentioning your package name and the file name controller.launch

The command is

roslaunch mvrobot_controller controller.launch

Here in the command the second parameter is the package name. Make sure you replace that with your own package name.

Here on the above photo we can see the all the controllers have loaded first and then started. And now if we run the command

rostopic list

We will see the below out which confirms that all the topics  are running correctly. Last two items shows our wheel controllers are loaded. If we see carefully we will also see our joint_states topic.

And then the command

rostopic echo /joint_states

Would show the wheel current velocity, position, effort and related info. So joint_states topic shows robots pose and other two topics wheel_left_controller and wheel_right_controller are used to send velociy command to the robot.

We may also run the command

rostopic pub /wheel_left_controller and then press on the tab button of the keyboard

Now you will see that, your robot is moving. With the above command we just published velocity(0.5 radian/s) to the robot left wheel.  You can do the same for robot right wheel.

Comment

Add Reviews

Latest Posts

Subscribe our newsletter