0
$\begingroup$

I am trying to load my robot model into gazebo with controllers. However, this specific plugin cannot be found. Gazebo Fortress starts up fine and my robot model spawns too. Does anyone know the solution to this? I am working in a ros2 environment on Ubuntu 22.04 (ROS2 Humble).

The output after launching:

[INFO] [launch]: All log files can be found below /home/rae/.ros/log/2024-06-29-21-52-18-375317-rae-Asus-TUF-Dash-F15-35700
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [35701]
[INFO] [ign-2]: process started with pid [35703]
[INFO] [spawner-3]: process started with pid [35705]
[INFO] [spawner-4]: process started with pid [35707]
[INFO] [create-5]: process started with pid [35709]
[create-5] [INFO] [1719669138.513891987] [ros_gz_sim]: Requesting list of world names.
[robot_state_publisher-1] [INFO] [1719669138.544728404] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-1] [INFO] [1719669138.544845792] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1719669138.544858222] [robot_state_publisher]: got segment caster_wheel
[robot_state_publisher-1] [INFO] [1719669138.544866406] [robot_state_publisher]: got segment left_wheel
[robot_state_publisher-1] [INFO] [1719669138.544873078] [robot_state_publisher]: got segment lidar
[robot_state_publisher-1] [INFO] [1719669138.544879517] [robot_state_publisher]: got segment right_wheel
[create-5] [INFO] [1719669139.105708596] [ros_gz_sim]: Waiting messages on topic [robot_description].
[create-5] [INFO] [1719669139.205371623] [ros_gz_sim]: Requested creation of entity.
[create-5] [INFO] [1719669139.205424179] [ros_gz_sim]: OK creation of entity.
[INFO] [create-5]: process has finished cleanly [pid 35709]
[ign-2] libEGL warning: egl: failed to create dri2 screen
[ign-2] libEGL warning: egl: failed to create dri2 screen
[ign-2] libEGL warning: egl: failed to create dri2 screen
[ign-2] [Err] [SystemLoader.cc:94] Failed to load system plugin [ign_ros2_control-system] : couldn't find shared library.
[spawner-4] [INFO] [1719669140.727449151] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[spawner-3] [INFO] [1719669140.738908778] [spawner_diff_cont]: Waiting for '/controller_manager' node to exist
[spawner-4] [INFO] [1719669142.734884290] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[spawner-3] [INFO] [1719669142.745660026] [spawner_diff_cont]: Waiting for '/controller_manager' node to exist
[spawner-4] [INFO] [1719669144.741472896] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[spawner-3] [INFO] [1719669144.752505542] [spawner_diff_cont]: Waiting for '/controller_manager' node to exist
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[robot_state_publisher-1] [INFO] [1719669146.733495253] [rclcpp]: signal_handler(signum=2)
[spawner-3] Traceback (most recent call last):
[spawner-3]   File "/opt/ros/humble/lib/controller_manager/spawner", line 33, in <module>
[spawner-3]     sys.exit(load_entry_point('controller-manager==2.41.0', 'console_scripts', 'spawner')())
[spawner-3]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/controller_manager/spawner.py", line 222, in main
[spawner-3]     if not wait_for_controller_manager(
[spawner-3]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/controller_manager/spawner.py", line 106, in wait_for_controller_manager
[spawner-3]     node_and_namespace = wait_for_value_or(
[spawner-3]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/controller_manager/spawner.py", line 66, in wait_for_value_or
[spawner-3]     time.sleep(0.2)
[spawner-3] KeyboardInterrupt
[spawner-4] Traceback (most recent call last):
[spawner-4]   File "/opt/ros/humble/lib/controller_manager/spawner", line 33, in <module>
[spawner-4]     sys.exit(load_entry_point('controller-manager==2.41.0', 'console_scripts', 'spawner')())
[spawner-4]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/controller_manager/spawner.py", line 222, in main
[spawner-4]     if not wait_for_controller_manager(
[spawner-4]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/controller_manager/spawner.py", line 106, in wait_for_controller_manager
[spawner-4]     node_and_namespace = wait_for_value_or(
[spawner-4]   File "/opt/ros/humble/local/lib/python3.10/dist-packages/controller_manager/spawner.py", line 66, in wait_for_value_or
[spawner-4]     time.sleep(0.2)
[spawner-4] KeyboardInterrupt
[INFO] [ign-2]: process has finished cleanly [pid 35703]
[INFO] [robot_state_publisher-1]: process has finished cleanly [pid 35701]
[ERROR] [spawner-3]: process has died [pid 35705, exit code -2, cmd '/opt/ros/humble/lib/controller_manager/spawner diff_cont --ros-args'].
[ERROR] [spawner-4]: process has died [pid 35707, exit code -2, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_broad --ros-args'].

Here is my launch file:

import os

from ament_index_python.packages import get_package_share_directory


from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import PathJoinSubstitution
from launch_ros.actions import Node

from launch.actions import ExecuteProcess

def generate_launch_description():


    # Include the robot_state_publisher launch file, provided by our own package. Force sim time to be enabled
    # !!! MAKE SURE YOU SET THE PACKAGE NAME CORRECTLY !!!

    package_name='testbot' #<--- CHANGE ME

    diff_drive_spawner = Node(
        package="controller_manager",
        executable="spawner",
        arguments=["diff_cont"],
    )

    joint_broad_spawner = Node(
        package="controller_manager",
        executable="spawner",
        arguments=["joint_broad"],
    )
    
    rsp = IncludeLaunchDescription(
                PythonLaunchDescriptionSource([os.path.join(
                    get_package_share_directory(package_name),'launch','rsp.launch.py'
                )]), launch_arguments={'use_sim_time': 'true'}.items()
    )

    # Include the Gazebo launch file, provided by the gazebo_ros package
    # gazebo = IncludeLaunchDescription(
    #             PythonLaunchDescriptionSource([os.path.join(
    #                 get_package_share_directory('ign_gazebo'), 'launch', 'gazebo.launch.py')]),
    #          )

    gazebo=ExecuteProcess(
            cmd=['ign', 'gazebo'],
            output='screen'
        )
    
    # Run the spawner node from the gazebo_ros package. The entity name doesn't really matter if you only have a single robot.
    spawn_entity = Node(package='ros_gz_sim', executable='create',
                        arguments=['-topic', 'robot_description'],
                        output='screen')


    


    # Launch them all!
    return LaunchDescription([
        rsp,
        gazebo,
        diff_drive_spawner,
        joint_broad_spawner,
        spawn_entity,

    ])

The ros2 control xacro file which is included by the main robot urdf.xacro file:

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">

    <ros2_control name="GazeboSimControl" type="system">
        <hardware>
            <plugin>ign_ros2_control/GazeboSimControl</plugin>
        </hardware>
        
        <joint name="base_left_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10 </param>
                <param name="max">10 </param>
            </command_interface>
            <state_interface name ="velocity"/>
            <state_interface name ="position"/>
        </joint>

        <joint name="base_right_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10 </param>
                <param name="max">10 </param>
            </command_interface>
            <state_interface name ="velocity"/>
            <state_interface name ="position"/>
        </joint>
    </ros2_control>

    <gazebo>
        <plugin filename="ign_ros2_control-system" name="ign_ros2_control::IgnitionROS2ControlPlugin">
            <!-- <robot_param>robot_description</robot_param>
            <robot_param_node>robot_state_publisher</robot_param_node> -->
            <parameters>$(find testbot)/config/controllers.yaml</parameters>
        </plugin>
    </gazebo>

</robot>

And the controllers.yaml

controller_manager:
  ros_parameters:
    # applied to the whole controller
    update_rate: 30
    use_sim_time: true

    diff_cont:
      type: diff_drive_controller/DiffDriveController


    joint_broad:
      type: joint_state_broadcaster/JointStateBroadcaster


diff_cont:
  ros__parameters:

    publish_rate: 50.0

    base_frame_id: base_footprint

    left_wheel_names: ['base_left_wheel_joint']
    right_wheel_names: ['base_right_wheel_joint']
    wheel_separation: 0.45
    wheel_radius: 0.1

    use_stamped_vel: false

    # open_loop: false    

    # wheels_per_side: x
    # wheel_separation_multiplier: x
    # left_wheel_radius_multiplier: x
    # right_wheel_radius_multiplier: x

    # odom_frame_id: x
    # pose_covariance_diagonal: x
    # twist_covariance_diagonal: x
    # open_loop: x
    # enable_odom_tf: x

    # cmd_vel_timeout: x
    # publish_limited_velocity: x
    # velocity_rolling_window_size: x
    

    # linear.x.has_velocity_limits: false
    # linear.x.has_acceleration_limits: false
    # linear.x.has_jerk_limits: false
    # linear.x.max_velocity: NAN
    # linear.x.min_velocity: NAN
    # linear.x.max_acceleration: NAN
    # linear.x.min_acceleration: NAN
    # linear.x.max_jerk: NAN
    # linear.x.min_jerk: NAN

    # angular.z.has_velocity_limits: false
    # angular.z.has_acceleration_limits: false
    # angular.z.has_jerk_limits: false
    # angular.z.max_velocity: NAN
    # angular.z.min_velocity: NAN
    # angular.z.max_acceleration: NAN
    # angular.z.min_acceleration: NAN
    # angular.z.max_jerk: NAN
    # angular.z.min_jerk: NAN




# joint_broad:
#   ros__parameters:

Here is what i got when checking the presence of the specific plugin using locate ign_ros2_control

/opt/ros/humble/include/ign_ros2_control
/opt/ros/humble/include/ign_ros2_control/ign_ros2_control_plugin.hpp
/opt/ros/humble/include/ign_ros2_control/ign_system.hpp
/opt/ros/humble/include/ign_ros2_control/ign_system_interface.hpp
/opt/ros/humble/lib/libign_ros2_control-system.so
/opt/ros/humble/share/ign_ros2_control
/opt/ros/humble/share/ament_index/resource_index/ign_ros2_control__pluginlib__plugin
/opt/ros/humble/share/ament_index/resource_index/ign_ros2_control__pluginlib__plugin/ign_ros2_control
/opt/ros/humble/share/ament_index/resource_index/package_run_dependencies/ign_ros2_control
/opt/ros/humble/share/ament_index/resource_index/packages/ign_ros2_control
/opt/ros/humble/share/ament_index/resource_index/parent_prefix_path/ign_ros2_control
/opt/ros/humble/share/ign_ros2_control/cmake
/opt/ros/humble/share/ign_ros2_control/environment
/opt/ros/humble/share/ign_ros2_control/ign_hardware_plugins.xml
/opt/ros/humble/share/ign_ros2_control/local_setup.bash
/opt/ros/humble/share/ign_ros2_control/local_setup.dsv
/opt/ros/humble/share/ign_ros2_control/local_setup.sh
/opt/ros/humble/share/ign_ros2_control/local_setup.zsh
/opt/ros/humble/share/ign_ros2_control/package.dsv
/opt/ros/humble/share/ign_ros2_control/package.xml
/opt/ros/humble/share/ign_ros2_control/cmake/ament_cmake_export_include_directories-extras.cmake
/opt/ros/humble/share/ign_ros2_control/cmake/ament_cmake_export_libraries-extras.cmake
/opt/ros/humble/share/ign_ros2_control/cmake/ign_ros2_controlConfig-version.cmake
/opt/ros/humble/share/ign_ros2_control/cmake/ign_ros2_controlConfig.cmake
/opt/ros/humble/share/ign_ros2_control/environment/ament_prefix_path.dsv
/opt/ros/humble/share/ign_ros2_control/environment/ament_prefix_path.sh
/opt/ros/humble/share/ign_ros2_control/environment/library_path.dsv
/opt/ros/humble/share/ign_ros2_control/environment/library_path.sh
/opt/ros/humble/share/ign_ros2_control/environment/path.dsv
/opt/ros/humble/share/ign_ros2_control/environment/path.sh

Any help or advice will be greatly appreciated. :D

$\endgroup$

1 Answer 1

0
$\begingroup$

Can you launch the ign_ros2_control_demos? (there were issues in the released docs, I linked to my PR fixing it).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.