Robot model not shown properly in Gazebo

asked 2023-06-21 15:02:21 -0500

mike gravatar image

updated 2023-06-21 15:05:17 -0500

Hi Developers, I am struggling for days to spawn a Baxter robot, which URDF file I got from here in Gazebo. Using RViz the robot gets properly spawned. To spawn the robot I am using a launch file in ROS2 Foxy. The relevant part is this one:

   ...
   # Subscribes to the joint states of the robot, and publishes the 3D pose of each link.
    robot_state_publisher_node = Node(
        condition=UnlessCondition(use_rviz),
        package='robot_state_publisher',
        executable='robot_state_publisher',
        output='screen',
        parameters=[{'use_sim_time': use_sim_time}],
        arguments=[robot_description_file]
    )

    # Publishes the joint state values for the non-fixed joints in the URDF file.
    joint_state_publisher_node = Node(
        condition=UnlessCondition(use_rviz),
        package='joint_state_publisher',
        executable='joint_state_publisher',
        name='joint_state_publisher')

    # Spawnes the robot at a given position and with a specific pose
    spawn_entity = Node(
        package='gazebo_ros',
        executable='spawn_entity.py',
        arguments=['-entity', robot_model_name,
                    '-topic', '/robot_description',
                    '-x', position_x, '-y', position_y, '-z', position_z,
                    '-R', orientation_R, '-P', orientation_P, '-Y', orientation_Y, 'file', robot_description_file],
        output='screen')
     ...

I have attached a screenshot to show that in Gazebo only some parts get displayed. I have tried to set the GAZEBO_RESOURCE_PATH, but every time I start the launch file, I get this error message:

[ERROR] [spawn_entity.py-5]: process has died [pid 42722, exit code 2, cmd '/opt/ros/foxy/lib/gazebo_ros/spawn_entity.py -entity baxter -topic /robot_description -x 0.0 -y 0.0 -z 0.0 -R 0.0 -P 0.0 -Y -1.57 file ...baxter.urdf --ros-args'

image description

After searching the internet I found that Gazebo has to know about the .dae mesh file to display them. I have also tested this solution, but nothing changed.

I hope someone can provide help, because I am struggling for days as mentioned before.

edit retag flag offensive close merge delete