[Bug] Unit 6 Diffbot Error loading the controller

This is an error report.


Screenshot of the error


Error details

Hello, I wanted to ask for advice for debugging this issue I had with the diff robot; I fixed one of the main issues which involved the missing xacro tag of the gazebo ros2_control dependency in its gazebo xacro file but after that was finished. I double checked the code from the xacro main file of the diff bot when you only need to add the tags for the xacro diff drive with the yaml file configuration for those joints and wheel joints. I am a bit lost on what to do next to debug or troubleshoot in having the controller manager active being able to activate the joint_state_broadcaster controller and the diff drive controller? Thank you all for your help!

diff_drive_controller_config.yaml

controller_manager:
ros__parameters:
update_rate: 10 # Hz

joint_state_broadcaster:
  type: joint_state_broadcaster/JointStateBroadcaster

diffbot_base_controller:
  type: diff_drive_controller/DiffDriveController

diffbot_base_controller:
ros__parameters:
left_wheel_names: [“left_wheel_joint”]
right_wheel_names: [“right_wheel_joint”]

wheel_separation: 0.10
#wheels_per_side: 1  # actually 2, but both are controlled by 1 signal
wheel_radius: 0.015

wheel_separation_multiplier: 1.0
left_wheel_radius_multiplier: 1.0
right_wheel_radius_multiplier: 1.034

publish_rate: 50.0
odom_frame_id: odom
base_frame_id: base_link
pose_covariance_diagonal : [0.001, 0.001, 0.001, 0.001, 0.001, 0.01]
twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.01]

open_loop: true
enable_odom_tf: true

cmd_vel_timeout: 0.5
#publish_limited_velocity: true
use_stamped_vel: false
#velocity_rolling_window_size: 10

# Velocity and acceleration limits
# Whenever a min_* is unspecified, default to -max_*
linear.x.has_velocity_limits: true
linear.x.has_acceleration_limits: true
linear.x.has_jerk_limits: false
linear.x.max_velocity: 1.0
linear.x.min_velocity: -1.0
linear.x.max_acceleration: 1.0
linear.x.max_jerk: 0.0
linear.x.min_jerk: 0.0

angular.z.has_velocity_limits: true
angular.z.has_acceleration_limits: true
angular.z.has_jerk_limits: false
angular.z.max_velocity: 1.0
angular.z.min_velocity: -1.0
angular.z.max_acceleration: 1.0
angular.z.min_acceleration: -1.0
angular.z.max_jerk: 0.0
angular.z.min_jerk: 0.0

diffbot.gazebo.xacro:

<?xml version="1.0"?>

<xacro:macro name=“diffbot_gazebo” params=“prefix”>

$(find diffbot_description)/config/diff_drive_controller_config.yaml

diffbot.ros2_control.xacro

<?xml version="1.0"?>

<xacro:macro name=“diffbot_ros2_control” params=“name prefix use_fake_hardware:=^|false fake_sensor_commands:=^|false use_sim:=^|false”>

<!-- Add the ros2_control XML tags below this line -->

<ros2_control name="diff_drive" type="system">

  <hardware>
      <plugin>gazebo_ros2_control/GazeboSystem</plugin>
  </hardware>

  <joint name="left_wheel_joint">
    <command_interface name="velocity">
      <param name="min">-1</param>
      <param name="max">1</param>
    </command_interface>
    <state_interface name="position"/>
    <state_interface name="velocity"/>
    <state_interface name="effort"/>
  </joint>

  <joint name="right_wheel_joint">
    <command_interface name="velocity">
      <param name="min">-1</param>
      <param name="max">1</param>
    </command_interface>
    <state_interface name="position"/>
    <state_interface name="velocity"/>
    <state_interface name="effort"/>
  </joint>

</ros2_control>

</xacro:macro>

Hi @Agarcia5612 ,

Firstly, for the controller to launch and load successfully, you MUST have the robot loaded and spawned in Gazebo Simulation.

If you have the spawn code in your launch file and the robot has not spawned, then you have an issue with your robot description file.

First spawn the robot. Make sure that robot is spawned by looking at the simulation window.
Then launch the controllers one by one using the command line first. Once you verify everything works, you can combine them into one single launch file.

Regards,
Girish

Hi Girish,

I did load the robot correctly in the simulation.  My apologies for the low-quality picture. The diff sim robot is there on the side and I was able to have the robot move as described in the tutorial. The main thing that changed was that I ran it today the same way as I did previously following the steps in the tutorial and now it worked perfectly. I do want to thank you for the recommendations when running into this issue when I am working on the Ubuntu system ROS2 controls in my simulation these recommendations are very valuable sources of advice. So thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.