ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Problems with loading and configurating DiffDrive and JointStateBroadcaster controllers. [closed]

asked 2022-12-05 04:15:03 -0600

Edvard gravatar image

updated 2022-12-06 01:54:34 -0600

Hi. Sorry for all mistakes, English is not my native language. So I'm launching my gazebo simulation with JointStateBroadcaster and DiffDrive controllers. Gazebo loads without notable errors but then controllers start to load I receive following logs in terminal:

[gzserver-6] [INFO] [1670244707.718918444] [gazebo_ros2_control]: Loading controller_manager
[gzserver-6] [WARN] [1670244707.830804032] [gazebo_ros2_control]:  Desired controller update period (0.02 s) is slower than the gazebo simulation period (0.001 s).
[gzserver-6] [INFO] [1670244707.831187703] [gazebo_ros2_control]: Loaded gazebo_ros2_control.
[gzserver-6] [INFO] [1670244707.880241583] [controller_manager]: Loading controller 'minicar_cll'
[gzserver-6] [INFO] [1670244707.969517659] [controller_manager]: Setting use_sim_time=True for minicar_cll to match controller manager (see ros2_control#325 for details)
[spawner.py-3] [INFO] [1670244707.973501681] [spawner_minicar_cll]: Loaded minicar_cll
[gzserver-6] [INFO] [1670244707.977437769] [controller_manager]: Configuring controller 'minicar_cll'
[gzserver-6] [INFO] [1670244708.048451910] [controller_manager]: Loading controller 'joint_s_b'
[gzserver-6] [INFO] [1670244708.178457173] [controller_manager]: Setting use_sim_time=True for joint_s_b to match controller manager (see ros2_control#325 for details)
[spawner.py-5] [INFO] [1670244708.200924658] [spawner_joint_s_b]: Loaded joint_s_b
[gzserver-6] [INFO] [1670244708.204831040] [controller_manager]: Loading controller 'joint_s_b'
[gzserver-6] [ERROR] [1670244708.205196239] [controller_manager]: A controller named 'joint_s_b' was already loaded inside the controller manager
[gzserver-6] [ERROR] [1670244708.226174298] [controller_manager]: Can't activate controller 'minicar_cll': Command interface with 'front_left_steering_joint/velocity' does not exist
[spawner.py-3] [INFO] [1670244708.255965445] [spawner_minicar_cll]: Configured and started minicar_cll
[gzserver-6] [INFO] [1670244708.262011951] [controller_manager]: Configuring controller 'joint_s_b'
[ERROR] [spawner.py-2]: process has died [pid 5069, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py joint_s_b --ros-args'].
[INFO] [spawner.py-3]: process has finished cleanly [pid 5071]
[spawner.py-5] [INFO] [1670244708.351449614] [spawner_joint_s_b]: Configured and started joint_s_b
[INFO] [spawner.py-5]: process has finished cleanly [pid 5075]
[INFO] [spawner.py-9]: process started with pid [5305]
[gzclient-7] context mismatch in svga_surface_destroy
[gzclient-7] context mismatch in svga_surface_destroy
[spawner.py-9] [INFO] [1670244708.899426522] [spawner_minicar_cll]: Controller already loaded, skipping load_controller
[gzserver-6] [INFO] [1670244708.902372504] [controller_manager]: Configuring controller 'minicar_cll'
[gzserver-6] [ERROR] [1670244708.998457025] [controller_manager]: Can't activate controller 'minicar_cll': Command interface with 'front_left_steering_joint/velocity' does not exist
[spawner.py-9] [INFO] [1670244709.020476614] [spawner_minicar_cll]: Configured and started minicar_cll

minicar_cll here is diff_drive controller.

Here is yaml file with controllers settings:

controller_manager:
  ros__parameters:
    update_rate: 50  # Hz
    use_sim_time: True

    joint_s_b:
      type: joint_state_broadcaster/JointStateBroadcaster

    minicar_cll:
      type: diff_drive_controller/DiffDriveController

minicar_cll:
    ros__parameters:
        left_wheel_names: ['front_left_wheel_joint', 'rear_left_wheel_joint', 'front_left_steering_joint', 'rear_left_steering_joint']
        right_wheel_names: ['front_right_wheel_joint', 'rear_right_wheel_joint', 'front_right_steering_joint', 'rear_right_steering_joint']
        publish_rate: 50.0
        pose_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
        twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
        cmd_vel_timeout: 0.5

        wheels_per_side: 1
        preserve_turning_radius: true 
        base_frame_id: rs_t265_pose_frame

        enable_odom_tf: false

        angular:
            steer:
                front_max_angle: 1.047
                rear_max_angle: 0.0

And that is transmission description:

   <transmission name="${wheel_prefix}_steering_trans" type="SimpleTransmission">
      <type>transmission_interface/SimpleTransmission</type>
      <actuator name="${wheel_prefix}_steering_motor">
        <hardwareInterface>PositionJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
      </actuator>
      <joint name="${wheel_prefix}_steering_joint">
        <hardwareInterface>PositionJointInterface</hardwareInterface>
      </joint>
    </transmission>

    <transmission name="${wheel_prefix}_wheel_trans" type="SimpleTransmission">
      <type>transmission_interface/SimpleTransmission</type>
      <actuator name="${wheel_prefix}_wheel_motor">
        <mechanicalReduction>1</mechanicalReduction>
      </actuator>
      <joint name="${wheel_prefix}_wheel_joint">
        <hardwareInterface>VelocityJointInterface</hardwareInterface>
      </joint>
    </transmission>
  </xacro:macro>

and ros2_control tag in robot description with gazebo plugin

<ros2_control name="GazeboSystem" type="system"> ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by shonigmann
close date 2022-12-12 16:37:42.709220

Comments

would probably merit taking a second look at your launch file and your full URDF to make sure that you aren't accidentally including tags multiple times or starting controllers multiple times. Also, are you giving your model (and by extension the gazebo ros2 control plugin) enough time to load before trying to spawn your controller? The recommended way to launch would be using event handlers to make sure this is the case. Hard to give much more advice without seeing the launch file and the full terminal output.

shonigmann gravatar image shonigmann  ( 2022-12-05 22:29:38 -0600 )edit

Thank you for your help. I've updated the question.

Edvard gravatar image Edvard  ( 2022-12-06 00:59:33 -0600 )edit

Sorry, I noticed now that I'm trying to load my controllers from both of my launch files, suppose that was a reason for JointStateBroadcaster to be loaded twice. So only "Command interface with 'front_left_steering_joint/velocity' does not exist" is remains.

Edvard gravatar image Edvard  ( 2022-12-06 02:18:40 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-12-06 11:46:02 -0600

shonigmann gravatar image

To summarize the cause of the two issues, in case others come across this question in the future:

1) ros2_control/gazebo trying to load a controller multiple times

This shouldn't happen, and in this case was caused by multiple launch files loading the controllers.

2) "Command interface with 'front_left_steering_joint/velocity' does not exist";

Your controller is looking for a velocity control interface for joint front_left_steering_joint, but your <ros2_control> tag in your URDF is telling the controller_manager that your "hardware" only supports position control for this joint. The diff_driver_controller currently only supports velocity commands to the wheels, and accepts position or velocity state interfaces (you can take a look at the source here for reference).

<ros2_control name="GazeboSystem" type="system">
  <hardware>
    <plugin>gazebo_ros2_control/GazeboSystem</plugin> 
  </hardware>
    <joint name="front_left_steering_joint">
      <command_interface name="position"/> <------------------- here
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>
    </joint>

Since this is a gazebo question, you can resolve this by simply changing front_left, front_right, rear_left and rear_right joints to be velocity controlled in the <ros2_control> block of your URDF.

All that said, based on the naming convention you used, it sounds like you want those to be steerable joints. Perhaps you want to consider implementing an Ackermann controller or similar. The ros2_controllers repo has a tricycle_controller which you may find to be a good starting point. Alternately, you could take a crack at porting either the ros1 ackermann_controller or this swerve_steering_controller to ros2.

edit flag offensive delete link more

Comments

Thank you for your help, time and detailed explanation. I'll try to look tricycle_controller and ackermann_controller

Edvard gravatar image Edvard  ( 2022-12-07 01:12:37 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2022-12-05 04:15:03 -0600

Seen: 311 times

Last updated: Dec 06 '22