Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

URDF on parameter server parsing error when calling urdf::Model initParam method

I am using ROS kinetic and Ubuntu 16.04. I am trying to use a URDF from my parameter server in a node using the following code, with this launch file:

launch file

<launch>

<param name="robot_description"
       command="$(find xacro)/xacro --inorder '$(find march_description)/urdf/single-joint.xacro'" />
<node name="CTC_tools" pkg="march_control" type="CTC_tools" output="screen"/>

</launch>

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

<!-- Constants for robot dimensions -->
<xacro:property name="bar_mass" value="1.1372"/>
<xacro:property name="bar_length" value="0.78"/>
<xacro:property name="bar_width" value="0.012"/>
<xacro:property name="bar_height" value="0.045"/>

<xacro:property name="velocity_limit" value="1"/>
<xacro:property name="lower_limit" value="${-2*pi/180}"/>
<xacro:property name="upper_limit" value="${100*pi/180}"/>
<xacro:property name="effort_limit" value="1"/>

<xacro:property name="camera_link" value="0.05"/> <!-- Size of square 'camera' box -->

<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
    <robotNamespace>/march</robotNamespace>
</plugin>


<!-- Used for fixing robot to Gazebo 'base_link' -->
<link name="world"/>

<joint name="fixed_joint" type="fixed">
    <parent link="world"/>
    <child link="base"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>

    <limit velocity="${velocity_limit}" effort="${effort_limit}" lower="${lower_limit}" upper="${upper_limit}"/>
</joint>

<!-- Base -->
<link name="base">
    <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
            <box size="0.1 0.1 0.1"/>
        </geometry>
    </visual>
    <inertial>
        <origin xyz="${bar_length/2} ${bar_height/2} ${bar_width/2}" rpy="0 0 0"/>
        <mass value="${bar_mass}"/>
        <inertia
                ixx="${bar_mass / 12.0 * (bar_width*bar_width + bar_height*bar_height)}" ixy="0.0" ixz="0.0"
                iyy="${bar_mass / 12.0 * (bar_height*bar_height + bar_width*bar_width)}" iyz="0.0"
                izz="${bar_mass / 12.0 * (bar_width*bar_width + bar_width*bar_width)}"/>
    </inertial>
</link>

<joint name="test_joint" type="revolute">
    <parent link="base"/>
    <child link="bar"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <axis xyz="0 -1 0"/>

    <limit velocity="${velocity_limit}" effort="${effort_limit}" lower="${lower_limit}" upper="${upper_limit}"/>
</joint>


<!-- Bar -->
<link name="bar">
    <visual>
        <origin xyz="${bar_length/2} 0 0" rpy="0 0 0"/>
        <geometry>
            <box size="${bar_length} ${bar_width} ${bar_height}"/>
        </geometry>
    </visual>

    <inertial>
        <origin xyz="${bar_length/2} ${bar_height/2} ${bar_width/2}" rpy="0 0 0"/>
        <mass value="${bar_mass}"/>
        <inertia
                ixx="${bar_mass / 12.0 * (bar_width*bar_width + bar_height*bar_height)}" ixy="0.0" ixz="0.0"
                iyy="${bar_mass / 12.0 * (bar_height*bar_height + bar_width*bar_width)}" iyz="0.0"
                izz="${bar_mass / 12.0 * (bar_width*bar_width + bar_width*bar_width)}"/>
    </inertial>
</link>


<!-- ROS Control plugin for Gazebo -->

<transmission name="test_joint">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="test_joint">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
    </joint>
    <actuator name="test_joint_motor">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>

</robot>

#include "ros/ros.h"
#include "std_msgs/String.h"
#include <iostream>
#include <urdf/model.h>
#include <rbdl/rbdl.h>
#include <rbdl/rbdl_utils.h>

#ifndef RBDL_BUILD_ADDON_URDFREADER
#error "Error: RBDL addon URDFReader not enabled."
#endif

#include <rbdl/addons/urdfreader/urdfreader.h>

using namespace RigidBodyDynamics;
using namespace RigidBodyDynamics::Math;

#include <sstream>
#include <urdf/model.h>

int main(int argc, char** argv)
{
  // intializing and linking the ROS node to the core
  ros::init(argc, argv, "CTC_tools");
  ros::NodeHandle n;
  ros::Rate loop_rate(10);

  std::string urdfName;

  urdf::Model urdfModel;
  urdfModel.initParam(urdfName)

  ros::spin();

  return 0;
};

However an error keeps being thrown:

[ERROR] [1550745612.526606196]: Unknown geometry type ''
[ERROR] [1550745612.526667138]: Could not parse visual element for Link [base]
[ERROR] [1550745612.526734471]: Unknown geometry type ''
[ERROR] [1550745612.526742657]: Could not parse visual element for Link [bar]

Does anyone know what is happening here and how I can solve it?

URDF on parameter server parsing error when calling urdf::Model initParam method

I am using ROS kinetic and Ubuntu 16.04. I am trying to use a URDF from my parameter server in a node using the following code, with this launch file:

launch file

<launch>

<param name="robot_description"
       command="$(find xacro)/xacro --inorder '$(find march_description)/urdf/single-joint.xacro'" />
<node name="CTC_tools" pkg="march_control" type="CTC_tools" output="screen"/>

</launch>

URDF

<?xml version="1.0"?>
<!-- Revolute-Revolute Manipulator -->
<robot name="march" xmlns:xacro="http://www.ros.org/wiki/xacro">

xmlns:xacro="http://www.ros.org/wiki/xacro">

<!-- Constants for robot dimensions -->
<xacro:property name="bar_mass" value="1.1372"/>
<xacro:property name="bar_length" value="0.78"/>
<xacro:property name="bar_width" value="0.012"/>
<xacro:property name="bar_height" value="0.045"/>

<xacro:property name="velocity_limit" value="1"/>
<xacro:property name="lower_limit" value="${-2*pi/180}"/>
<xacro:property name="upper_limit" value="${100*pi/180}"/>
<xacro:property name="effort_limit" value="1"/>

<xacro:property name="camera_link" value="0.05"/> <!-- Size of square 'camera' box -->

<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
    <robotNamespace>/march</robotNamespace>
</plugin>


<!-- Used for fixing robot to Gazebo 'base_link' -->
<link name="world"/>

<joint name="fixed_joint" type="fixed">
    <parent link="world"/>
    <child link="base"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>

    <limit velocity="${velocity_limit}" effort="${effort_limit}" lower="${lower_limit}" upper="${upper_limit}"/>
</joint>

<!-- Base -->
<link name="base">
    <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
            <box size="0.1 0.1 0.1"/>
        </geometry>
    </visual>
    <inertial>
        <origin xyz="${bar_length/2} ${bar_height/2} ${bar_width/2}" rpy="0 0 0"/>
        <mass value="${bar_mass}"/>
        <inertia
                ixx="${bar_mass / 12.0 * (bar_width*bar_width + bar_height*bar_height)}" ixy="0.0" ixz="0.0"
                iyy="${bar_mass / 12.0 * (bar_height*bar_height + bar_width*bar_width)}" iyz="0.0"
                izz="${bar_mass / 12.0 * (bar_width*bar_width + bar_width*bar_width)}"/>
    </inertial>
</link>

<joint name="test_joint" type="revolute">
    <parent link="base"/>
    <child link="bar"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <axis xyz="0 -1 0"/>

    <limit velocity="${velocity_limit}" effort="${effort_limit}" lower="${lower_limit}" upper="${upper_limit}"/>
</joint>


<!-- Bar -->
<link name="bar">
    <visual>
        <origin xyz="${bar_length/2} 0 0" rpy="0 0 0"/>
        <geometry>
            <box size="${bar_length} ${bar_width} ${bar_height}"/>
        </geometry>
    </visual>

    <inertial>
        <origin xyz="${bar_length/2} ${bar_height/2} ${bar_width/2}" rpy="0 0 0"/>
        <mass value="${bar_mass}"/>
        <inertia
                ixx="${bar_mass / 12.0 * (bar_width*bar_width + bar_height*bar_height)}" ixy="0.0" ixz="0.0"
                iyy="${bar_mass / 12.0 * (bar_height*bar_height + bar_width*bar_width)}" iyz="0.0"
                izz="${bar_mass / 12.0 * (bar_width*bar_width + bar_width*bar_width)}"/>
    </inertial>
</link>


<!-- ROS Control plugin for Gazebo -->

<transmission name="test_joint">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="test_joint">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
    </joint>
    <actuator name="test_joint_motor">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>


</robot>

</robot>Node with the following c++ code for the node

#include "ros/ros.h"
#include "std_msgs/String.h"
#include <iostream>
#include <urdf/model.h>
#include <rbdl/rbdl.h>
#include <rbdl/rbdl_utils.h>

#ifndef RBDL_BUILD_ADDON_URDFREADER
#error "Error: RBDL addon URDFReader not enabled."
#endif

#include <sstream>
#include <urdf/model.h>
#include <rbdl/addons/urdfreader/urdfreader.h>

using namespace RigidBodyDynamics;
using namespace RigidBodyDynamics::Math;

#include <sstream>
#include <urdf/model.h>

int main(int argc, char** argv)
{
  // intializing and linking the ROS node to the core
  ros::init(argc, argv, "CTC_tools");
  ros::NodeHandle n;
  ros::Rate loop_rate(10);

  std::string urdfName;

  urdf::Model urdfModel;
  urdfModel.initParam(urdfName)

  urdfModel.initParam("robot_description");


  ros::spin();

  return 0;
};

However an error keeps being thrown:

[ERROR] [1550745612.526606196]: Unknown geometry type ''
[ERROR] [1550745612.526667138]: Could not parse visual element for Link [base]
[ERROR] [1550745612.526734471]: Unknown geometry type ''
[ERROR] [1550745612.526742657]: Could not parse visual element for Link [bar]

Does anyone know what is happening here and how I can solve it?