Collapsing Robot Model in ROS2 Gazebo

asked 2021-05-05 22:17:59 -0500

M-Hijikata gravatar image

updated 2021-07-11 20:00:50 -0500

Hello,

I am trying to use UR5 in ROS2 Gazebo. I referred to https://github.com/ros-industrial/uni... and https://github.com/ros-simulation/gaz.... For ros2_control, I modify the urdf to below.

<?xml version="1.0"?>
<robot xmlns:xacro="https://ros.org/wiki/xacro" name="my_ur5">

  <gazebo>
  <!-- ros_control plugin -->
    <plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
      <robot_sim_type>gazebo_ros2_control/GazeboSystem</robot_sim_type>
      <parameters>$(find my_ur5_description)/cfg/gazebo_controllers.yaml</parameters>
    </plugin>
  </gazebo>
  <!-- ur5 -->
  <xacro:include filename="$(find my_ur5_description)/urdf/ur5.urdf.xacro" />

  <!-- ur5 -->
  <!-- The ur5 xacro must be included with passing parameters -->
  <xacro:ur5_robot prefix="" joint_limited="true"/>
  <!-- end-effector -->
  <!-- Here we include the end-effector by setting the parameters -->
  <!-- TODO: check end-effector link name of robot -->

  <!-- define the ur5's position and orientation in the world coordinate system -->
  <link name="world" />
  <joint name="world_joint" type="fixed">
    <parent link="world" />
    <child link="base_link" /> <!-- TODO: check base_link name of robot -->
    <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
  </joint>

  <ros2_control name="GazeboSystem" type="system">
    <hardware>
      <plugin>gazebo_ros2_control/GazeboSystem</plugin>
    </hardware>
    <joint name="shoulder_pan_joint">
      <command_interface name="position">
        <param name="min">-3.14</param>
        <param name="max">3.14</param>
      </command_interface>
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>
    </joint>
    <joint name="shoulder_lift_joint">
      <command_interface name="position">
        <param name="min">-3.14</param>
        <param name="max">3.14</param>
      </command_interface>
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>
    </joint>
    <joint name="elbow_joint">
      <command_interface name="position">
        <param name="min">-3.14</param>
        <param name="max">3.14</param>
      </command_interface>
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>
    </joint>
    <joint name="wrist_1_joint">
      <command_interface name="position">
        <param name="min">-3.14</param>
        <param name="max">3.14</param>
      </command_interface>
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>
    </joint>
    <joint name="wrist_2_joint">
      <command_interface name="position">
        <param name="min">-3.14</param>
        <param name="max">3.14</param>
      </command_interface>
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>
    </joint>
    <joint name="wrist_3_joint">
      <command_interface name="position">
        <param name="min">-3.14</param>
        <param name="max">3.14</param>
      </command_interface>
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>
    </joint>
  </ros2_control>

</robot>

I can spawn my UR5, but my robot is collapsed gradually. The terminal output is below.

[INFO] [launch]: All log files can be found below /root/.ros/log/2021-07-12-00-46-48-600249-hijikata-Ubuntu-29615
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [gzserver-1]: process started with pid [29617]
[INFO] [gzclient   -2]: process started with pid [29619]
[INFO] [robot_state_publisher-3]: process started with pid [29621]
[INFO] [static_transform_publisher-4]: process started with pid [29624]
[INFO] [spawn_entity.py-5]: process started with ...
(more)
edit retag flag offensive close merge delete

Comments

1

Based on your description, it sounds like the control node is either not running or the process is dying. Can you edit your question to include your launch script any relevant output from the console when you run your launch script?

shonigmann gravatar image shonigmann  ( 2021-05-06 17:29:21 -0500 )edit

so your joint_trajectory_controller is dying - that explains the joints collapsing:

The ominous [gzserver-1] Warning: class_loader.impl: SEVERE WARNING!!! can be fixed by editing your launch file to use JointStateBroadcaster instead of JointStateController (which was deprecated in ROS2).

There's unfortunately not much else in the output, and your URDF seems okay, so I can't help too much more without getting a bit more input from you.

Could you edit your question to include the controller config file and what versions of ros2_control, ros2_controllers, and gazebo_ros2_control (whether building from source or using binaries).

shonigmann gravatar image shonigmann  ( 2021-07-12 14:44:36 -0500 )edit