0
$\begingroup$

I'm trying to simulate a TM5-900 robot arm in Gazebo using ROS2 Humble. While the robot model loads in Gazebo, I'm encountering issues with the gazebo_ros2_control plugin initialization. Here are the specific details:

First error

[ERROR] [gazebo_ros2_control]: Error initializing URDF to resource manager! 

Second error:

terminate called after throwing an instance of 'pluginlib::LibraryLoadException' what(): According to the loaded plugin descriptions the class gazebo_ros2_control/GazeboSystem with base class type hardware_interface::SystemInterface does not exist 

Setup:

  • ROS2 Distribution: Humble
  • Gazebo Version: 11.10.2
  • Operating System: Ubuntu 22.04

In macro.tm5-900-nominal.urdf.xacro, I have the ros2_control configuration:

<ros2_control name="GazeboSystem" type="system"> <hardware> <plugin>gazebo_ros2_control/GazeboSystem</plugin> </hardware> <joint name="${prefix}joint_1"> <command_interface name="position"> <param name="min">${joint_1_lower_limit}</param> <param name="max">${joint_1_upper_limit}</param> </command_interface> <state_interface name="position"/> <state_interface name="velocity"/> </joint> <!-- Similar configuration for joints 2-6 --> </ros2_control> 

In macro.gazebo.xacro, the Gazebo plugin configuration:

<gazebo> <plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so"> <parameters>$(find tm900_description)/config/tm900_controllers.yaml</parameters> </plugin> </gazebo> 

The controller configuration in tm900_controllers.yaml:

controller_manager: ros__parameters: update_rate: 100 joint_state_broadcaster: type: joint_state_broadcaster/JointStateBroadcaster joint_trajectory_controller: type: joint_trajectory_controller/JointTrajectoryController joint_trajectory_controller: ros__parameters: joints: - joint_1 - joint_2 # ... (joints 3-6) command_interfaces: - position state_interfaces: - position - velocity 
$\endgroup$
2
  • $\begingroup$ can you run any demo of gazebo_ros2_control? $\endgroup$ Commented Jan 28 at 22:26
  • $\begingroup$ I have already sudo apt installed ros-humble-gazebo-ros2-control-demos and tried running ros2 launch gazebo_ros2_control_demos cart_example_position.launch.py. What could be the reason for the difference in robot pose between Gazebo and RViz2? Is it due to a lack of synchronization in the URDF configuration between the two? $\endgroup$ Commented Jan 30 at 8:04

1 Answer 1

0
$\begingroup$

I have already sudo apt installed ros-humble-gazebo-ros2-control-demos and tried running ros2 launch gazebo_ros2_control_demos cart_example_position.launch.py. When I did this, I did not encounter the error "class gazebo_ros2_control/GazeboSystem with base class type hardware_interface::SystemInterface does not exist", but the error "[ERROR] [gazebo_ros2_control]: Error initializing URDF to resource manager!" still remained. However, when I run my own file ros2 launch tm900_description display_both.launch.py, I encounter the issue with the class "gazebo_ros2_control/GazeboSystem with base class type hardware_interface::SystemInterface does not exist" as well as the "[ERROR] [gazebo_ros2_control]: Error initializing URDF to resource manager!" error. After that, I modified the launch file by:

  • Removing the ros2_control_node
  • Adding use_sim_time: True for important nodes
  • Simplifying the startup sequence
  • Removing complex event handlers
  • Ensuring controllers are spawned after the robot is spawned

import os

From the above, I have a few questions:

  1. Why do I still encounter the "[ERROR] [gazebo_ros2_control]: Error initializing URDF to resource manager!" error even after making the changes in the launch file?

  2. What could be the reason for the difference in robot pose between Gazebo and RViz2? Is it due to a lack of synchronization in the URDF configuration between the two? My "launch file" is below: import os from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch.actions import ExecuteProcess, DeclareLaunchArgument, RegisterEventHandler from launch.event_handlers import OnProcessStart, OnProcessExit from launch.substitutions import Command, LaunchConfiguration, PathJoinSubstitution from launch_ros.actions import Node from launch_ros.parameter_descriptions import ParameterValue

def generate_launch_description(): # Get package directory pkg_share = get_package_share_directory('tm900_description')

# URDF file xacro_file = os.path.join(pkg_share, 'xacro', 'tm5-900.urdf.xacro') robot_description = ParameterValue( Command(['xacro ', xacro_file, ' ns:=', '', ' prefix:=', '', ' color:=none']), value_type=str ) # Controllers file controllers_file = os.path.join(pkg_share, 'config', 'tm900_controllers.yaml') # Robot State Publisher (add use_sim_time) robot_state_publisher = Node( package='robot_state_publisher', executable='robot_state_publisher', name='robot_state_publisher', output='screen', parameters=[ {'robot_description': robot_description}, {'use_sim_time': True} # Thêm dòng này ] ) # Remove controller_manager node - let Gazebo handle it # Xóa node controller_manager # Joint State Broadcaster Spawner joint_state_broadcaster_spawner = Node( package='controller_manager', executable='spawner', arguments=['joint_state_broadcaster'], output='screen' ) # Joint Trajectory Controller Spawner joint_trajectory_controller_spawner = Node( package='controller_manager', executable='spawner', arguments=['joint_trajectory_controller'], output='screen' ) # Joint State Publisher GUI (optional for testing) joint_state_publisher_gui = Node( package='joint_state_publisher_gui', executable='joint_state_publisher_gui', name='joint_state_publisher_gui', output='screen', parameters=[{'use_sim_time': True}] # Thêm dòng này nếu cần ) # RViz2 rviz_node = Node( package='rviz2', executable='rviz2', name='rviz2', output='screen', parameters=[{'use_sim_time': True}] # Thêm dòng này ) # Gazebo gazebo_server = ExecuteProcess( cmd=['gzserver', '--verbose', '-s', 'libgazebo_ros_init.so', '-s', 'libgazebo_ros_factory.so'], output='screen' ) gazebo_client = ExecuteProcess( cmd=['gzclient'], output='screen' ) # Spawn robot spawn_robot = Node( package='gazebo_ros', executable='spawn_entity.py', arguments=[ '-entity', 'tm5-900', '-topic', 'robot_description', '-x', '0', '-y', '0', '-z', '0', '-R', '0', '-P', '0', '-Y', '0' ], output='screen' ) # Launch sequence return LaunchDescription([ # 1. Start Gazebo first gazebo_server, gazebo_client, # 2. Publish robot description robot_state_publisher, # 3. Spawn robot and wait for it to be ready spawn_robot, # 4. Spawn controllers joint_state_broadcaster_spawner, joint_trajectory_controller_spawner, # 5. Start visualization tools last joint_state_publisher_gui, rviz_node ]) 

My "macro.tm5-900-nominal.urdf.xacro" :

<xacro:include filename="$(find tm900_description)/xacro/macro.inertial.xacro" />

<xacro:macro name="tm5-900" params="ns prefix color:=none format:=obj joint_1_lower_limit:=${radians(-270)} joint_1_upper_limit:=${radians(270)} joint_2_lower_limit:=${radians(-180)} joint_2_upper_limit:=${radians(180)} joint_3_lower_limit:=${radians(-155)} joint_3_upper_limit:=${radians(155)} joint_4_lower_limit:=${radians(-180)} joint_4_upper_limit:=${radians(180)} joint_5_lower_limit:=${radians(-180)} joint_5_upper_limit:=${radians(180)} joint_6_lower_limit:=${radians(-270)} joint_6_upper_limit:=${radians(270)} joint_1_velocity_limit:=${radians(180)} joint_2_velocity_limit:=${radians(180)} joint_3_velocity_limit:=${radians(180)} joint_4_velocity_limit:=${radians(225)} joint_5_velocity_limit:=${radians(225)} joint_6_velocity_limit:=${radians(225)} joint_1_effort_limit:=${157} joint_2_effort_limit:=${157} joint_3_effort_limit:=${157} joint_4_effort_limit:=${43} joint_5_effort_limit:=${43} joint_6_effort_limit:=${43}
safety_limits:=false safety_pos_margin:=0.15 safety_k_position:=20"> <xacro:property name="damping_factor" value="0.000"/> <xacro:property name="d1" value="${damping_factor*0.1}"/> <xacro:property name="d2" value="${damping_factor0.1}"/> <xacro:property name="d3" value="${damping_factor*0.1}"/> <xacro:property name="d4" value="${damping_factor0.1}"/> <xacro:property name="d5" value="${damping_factor*0.1}"/> <xacro:property name="d6" value="${damping_factor*0.1}"/>

<xacro:property name="friction_factor" value="0.000"/> <xacro:property name="f1" value="${friction_factor*0.1}"/> <xacro:property name="f2" value="${friction_factor*0.1}"/> <xacro:property name="f3" value="${friction_factor*0.1}"/> <xacro:property name="f4" value="${friction_factor*0.1}"/> <xacro:property name="f5" value="${friction_factor*0.1}"/> <xacro:property name="f6" value="${friction_factor*0.1}"/> <!-- Inertia parameters --> <xacro:property name="mass_0" value="1.000" /> <xacro:property name="mass_1" value="4.032" /> <xacro:property name="mass_2" value="8.897" /> <xacro:property name="mass_3" value="2.443" /> <xacro:property name="mass_4" value="1.576" /> <xacro:property name="mass_5" value="1.576" /> <xacro:property name="mass_6" value="0.65" /> <xacro:property name="unit_factor" value="0.000001"/> <xacro:property name="ixx_1" value="${8800.119*unit_factor}" /> <xacro:property name="ixx_2" value="${24459.295*unit_factor}" /> <xacro:property name="ixx_3" value="${3632.988*unit_factor}" /> <xacro:property name="ixx_4" value="${2058.405*unit_factor}" /> <xacro:property name="ixx_5" value="${2058.405*unit_factor}" /> <xacro:property name="ixx_6" value="${774.544*unit_factor}" /> <xacro:property name="iyy_1" value="${11548.982*unit_factor}" /> <xacro:property name="iyy_2" value="${205888.616*unit_factor}" /> <xacro:property name="iyy_3" value="${36359.26*unit_factor}" /> <xacro:property name="iyy_4" value="${2563.079*unit_factor}" /> <xacro:property name="iyy_5" value="${2563.079*unit_factor}" /> <xacro:property name="iyy_6" value="${1383.811*unit_factor}" /> <xacro:property name="izz_1" value="${11970.081*unit_factor}" /> <xacro:property name="izz_2" value="${212473.4246*unit_factor}" /> <xacro:property name="izz_3" value="${36895.644*unit_factor}" /> <xacro:property name="izz_4" value="${2643.21*unit_factor}" /> <xacro:property name="izz_5" value="${2643.21*unit_factor}" /> <xacro:property name="izz_6" value="${1559.496*unit_factor}" /> 
<parent link="${prefix}link_0" /> <child link="${prefix}link_1" /> <origin rpy="0.000000 -0.000000 0.000000" xyz="0.000000 0.000000 0.145200" /> <axis xyz="0 0 1" /> 
<limit lower="${joint_1_lower_limit}" upper="${joint_1_upper_limit}" velocity="${joint_1_velocity_limit}" effort="${joint_1_effort_limit}" /> <xacro:if value="${safety_limits}"> <safety_controller soft_lower_limit="${joint_1_lower_limit + safety_pos_margin}" soft_upper_limit="${joint_1_upper_limit - safety_pos_margin}" k_position="${safety_k_position}" k_velocity="0.0" /> </xacro:if> <dynamics damping="${d1}" friction="${f1}" /> 
gazebo_ros2_control/GazeboSystem 0.0 0.0 0.0 $(find tm900_description)/config/tm900_controllers.yaml

strong text

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.