I know there is already a lot of questions on this particular error but none of the ones i found solved the issue for me...
I'm trying to implement the ROS differential drive controller for a two wheeled robot in gazebo, but when launching the controller spawner I get the following output :
[INFO] [1585302057.569863, 0.000000]: Controller Spawner: Waiting for service controller_manager/load_controller
[WARN] [1585302087.735023, 40.162000]: Controller Spawner couldn't find the expected controller_manager ROS interface.
In fact, trying to list controller_manager services gives no output :
$ rosservice list | grep controller_manager
$
I'm running ros melodic on Ubuntu 18.04.
Here is my config file diff_drive.yaml
:
wheelchair_controler:
type : "diff_drive_controller/DiffDriveController"
left_wheel : 'left_wheel_motor'
right_wheel : 'right_wheel_motor'
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 : 0.52
wheel_radius : 0.3048
# 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_link #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
Here is the launch file. I tried to put the spawner in a separate launch file to make sure gazebo add time to launch properly.
<?xml version="1.0"?>
<launch>
<!-- Controllers -->
<rosparam file="$(find wheelchair_simulation)/config/diff_drive.yaml" command="load" />
<node name="wheelchair_controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="wheelchair_controler" />
</launch>
In my .xacro
file I use a macro to define my wheels, joints, and gazebo tags. I also added a transmission inside it :
<xacro:macro name="main_wheel" params="prefix reflect">
<link name="main_${prefix}_wheel">
<visual>
<geometry>
<cylinder length="${main_wheel_length}" radius="${main_wheel_radius}"/>
</geometry>
<material name="black"/>
</visual>
<collision>
<geometry>
<cylinder length="${main_wheel_length}" radius="${main_wheel_radius}"/>
</geometry>
</collision>
<inertial>
<xacro:cylinder_inertia length="${main_wheel_length}" radius="${main_wheel_radius}" weight="${main_wheel_mass}"/>
</inertial>
</link>
<joint name="${prefix}_wheel_motor" type="continuous">
<axis xyz="0 0 1"/>
<parent link="base_link"/>
<child link="main_${prefix}_wheel"/>
<origin rpy="${-reflect*1.5708} 0 0" xyz="0 ${reflect*((total_width - main_wheel_length)/2 + 0.001)} 0"/>
<gazebo>
<implicitSpringDamper>true</implicitSpringDamper>
</gazebo>
<dynamic friction="0.1"/>
</joint>
<transmission name="${prefix}_wheel_transmission">
<type>transmission_interface/SimpleTransmission</type>
<joint name="${prefix}_wheel_motor">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="${prefix}_wheel_motor">
<mechanicalReduction>1</mechanicalReduction>
<hardwareInterface>VelocityJointInterface</hardwareInterface>
</actuator>
</transmission>
<gazebo reference="main_${prefix}_wheel">
<mu1>0.8</mu1>
<mu2>0.8</mu2>
<turnGravityOff>false</turnGravityOff>
<material>Gazebo/Black</material>
</gazebo >
</xacro:macro>
I made sure to install gazebo_ros_controle
:
$ sudo apt-get install ros-melodic-gazebo-ros-controle
And to link it in my description file :
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_contol.so">
</plugin>
</gazebo>
Finally, I checked the dependencies and everything looks ok :
$ rosdep check controller_manager
All system dependencies have been satisified
EDIT : I add the description of the base_link and base_footprint links, in case it's necessary as I saw somewhere that the frame for the controller must have inertia
<!-- Dummy link because first link should not have any inertia. Located on the ground between both wheels for easier control -->
<link name="base_footprint"/>
<!-- Footprint and main inertia of the chair -->
<link name="base_link">
<visual>
<geometry>
<box size="${total_length} ${total_width} ${seat_height - ground_clearence}"/>
</geometry>
<origin xyz="${-main_wheel_radius + total_length/2} 0 ${a}"/>
<material name="white"/>
</visual>
<collision>
<geometry>
<box size="${total_length} ${total_width} ${seat_height - ground_clearence}"/>
</geometry>
<origin xyz="${-main_wheel_radius + total_length/2} 0 ${a+0.1}"/>
</collision>
<inertial>
<xacro:box_inertia height="${seat_height - ground_clearence}" length="${total_length}" width="${total_width}" weight="${total_mass-2*main_wheel_mass}"/>
</inertial>
</link>
<joint name="base_link_joint" type="fixed">
<parent link="base_footprint"/>
<child link="base_link"/>
<origin xyz="${-total_length/2 + main_wheel_radius} 0 ${main_wheel_radius}"/>
</joint>
I sincerely hope some of you can find the issue because I have no clue about where it comes from... Feel free to ask any missing details.
Thank you in advance !!
For anyone experiencing this problem, for us the issue was that one of the
model.sdf
files included in the gazebo.world
file was missing and causing this error.