In this video we are going to see why a ROS developer can’t launch a PR2 Gazebo simulation, mainly because the ROS controllers are not found.
We will see which are the ROS packages which provide all the required controllers for the PR2. We will also see how you can apply this check to your own robot simulation, in case it complains about the controllers not being loaded.
The above command should output various controllers and thier status.
Now the above case is for the working environment where all the required packages are installed. If some packages are missing then we should systematically look for packages and dependencies. The packages mostly fall into two categories: gazebo-ros controllers and robot specific controllers (pr2-controllers specifically for our case)
ros-control : To list the available ros-control packages use the following command
$ dpkg -l | grep ros-control
There are two important packages in this category ros-kinetic-gazebo-ros-control and ros-kinetic-ros-controllers
gazebo-ros : To list the available gazebo-ros related packages use the following command
$ dpkg -l | grep gazebo-ros
The output of the command should contain the following two names ros-kinetic-gezebo-ros and ros-kinetic-gezebo-ros-control (this one was seen in previous commands output also)
controller interfaces : To list the installed controller interface packages use the command
$ dpkg -l | grep controller-interface
The output of this command should show the following names ros-kinetic-controller-interface, ros-kinetic-controller-manager, ros-kinetic-controller-manager-msgs
controllers : In gazebo we use various controllers to actuate different types of joints. We need to check for the following ones
joint state controllers : The output of the following command should contain ros-kinetic-joint-state-controller
$ dpkg -l | grep joint-state
joint trajectory controllers : The output of the following command should contain ros-kinetic-joint-trajectory-controller
$ dpkg -l | grep joint-trajectory
effort controllers : The output of the following command should contain ros-kinetic-effort-controllers
$ dpkg -l | grep effort-controllers
velocity controllers : The output of the following command should contain ros-kinetic-velocity-controllers
$ dpkg -l | grep velocity-controllers
Finally we need to check for PR2 robot related controllers to be able to launch the simulation. Use the following commands
We expect to see the following names in the output of those commands
ros-kinetic-pr2-controller-manager,
ros-kinetic-pr2-controller-interface,
ros-kinetic-pr2-controller-configuration-gazebo,
ros-kinetic-pr2-controllers-msgs,
ros-kinetic-pr2-mechanism-controllers,
ros-kinetic-pr2-mechanism-diagnostics,
ros-kinetic-pr2-mechanism-models,
ros-kinetic-pr2-mechanism-msgs
If we have all of these packages installed in our computer, we will be able to launch the pr2 robot. That’s all for this post. Thanks for watching the video, please leave your comments and subscribe the channel if you want to see more such videos.
Did you like this video? Do you have questions about what is explained? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other.
If you want to learn about other ROS topics, please let us know on the comments area and we will do a video about it.
This is a series of posts. If you didn’t follow up, you can find the previous post here. In this 5th video of the robotic manipulator series, we will expand the ROS controllers to all joints of our robot using XACRO. At the end of the video we’ll have a full controlled robot through ROS topics. We are also going to use RQT Publisher and RQT Reconfigure to do some experiments with the robot.
Step 0. Create a project in ROS Development Studio(ROSDS)
ROSDS helps you follow our tutorial in a fast pace without dealing without setting up an environment locally. If you haven’t had an account yet, you can create a free account here. We’ll start the project for the previous video – manipulator_video_no4.
Step 1. Configure controller
In order to use controllers for our robot. The first step is we need to add transmission definitions for each joint in the links_joints.xarco and add limitation for each joint in the mrm.xarco file. The most important thing is to add the gazebo plugin in the mrm.xarco file.
Did you like the video? If you did please give us a thumbs up and remember to subscribe to our channel and press the bell for a new video every day. Either you like it or not, please share your thoughts and questions in the comments area. See you!
In this video we are going to see how to configure the differential drive ROS controller for a wheeled robot using a Gazebo simulation.
This is a video trying to answer the question of Jaime posted at the ROS answers forum about how he cannot make the controller work, and receiving the error:
Controller Spawner couldn’t find the expected controller_manager ROS interface
Step1. Create Project
Let’s start with creating a new project in ROS development studio.
Notice: If you haven’t had an account yet. You can register one here for free.
Step2. Spawn a robot
As an example, we’ll use a self-build two-wheel differential drive robot.
You can test the code with your own robot with differential drive configuration.
Step3. Add the controller configuration file for your robot
Put the configuration file(e.g. the my_diff_drive.yaml file shows here) under the config folder, your source tree may look like this.
Let’s start by pasting the whole code from the question into the my_diff_drive.yaml file.
mobile_base_controller:
type : "diff_drive_controller/DiffDriveController"
left_wheel : 'wheel_left_joint'
right_wheel : 'wheel_right_joint'
publish_rate: 50.0 # default: 50
pose_covariance_diagonal : [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
# Wheel separation and diameter. These are both optional.
# diff_drive_controller will attempt to read either one or both from the
# URDF if not specified as a parameter
wheel_separation : 1.0
wheel_radius : 0.3
# Wheel separation and radius multipliers
wheel_separation_multiplier: 1.0 # default: 1.0
wheel_radius_multiplier : 1.0 # default: 1.0
# Velocity commands timeout [s], default 0.5
cmd_vel_timeout: 0.25
# Base frame_id
base_frame_id: base_footprint #default: base_link
# Velocity and acceleration limits
# Whenever a min_* is unspecified, default to -max_*
linear:
x:
has_velocity_limits : true
max_velocity : 1.0 # m/s
min_velocity : -0.5 # m/s
has_acceleration_limits: true
max_acceleration : 0.8 # m/s^2
min_acceleration : -0.4 # m/s^2
has_jerk_limits : true
max_jerk : 5.0 # m/s^3
angular:
z:
has_velocity_limits : true
max_velocity : 1.7 # rad/s
has_acceleration_limits: true
max_acceleration : 1.5 # rad/s^2
has_jerk_limits : true
max_jerk : 2.5 # rad/s^3
Step4. Create Launch file
For our case, the launch file should look something similar like this.
The args for the controller should have the same name in the .yaml file which is “mobile_base_controller”
According to the .yaml file, there is no namespace /robot here, so we don’t need to add this to the controller node.
Things to make sure:
The left wheel and right wheel in the .yaml file should be the same as your robot’s URDF definition.
The gazebo controller should be added to the URDF definition as well as the transmission tag which will be used for the gazebo controller. In our case, we add the following code in the .urdf to add gazebo control in it.
If you see the following topics, then your controller is up and run correctly.
Takeaway today:
The arg name of the controller node should be the same as in the controller configuration file.
Don’t specify robot namespace if you are not using it.
The joint name in the controller configuration file should be the same as the name in urdf
The gazebo_ros_control plugin should also be added to the urdf file.
Remember to compile again before you run.
If you want to learn more about ROS control and how to build a two-wheel robot in ROS from scratch, please visit Robot Ignite Academy for more information.
ROS Control Tutorials #Unit 1: Introduction to ROS Control
In this short video you’ll be introduced to ROS Control, an aspect of ROS that enables robots to move and get things done. We’ll be using Gazebo robot simulation. Follow along!
[irp posts=”8194″ name=”All about Gazebo ROS (Gazebo 9)”]
ROS Control Tutorials #Unit 2: Basic Concepts
In this video we look at some basic theoretical concepts regarding ROS control that we will use throughout the rest of the course.
ROS Control Tutorials #Unit 3 : How To Configure and Launch the Controllers
This video explains how to configure and launch the controllers after configuring transmissions and the Gazebo plugin in the robot URDF files. It shows: 1. how to create a package to launch the controllers, and 2. how to write commands to test the controllers.
We show you a manual method to tune a PID for a robot that uses ROS Control to control its joints with a position controller. This method is very artisan but it is enough for most of the cases.
We do not teach how ROS Control works in this video. We assume you already know how to configure a joint to work with the ROS controllers.
Step 1. Create a project in ROS Development Studio(ROSDS)
ROSDS helps you follow our tutorial in a fast pace without dealing without setting up an environment locally. If you haven’t had an account yet, you can create a free account here. Let’s call the testing.
Step 2. Tune PID
At first, let’s launch the rrbot simulation from Simulations->RRBot. To control the robot, we also need to launch the control with
roslaunch rrbot_control rrbot_control.launch
You will have to tune the pid value in the rrbot_contorl.yaml file in the rrbot_control package under the config.
We can also use rqt_gui to help us tune the parameter.
rosrun rqt_gui rqt_gui
Then open the Tools->graphical tool.
In the gui, let’s send command to the rrbot/joint1_position_controller/command topic to control the robot. The message type is automatically selected to std_msgs/Float64. We’ll change the frequency to 50 Hz, then click +.
Then click the + on the left to unfold the topic and change the expression to sin(i/50)*0.5. Check the box on the left side to start publishing into the topic.
You should see the robot starts to swing it’s arm now.
It’s also possible to plot the message from Plugins->Visualization->Plot
Select the correct topic /rrbot/joint1_position_controller/state/process_value/data then click +. You should see the data sent.
How about the actual value? It’s in the topic /rrbot/joint1_position_controller/state/process_value.
You’ll see that the actual state of the robot didn’t follow the command sent to the robot. That’s the reason why we need to tune the pid value.
Let’s open another tool to help us tune the value at the same time. Go to Plugins->Configuration->Dynamic Reconfigure.
You can change all the pid value in the plugin.
To tune the pid:
We start by increasing the p value to make the controller output more to catch the command.
Increase the d value a bit to make the movement smoother.
You should see the state can synchronize with the command now. You can change the command to see if the controller can follow the command nicely. Then you can save the value in the rrbot_controller.yaml file.
Remember, you have to launch the controller again to apply the new value.
If you need to understand better ROS Control, please take the following course for fast understanding: