Robotics StackExchange | Archived questions

Missing world fixed frame

I'm using ROS Noetic and I have built a custom world with AR Tags and a robot. When I try to obtain the robot yaw in order to calculate the position in global coordinates, the tf package just answer world is not a frame. I've tried to implement a joint between base_link and world but an error is presented showing "world" is not defined. I have read that world is a preset of gazebo but it seems to not be defined. Thank you.

 <?xml version="1.0" ?> <robot
 name="ERC22_URDF"
 xmlns:xacro="http://www.ros.org/wiki/xacro">

 <xacro:include filename="$(find
 ERC22_URDF_description)/urdf/materials.xacro"
 /> <xacro:include filename="$(find
 ERC22_URDF_description)/urdf/ERC22_URDF.trans"
 /> <xacro:include filename="$(find
 ERC22_URDF_description)/urdf/ERC22_URDF.gazebo"
 />

 <link name="base_link">   <inertial>
     <origin xyz="0.009312479330910419 0.0008928693179026247 0.4508429285266153" rpy="0 0 0"/>
     <mass value="1.729680238629788"/>
     <inertia ixx="0.122469" iyy="0.093078" izz="0.197526"
 ixy="-5.1e-05" iyz="1.2e-05"
 ixz="0.006038"/>   </inertial>  
 <visual>
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/base_link.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/base_link.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="WLF_supp_1">   <inertial>
     <origin xyz="-0.0005722202916380592
 0.04456811672884131 -0.06998013314667545" rpy="0 0 0"/>
     <mass value="0.040963207008450755"/>
     <inertia ixx="0.000114" iyy="9.6e-05" izz="3e-05" ixy="-0.0"
 iyz="1.6e-05" ixz="-1e-06"/>  
 </inertial>   <visual>
     <origin xyz="-0.391355 0.383158 -0.356565" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WLF_supp_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="-0.391355 0.383158 -0.356565" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WLF_supp_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="Left_leg_double_1">  
 <inertial>
     <origin xyz="-0.017610729784847123 -0.06278452284012215 -0.07487224121996011" rpy="0 0 0"/>
     <mass value="0.1583068780205665"/>
     <inertia ixx="0.00075" iyy="0.003257" izz="0.002638"
 ixy="-0.000164" iyz="-3.5e-05"
 ixz="0.000733"/>   </inertial>  
<visual>
     <origin xyz="0.252653 0.310658 -0.453036" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/Left_leg_double_1.stl"
 scale="0.001 0.001 0.001"/>
    </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="0.252653 0.310658 -0.453036" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/Left_leg_double_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="WLB_supp_1">   <inertial>
     <origin xyz="0.0011204573839502796 0.031881968364872504 -0.06607317272822505" rpy="0 0 0"/>
     <mass value="0.05726725763420208"/>
     <inertia ixx="0.000209" iyy="0.000168" izz="5.9e-05"
 ixy="-1e-06" iyz="5.6e-05"
 ixz="2e-06"/>   </inertial>   <visual>
     <origin xyz="0.427929 0.392158 -0.371607" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WLB_supp_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="0.427929 0.392158 -0.371607" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WLB_supp_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

<link name="WLB_1">   <inertial>
     <origin xyz="-0.000157582105088927 -0.04853467078008089 -2.617517294800642e-06" rpy="0 0 0"/>
     <mass value="0.821177966951147"/>
     <inertia ixx="0.002537" iyy="0.004162" izz="0.002536"
 ixy="6e-06" iyz="0.0" ixz="0.0"/>  
 </inertial>   <visual>
    <origin xyz="0.425007 0.373675 -0.213634" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WLB_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
    <origin xyz="0.425007 0.373675 -0.213634" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WLB_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="WLM_1">   <inertial>
     <origin xyz="-7.105685515228222e-07
 -0.05483339443238944 1.1425396012620936e-07" rpy="0 0 0"/>
     <mass value="0.8017382692848779"/>
     <inertia ixx="0.002476" iyy="0.004159" izz="0.002476"
 ixy="0.0" iyz="0.0" ixz="0.0"/>  
 </inertial>   <visual>
     <origin xyz="0.02448 0.380158 -0.210124" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WLM_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="0.02448 0.380158 -0.210124" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WLM_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="WLF_1">   <inertial>
     <origin xyz="0.00034755415545323354
 -0.04824687617687501 -1.7828776904815768e-07" rpy="0 0 0"/>
     <mass value="0.8211285553800025"/>
     <inertia ixx="0.002536" iyy="0.004162" izz="0.002535"
 ixy="-1.2e-05" iyz="0.0" ixz="-0.0"/> 
 </inertial>   <visual>
     <origin xyz="-0.391222 0.364675 -0.216565" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WLF_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="-0.391222 0.364675 -0.216565" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WLF_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="WRF_supp_1">   <inertial>
     <origin xyz="-0.0004356849889970982
 -0.037844265968987545 -0.09650313579211883" rpy="0 0 0"/>
     <mass value="0.06594197827899752"/>
     <inertia ixx="0.000199" iyy="0.000176" izz="3.9e-05" ixy="0.0"
 iyz="3e-06" ixz="-0.0"/>   </inertial>
 <visual>
     <origin xyz="-0.391354 -0.386841 -0.356561" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WRF_supp_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="-0.391354 -0.386841 -0.356561" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WRF_supp_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="WRB_supp_1">   <inertial>
     <origin xyz="0.0010379712309944722 -0.03184148815717791 -0.06649153329813762" rpy="0 0 0"/>
     <mass value="0.05751878988929576"/>
     <inertia ixx="0.000212" iyy="0.000171" izz="5.9e-05"
 ixy="1e-06" iyz="-5.6e-05"
 ixz="2e-06"/>   </inertial>   <visual>
     <origin xyz="0.427806 -0.396591 -0.371346" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WRB_supp_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="0.427806 -0.396591 -0.371346" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WRB_supp_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="WRF_1">   <inertial>
     <origin xyz="0.00022231321115867564
 0.030856418914129602 6.118055645987219e-07" rpy="0 0 0"/>
     <mass value="0.7923140233383783"/>
     <inertia ixx="0.002447" iyy="0.004158" izz="0.002447"
 ixy="1.2e-05" iyz="0.0" ixz="-0.0"/>  
 </inertial>   <visual>
     <origin xyz="-0.39127 -0.375303 -0.216561" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WRF_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="-0.39127 -0.375303 -0.216561" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WRF_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="WRM_1">   <inertial>
     <origin xyz="-7.423233885535396e-07
 0.04421440445825414 -8.285402313679135e-07" rpy="0 0 0"/>
     <mass value="0.8108718866431287"/>
     <inertia ixx="0.002505" iyy="0.004161" izz="0.002505"
 ixy="0.0" iyz="0.0" ixz="0.0"/>  
 </inertial>   <visual>
     <origin xyz="0.024115 -0.384591 -0.21047" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WRM_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="0.024115 -0.384591 -0.21047" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WRM_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="WRB_1">   <inertial>
     <origin xyz="-6.598539384894408e-07
 0.04853448757279283 5.190034971513935e-07" rpy="0 0 0"/>
     <mass value="0.8211769381894314"/>
     <inertia ixx="0.002537" iyy="0.004163" izz="0.002537"
 ixy="0.0" iyz="0.0" ixz="0.0"/>  
 </inertial>   <visual>
     <origin xyz="0.424707 -0.378107 -0.213376" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WRB_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="0.424707 -0.378107 -0.213376" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/WRB_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

 <link name="Right_leg_double_1">  
 <inertial>
     <origin xyz="-0.01745444401971802 0.06338178542499118 -0.07471145682820046" rpy="0 0 0"/>
     <mass value="0.15870353264297354"/>
     <inertia ixx="0.000751" iyy="0.00326" izz="0.002641"
 ixy="0.000164" iyz="3.7e-05"
 ixz="0.00073"/>   </inertial>  
 <visual>
     <origin xyz="0.252653 -0.314341 -0.453038" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/Right_leg_double_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>
     <material name="silver"/>   </visual>   <collision>
     <origin xyz="0.252653 -0.314341 -0.453038" rpy="0 0 0"/>
     <geometry>
       <mesh filename="package://ERC22_URDF_description/meshes/Right_leg_double_1.stl"
 scale="0.001 0.001 0.001"/>
     </geometry>   </collision> </link>

   <!-- Camera --> <link
 name="camera_link_left">   <collision>
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <geometry>   <box size="0.05 0.05 0.05"/>
     </geometry>   </collision>   <visual>
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <geometry>   <box size="0.05 0.05 0.05"/>
     </geometry>
     <material name="red"/>   </visual>   <inertial>
     <mass value="1e-5" />
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6"
 />   </inertial> </link>

 <link name="camera_link_right">  
 <collision>
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <geometry>   <box size="0.05 0.05 0.05"/>
     </geometry>   </collision>   <visual>
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <geometry>   <box size="0.05 0.05 0.05"/>
     </geometry>
     <material name="red"/>   </visual>   <inertial>
     <mass value="1e-5" />
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6"
 />   </inertial> </link>

 <joint name="S_LF" type="continuous"> 
 <origin xyz="0.391355 -0.383158
 0.356565" rpy="0 0 0"/>   <parent link="base_link"/>   <child
 link="WLF_supp_1"/>   <axis
 xyz="-5e-06 -0.0 1.0"/> </joint>

 <joint name="L_DS" type="continuous"> 
 <origin xyz="-0.252653 -0.310658
 0.453036" rpy="0 0 0"/>   <parent link="base_link"/>   <child
 link="Left_leg_double_1"/>   <axis
 xyz="-0.0 1.0 0.0"/> </joint>

 <joint name="S_LB" type="continuous"> 
 <origin xyz="-0.175276 -0.0815
 -0.081429" rpy="0 0 0"/>   <parent link="Left_leg_double_1"/>   <child
 link="WLB_supp_1"/>   <axis
 xyz="0.018114 0.0 -0.999836"/>
 </joint>

 <joint name="W_LB" type="continuous"> 
 <origin xyz="0.002922 0.018483
 -0.157973" rpy="0 0 0"/>   <parent link="WLB_supp_1"/>   <child
 link="WLB_1"/>   <axis xyz="-0.003222
 -0.999995 -5.8e-05"/> </joint>

 <joint name="W_LM" type="continuous"> 
 <origin xyz="0.228173 -0.0695
 -0.242912" rpy="0 0 0"/>   <parent link="Left_leg_double_1"/>   <child
 link="WLM_1"/>   <axis xyz="-0.0 1.0
 0.0"/> </joint>

 <joint name="W_LF" type="continuous"> 
 <origin xyz="-0.000133 0.018483 -0.14"
 rpy="0 0 0"/>   <parent
 link="WLF_supp_1"/>   <child
 link="WLF_1"/>   <axis xyz="0.007212
 -0.999974 0.0"/> </joint>

 <joint name="S_RF" type="continuous"> 
 <origin xyz="0.391354 0.386841
 0.356561" rpy="0 0 0"/>   <parent link="base_link"/>   <child
 link="WRF_supp_1"/>   <axis
 xyz="-3e-06 -0.0 -1.0"/> </joint>

 <joint name="S_RB" type="continuous"> 
 <origin xyz="-0.175153 0.08225
 -0.081692" rpy="0 0 0"/>   <parent link="Right_leg_double_1"/>   <child
 link="WRB_supp_1"/>   <axis
 xyz="-0.019617 0.0 0.999808"/>
 </joint>

 <joint name="W_RF" type="continuous"> 
 <origin xyz="-8.4e-05 -0.011538 -0.14"
 rpy="0 0 0"/>   <parent
 link="WRF_supp_1"/>   <child
 link="WRF_1"/>   <axis xyz="-0.007212
 -0.999974 0.0"/> </joint>

 <joint name="W_RM" type="continuous"> 
 <origin xyz="0.228538 0.07025
 -0.242568" rpy="0 0 0"/>   <parent link="Right_leg_double_1"/>   <child
 link="WRM_1"/>   <axis xyz="0.0 1.0
 -0.0"/> </joint>

 <joint name="W_RB" type="continuous"> 
 <origin xyz="0.003099 -0.018484
 -0.15797" rpy="0 0 0"/>   <parent link="WRB_supp_1"/>   <child
 link="WRB_1"/>   <axis xyz="-0.0 -1.0
 0.0"/> </joint>

 <joint name="R_DS" type="continuous"> 
 <origin xyz="-0.252653 0.314341
 0.453038" rpy="0 0 0"/>   <parent link="base_link"/>   <child
 link="Right_leg_double_1"/>   <axis
 xyz="0.0 1.0 -0.0"/> </joint>

 <joint name="camera_joint_left"
 type="fixed">   <axis xyz="0 1 0" />  
 <origin xyz="0.285 0.23 0.58" rpy="0 0
 0.785"/>   <parent link="base_link"/>   <child link="camera_link_left"/>
 </joint>

 <joint name="camera_joint_right"
 type="fixed">   <axis xyz="0 1 0" />  
 <origin xyz="0.285 -0.23 0.58" rpy="0
 0 -0.785"/>   <parent
 link="base_link"/>   <child
 link="camera_link_right"/> </joint>

 </robot>

Asked by lectric on 2022-12-24 11:23:29 UTC

Comments

Please explain at a high level what information you are trying to obtain. The /tf topic may not be the right place to find it. Can you provide a link to your simulation files (e.g. github or a zip file)?

Asked by Mike Scheutzow on 2022-12-29 10:18:10 UTC

Answers

You should create a new urdf/xacro file that creates a "world" link, then create a fixed joint from world->base_link (or whatever the base link of your robot uses.) Here's an example of how the universal_robot people do it:

https://github.com/ros-industrial/universal_robot/blob/melodic-devel/ur_gazebo/urdf/ur.xacro

Asked by Mike Scheutzow on 2022-12-26 10:07:31 UTC

Comments

Thank you for answering. This robot is a robotic arm which is fixed to the world but mine is a mobile robot. I've tried the solution you mentioned using a "floating" joint but the model collapses to origin.

Asked by lectric on 2022-12-26 14:56:46 UTC

In gazebo, a mobile object is handled differently from an arm. Are you using "spawn_model" to add the robot to the gazebo world?

Asked by Mike Scheutzow on 2022-12-27 15:54:15 UTC

Yes, here i present my gazebo.launch. Nav_task is a custom world

<launch>
  <param name="robot_description" command="$(find xacro)/xacro $(find ERC22_URDF_description)/urdf/ERC22_URDF.xacro"/>
  <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model ERC22_URDF"/>
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="worlds/Nav_task.world"/>
    <arg name="paused" value="true"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
  </include>
</launch>

Asked by lectric on 2022-12-27 16:13:04 UTC