0
$\begingroup$

I'm currently working on a project where I am trying to use ROS 2 Humble Control in conjunction with Gazebo Garden. However, I am encountering an issue where the plugins are not loading as expected.

I have followed the documentation and setup instructions, but it seems like there might be a compatibility issue or a configuration step I might have missed. Has anyone else faced a similar problem or successfully integrated ROS2 Control [Humble] with Gazebo Garden? If so, could you please share any insights or tips on resolving this issue?

Gazebo garden installation

sudo apt-get install ros-humble-ros-gzgarden

param.yaml

controller_manager:     # node name
  ros__parameters:
    update_rate: 100
    use_sim_time: true

    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster

    effort_controller:
      type: effort_controllers/JointGroupEffortController
      
  
effort_controller:
  ros__parameters:
    update_rate: 100
    use_sim_time: true
    joints:
      - JOINT1

ros2 control plugin:

<ros2_control name="GazeboSystem" type="system">
        <hardware>
          <plugin>gz_ros2_control/GazeboSimSystem</plugin>
          <!-- <plugin>ign_ros2_control/IgnitionSystem</plugin> -->
        </hardware>

        <joint name="JOINT1">
          <command_interface name="effort">
            <param name="min">-15</param>
            <param name="max">15</param>
          </command_interface>
          <state_interface name="velocity"/>
          <state_interface name="effort"/>
        </joint>
    </ros2_control>

    <gazebo>
        <!-- Joint state publisher -->
        <plugin filename="gz_ros2_control-system" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
        <!-- <plugin filename="ign_ros2_control-system" name="ign_ros2_control::IgnitionROS2ControlPlugin">   -->
          <parameters>$(find m4e_mani_control)/config/param.yaml.yaml</parameters>
        </plugin>
      </gazebo>

launch_file:

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, ExecuteProcess
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from launch.actions import RegisterEventHandler
from launch.event_handlers import OnProcessExit
from ament_index_python.packages import get_package_share_directory

import os
import xacro

def generate_launch_description():
    use_sim_time = LaunchConfiguration('use_sim_time', default=True)

    # package information
    package_description = 'description'
    urdf_file = 'ros2_control_gazebo.xacro'
    robot_description_path = os.path.join(get_package_share_directory(package_description),'urdf', urdf_file)    

    doc = xacro.parse(open(robot_description_path))
    xacro.process_doc(doc)
    params = {'robot_description': doc.toxml()}

    # Robot state publisher
    robot_state_publisher = Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        parameters=[params],
        emulate_tty=True,
        output = 'screen',
    )

    # Spawn Gazebo model
    spawn_sim_robot = Node(
        package='ros_gz_sim',
        executable='create',
        arguments=['-string', doc.toxml(),
                   '-name', 'manipulator',
                   '-allow_renaming', 'true'],
        output='screen',
        emulate_tty=True,
    )

    # Spawn Joint state broadcaster controller
    joint_state_broadcaster_spawner = Node(
        package="controller_manager",
        executable="spawner",
        arguments=["joint_state_broadcaster",
                   "--controller-manager", "/controller_manager"],
    )

    effort_controller_spawner = Node(
        package="controller_manager",
        executable="spawner",
        arguments=["effort_controller", "-c", "/controller_manager"],
    )

    # Start Gazebo 
    try: 
        gazebo_launch_file = os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')
    except:
        gazebo_launch_file = ""

    gazebo = IncludeLaunchDescription(
        PythonLaunchDescriptionSource([gazebo_launch_file]),
        launch_arguments=[('gz_args', ['-r -v 1 empty.sdf'])],
    )
    
    ## Launch description
    return LaunchDescription([

        # Launch
        gazebo,

        RegisterEventHandler(
        event_handler=OnProcessExit(
            target_action= spawn_sim_robot,
            on_exit=[joint_state_broadcaster_spawner]
            )
        ),
        RegisterEventHandler(
            event_handler=OnProcessExit(
                target_action= joint_state_broadcaster_spawner,
                on_exit=[effort_controller_spawner]
            )
        ),

        # Nodes
        spawn_sim_robot,
        robot_state_publisher,

        # Launch Arguments
        DeclareLaunchArgument(
            'use_sim_time',
            default_value=use_sim_time,
            description='If true, use simulated clock'),

    ])

error: enter image description here

Additionally, I would appreciate any guidance on debugging and troubleshooting this specific plugin loading problem in the context of ROS 2 Humble Control and Gazebo Garden.

Thank you in advance for your help!

$\endgroup$
2
  • $\begingroup$ The error is rather difficult to read - it is quite small and the red colour doesn't help. Please paste any code or console output as code formatted text and not as a screenshot. Screenshots are not text searchable, amongst other things... Thanks. $\endgroup$ Commented Mar 18 at 20:30
  • $\begingroup$ I'll make the necessary updates once I resume work on this task. $\endgroup$
    – Dragon
    Commented Mar 19 at 7:47

1 Answer 1

0
$\begingroup$

I'm not sure if garden is compatible with humble. Acc. to gz_ros2_control repo, it is not. If so, the plugin might be named ign_ros2_control.

Have you installed ign_ros2_control? Try the demos from the humble branch.

$\endgroup$
3
  • $\begingroup$ When I install ign_ros2_control using the command sudo apt install ros-humble-ign-ros2-control, it automatically installs Gazebo Fortress as well. My packages function smoothly with Gazebo Fortress, and I aim to replicate the same functionality in Gazebo Garden. $\endgroup$
    – Dragon
    Commented Dec 14, 2023 at 12:41
  • $\begingroup$ as I said, I'm not sure if it is compatible. $\endgroup$ Commented Dec 15, 2023 at 9:36
  • $\begingroup$ Is it feasible to employ the Gazebo Bridge to transmit commands, allowing the model to respond within the simulation environment? $\endgroup$
    – Dragon
    Commented Dec 15, 2023 at 14:53

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.