Ask Your Question
1

URDF link not properly fixed to world

asked 2021-12-17 15:00:51 -0500

laziest_robot gravatar image

updated 2021-12-18 02:44:38 -0500

Hi, I hope someone can help me out with the following problem. I am using a 'dummy' link to fix the first link of my robot to the world frame. I am spawning my robot using the spawn_entity script. This all goes well and the first link is spawned in Gazebo. However, when I unpause the simulation in Gazebo the link falls on the floor (in case of a 0.1 clearance for demonstration purposes).

paused unpaused

What am I doing wrong?

ROS2 Galactic

Ubuntu 20.04.3 LTS, with kernel 5.11.0-41-generic

model file:

<?xml version="1.0"?>
<robot name="cherry_bot">

  <link name="base"/>

  <joint name="fixed" type="fixed">
    <parent link="base"/>
    <child link="link_0"/>
  </joint>

  <link name="link_0">
    <visual>  
      <origin xyz="0 0 0.4" />
      <geometry>
        <cylinder length="0.6" radius="0.2"/>
      </geometry>
    </visual>

    <collision>
      <origin xyz="0 0 0.4" />
      <geometry>
        <cylinder length="0.6" radius="0.2"/>
      </geometry>
    </collision>

    <inertial>
      <origin xyz="0 0 0.4" />
      <mass value="10"/>
      <inertia ixx="0.4" ixy="0.0" ixz="0.0" iyy="0.4" iyz="0.0" izz="0.2"/>
    </inertial>
  </link>
</robot>

Launch file:

import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, ExecuteProcess
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node

def generate_launch_description():

    use_sim_time = LaunchConfiguration('use_sim_time', default='false')
    urdf_file_name = 'model.urdf'
    world_file_name = 'test.world'

    urdf = os.path.join(
        get_package_share_directory('cherry_bot_description'), 'urdf',
        urdf_file_name)

    with open(urdf, 'r') as infp:
        robot_desc = infp.read()

    return LaunchDescription([
        DeclareLaunchArgument(
            'use_sim_time',
            default_value='false',
            description='Use simulation (Gazebo) clock if true'),

        ExecuteProcess(
            cmd=['gazebo', '--verbose', '--pause',
                 '-s', 'libgazebo_ros_factory.so'],
            output='screen'),

        Node(
            package='robot_state_publisher',
            executable='robot_state_publisher',
            name='robot_state_publisher',
            output='screen',
            parameters=[{'use_sim_time': use_sim_time,
                         'robot_description': robot_desc}],
            arguments=[urdf]),

        Node(
            package='gazebo_ros',
            executable='spawn_entity.py',
            name='urdf_spawner',
            output='screen',
            arguments=["-topic", "/robot_description", "-entity", "cherry_bot"]),
    ])

Console output:

~/repos/cherry-bot$ source install/setup.bash && ros2 launch cherry_bot_gazebo cherry_bot.launch.py 
[INFO] [launch]: All log files can be found below /home/per/.ros/log/2021-12-17-21-49-46-173895-Per-Desktop-127262
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [gazebo-1]: process started with pid [127264]
[INFO] [robot_state_publisher-2]: process started with pid [127266]
[INFO] [spawn_entity.py-3]: process started with pid [127268]
[robot_state_publisher-2] [WARN] [1639774186.304280364] [robot_state_publisher]: No robot_description parameter, but command-line argument available.  Assuming argument is name of URDF file.  This backwards compatibility fallback will be removed in the future.
[robot_state_publisher-2] Link link_0 had 0 children
[robot_state_publisher-2] [INFO] [1639774186.306114303] [robot_state_publisher]: got segment base
[robot_state_publisher-2] [INFO] [1639774186.306132973] [robot_state_publisher]: got segment link_0
[spawn_entity.py-3] [INFO] [1639774186.544989349] [urdf_spawner]: Spawn Entity started
[spawn_entity.py-3] [INFO] [1639774186.545212320] [urdf_spawner]: Loading entity published on topic /robot_description
[spawn_entity.py-3] [INFO] [1639774186.546049934] [urdf_spawner]: Waiting for entity xml on /robot_description
[spawn_entity.py-3] [INFO] [1639774186.547436311] [urdf_spawner]: Waiting for service /spawn_entity, timeout = 5
[spawn_entity.py-3] [INFO] [1639774186.547646483] [urdf_spawner]: Waiting for service /spawn_entity
[gazebo-1] Gazebo multi-robot simulator, version 11.9.1
[gazebo-1] Copyright (C) 2012 Open ...
(more)
edit retag flag offensive close merge delete

Comments

1

Hi @laziest_robot, I added points to your Karma, please upload the pictures vs. using links.

osilva gravatar image osilva  ( 2021-12-17 15:09:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-12-18 02:50:47 -0500

laziest_robot gravatar image

It turns out that the dummy link should be named 'world' explicitly. The following code works:

<link name="world"/>

  <joint name="fixed" type="fixed">
    <parent link="world"/>
    <child link="link_0"/>
  </joint>
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-12-17 15:00:51 -0500

Seen: 147 times

Last updated: Dec 18 '21