Unable to see urdf.xacro file in Gazebo or use it in Moveit!

asked 2020-10-22 08:58:10 -0500

KimJensen gravatar image

I am trying to create a urdf file (DJi_Mavic_Pro_2.urdf.xacro) with an attached Kinect camera to be used for 3D Drone Navigation in Moveit!. Previously, I have been able to use the urdf.xacro file below to spawn and visualize the drone in Gazebo using the launch file "basicForest.launch" (see below). Here I was able to visualize the drone, though without the camera appearing in Gazebo.

As I am experiencing errors with the Moveit! Setup Assistant when trying to load the urdf-model "DJi_Mavic_Pro_2.urdf.xacro" then I tried to use the following command for creating a urdf file which would work for Moveit!:

rosrun xacro xacro --inorder  /home/ros/dji_ws/src/dji_stack/dji_simulations/urdf/DJi_Mavic_2_pro.urdf.xacro > /tmp/dji.urdf

This however did not create a usable file for Moveit!. Instead it now have created a situation where I'm still not able to parse a urdf model to Moveit!, but now I also cannot visualize the drone in Gazebo. The model is loaded/recognised as I can see it as part of the Models tab in left-hand-side in Gazebo. Also, I can't seem to find any difference between previous and current versions of the files.

My goal is to correctly create the urdf.xacro file such that it can be usable both for launching in Gazebo (including the camera) and for using it through Moveit!. My questions are as follows:

  1. What can I do such that I again can visualize the drone in Gazebo?
  2. How should I change the "DJi_Mavic_Pro_2.urdf.xacro" file such that it will show the camera in Gazebo?
  3. What should I do to be able to use the urdf model in the Moveit! Setup Assistant?

Note: Currently I'm running Ubuntu 16.04 (ROS Kinetic) and Gazebo 7.

Moveit! Setup Assistant error

[ERROR] [1603373723.561981341]: No link elements found in urdf file

image description


<?xml version='1.0'?>

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

  <!-- //////////////////////////////////////////////////////////////////// -->
  <!-- Included URDFs -->
  <!-- xacro:include filename="$(find mybot_description)/urdf/mybot.gazebo" />
  <xacro:include filename="$(find mybot_description)/urdf/materials.xacro" />
  <xacro:include filename="$(find mybot_description)/urdf/macros.xacro" / -->

  <!-- //////////////////////////////////////////////////////////////////// -->
  <!-- Geometric properties of the platform and sensors -->
  <!-- //////////////////////////////////////////////////////////////////// -->
  <!-- Base -->

  <!-- Camera -->
  <xacro:property name="cameraSize" value="0.05"/>
  <xacro:property name="cameraMass" value="0.1"/>

  <!-- //////////////////////////////////////////////////////////////////// -->
  <!-- Macro to define a RGB-D camera, implemented as a fixed link -->
  <xacro:macro name="RGBD_camera" params="parent type location *origin">
    <joint name="camera_joint" type="fixed">
      <axis xyz="0 1 0" />
      <origin xyz=".2 0 0" rpy="0 0 0"/>
      <parent link="DJi_Mavic_2_pro"/>
      <child link="camera"/>

    <link name="camera">
        <origin xyz="0 0 0" rpy="0 0 0"/>
          <box size="${cameraSize} ${cameraSize} ${cameraSize}"/>

        <origin xyz="0 0 0" rpy="0 0 0"/>
          <box size="${cameraSize} ${cameraSize ...
edit retag flag offensive close merge delete