ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

No link elements found in urdf file

asked 2020-03-02 15:13:07 -0500

q8wwe gravatar image

updated 2020-03-02 15:15:11 -0500

I'm trying to simulate intel realsense in Gazebo and for that i run into error :No link elements found in urdf file.

My urdf.xacro file: d435.urdf.xacro:

<?xml version="1.0"?>

<!--
License: Apache 2.0. See LICENSE file in root directory.
Copyright(c) 2017 Intel Corporation. All Rights Reserved

This is the URDF model for the Intel RealSense 430 camera, in it's
aluminum peripherial evaluation case.
-->

<robot name= "intel" xmlns:xacro="http://ros.org/wiki/xacro">

  <xacro:include filename="$(find realsense_gazebo_plugin)/urdf/d435.gazebo.xacro"/> 

  <xacro:macro name="sensor_d435" params="parent *origin">
    <xacro:property name="M_PI" value="3.1415926535897931" />

    <!-- The following values are approximate, and the camera node
     publishing TF values with actual calibrated camera extrinsic values -->
    <xacro:property name="d435_cam_depth_to_left_ir_offset" value="0.0"/>
    <xacro:property name="d435_cam_depth_to_right_ir_offset" value="-0.050"/>
    <xacro:property name="d435_cam_depth_to_color_offset" value="0.015"/>

    <!-- The following values model the aluminum peripherial case for the
    D435 camera, with the camera joint represented by the actual 
    peripherial camera tripod mount -->
    <xacro:property name="d435_cam_width" value="0.090"/>
    <xacro:property name="d435_cam_height" value="0.025"/>
    <xacro:property name="d435_cam_depth" value="0.02505"/>
    <xacro:property name="d435_cam_mount_from_center_offset" value="0.0149"/>

    <!-- The following offset is relative the the physical D435 camera peripherial
    camera tripod mount -->
    <xacro:property name="d435_cam_depth_px" value="${d435_cam_mount_from_center_offset}"/>
    <xacro:property name="d435_cam_depth_py" value="0.0175"/>
    <xacro:property name="d435_cam_depth_pz" value="${d435_cam_height/2}"/>

    <material name="aluminum">
      <color rgba="0.5 0.5 0.5 1"/>
    </material>


    <!-- camera body, with origin at bottom screw mount -->
    <joint name="camera_joint" type="fixed">
      <xacro:insert_block name="origin" />
      <parent link="${parent}"/>
      <child link="camera_link" />
    </joint>

    <link name="camera_link">
      <visual>
      <origin xyz="${d435_cam_mount_from_center_offset} 0.0 ${d435_cam_height/2}" rpy="${M_PI/2} 0 ${M_PI/2}"/>
    <geometry>
        <mesh filename="package://realsense_gazebo_plugin/meshes/d435.dae" />
    </geometry>
    <material name="aluminum"/>
      </visual>
      <collision>
    <origin xyz="0.0 0.0 ${d435_cam_height/2}" rpy="0 0 0"/>
    <geometry>
    <box size="${d435_cam_depth} ${d435_cam_width} ${d435_cam_height}"/>
    </geometry>
      </collision>
      <inertial>
    <!-- The following are not reliable values, and should not be used for modeling -->
    <mass value="0.564" />
    <origin xyz="0 0 0" />
    <inertia ixx="0.003881243" ixy="0.0" ixz="0.0" iyy="0.000498940" iyz="0.0" izz="0.003879257" />
      </inertial>
    </link>

    <!-- camera depth joints and links -->
    <joint name="camera_depth_joint" type="fixed">
      <origin xyz="${d435_cam_depth_px} ${d435_cam_depth_py} ${d435_cam_depth_pz}" rpy="0 0 0"/>
      <parent link="camera_link"/>
      <child link="camera_depth_frame" />
    </joint>
    <link name="camera_depth_frame"/>

    <joint name="camera_depth_optical_joint" type="fixed">
      <origin xyz="0 0 0" rpy="${-M_PI/2} 0 ${-M_PI/2}" />
      <parent link="camera_depth_frame" />
      <child link="camera_depth_optical_frame" />
    </joint>
    <link name="camera_depth_optical_frame"/>

    <!-- camera left IR joints and links -->
    <joint name="camera_left_ir_joint" type="fixed">
      <origin xyz="0 ${d435_cam_depth_to_left_ir_offset} 0" rpy ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-03-02 15:32:59 -0500

marguedas gravatar image

It looks like all your urdf.xacro file is doing is:

  • including d435.gazebo.xacro
  • defining a macro named "sensor_d435"

Is there any code actually instantiating that macro ? If not the resultung URDF will be empty, explaining why gazebo cannot find any link in it.


For the macro sensor_d435 to take effect you need to instantiate it, similar to how you instantiate simulation_d435 insidesensor_d435:

<xacro:simulation_d435 camera_name="realsense" depth_optical_frame="camera_depth_optical_frame" color_optical_frame="camera_color_optical_frame" infrared1_optical_frame="camera_left_ir_optical_frame" infrared2_optical_frame="camera_right_ir_optical_frame"/>
edit flag offensive delete link more

Comments

where shall I instantiate sensor_d435 , shall I instantiate it in the same file or create new file and what parameter shall i include .

I'm totally new to this and I'm trying to make this file work

q8wwe gravatar image q8wwe  ( 2020-03-02 16:38:31 -0500 )edit

Both will work. Usually macros like this ae ddefined to be included in a higher level file. E.g. as you provide a way to pass the "parent" parameter to the macro, that means you want to attach this sensor to an existing link. If that's the case it's better to instantiate the macro in the xacro file where that parent link is defined.

marguedas gravatar image marguedas  ( 2020-03-03 04:18:23 -0500 )edit

thanks, it worked after I instantiate it as marguedas mentioned

q8wwe gravatar image q8wwe  ( 2020-03-21 10:26:05 -0500 )edit

glad you got it to work. Could you please mark the question as solved by hitting the checkmark on the left ? this will remove it from the list of questions that need attention from the community.

marguedas gravatar image marguedas  ( 2020-03-21 12:25:37 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2020-03-02 15:13:07 -0500

Seen: 4,390 times

Last updated: Mar 02 '20