0
$\begingroup$

Rosanswers logo

I am trying to use stl files with the tag mesh with this code:

  <geometry>
    <mesh filename="package://auriga_model/auriga_base.stl"/>
  </geometry>

The package existes and the file is located there but I get this message when I try to launch it:

[ERROR] [1301591093.704357996]: Malformed geometry for Visual element
[ERROR] [1301591093.704545807]: Could not parse visual element for Link '/base_laser'
[ERROR] [1301591093.704624976]: link xml is not initialized correctly

I have been doing some test with PR2 stl model and I had no success. Here are some of my tries:

  <!-- description of the robot -->
  <link name="/base_link">
    <visual>
      <origin rpy="0 0 0" xyz="0.15 0 0.35"/>
      <geometry>
        <!-- mesh filename="package://auriga_model/meshes/auriga_base.stl" /-->
        <!-- mesh filename="package://auriga_model/meshes/head_pan.stl" /-->
        <mesh filename="package://pr2_description/meshes/head_v0/head_pan.stl"/>
      </geometry>
    </visual>
  </link>

  <link name="/base_laser">
    <visual>
      <origin rpy="0 0 0" xyz="0 0 0"/>
    </visual>
  </link>

For me, it looks like it can't resolve properly "filename="package://". Is it possible? I tested and "rospack find" command works fine with me.

Any clue?


Now I am able to load PR2 models but not the one of my robot. The original model was build in solidworks and maybe this is the problem. I will try to port it from Catia and I will say if it works.


Originally posted by jsogorb on ROS Answers with karma: 77 on 2011-03-31

Post score: 3


Original comments

Comment by hsu on 2011-04-07:
If solidworks was the problem, one thing you can try is open the solidworks mesh in a text editor (e.g. vi), and replace the first word "solid" with spaces.

Comment by David Lu on 2011-03-31:
That seems correct at first pass. What node are you launching that gives you this error? Also, could you post the whole Link xml, please?

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

The link "base_link" is just fine. The problem is that the second visual tag (in the link "base_laser") is missing the required <geometry> element. You also need to specify a joint between the two links, otherwise the robot_state_publisher will complain that there are two root links. Below are working versions of the URDF and launch file. Also see the URDF XML documentation and the URDF tutorials.

URDF file:

<robot name="your_robot_name">
  <link name="base_link">
    <visual>
      <origin rpy="0 0 0" xyz="0.15 0 0.35"/>
      <geometry>
        <mesh filename="package://pr2_description/meshes/head_v0/head_pan.stl"/>
      </geometry>
    </visual>
  </link>

  <joint name="base_link_to_base_laser_joint" type="fixed">
    <parent link="base_link"/>
    <child link="base_laser"/>
    <origin xyz="0 0 1.0"/>
  </joint>
  
  <link name="base_laser">
    <visual>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <cylinder length="0.6" radius="0.2"/>
      </geometry>
    </visual>
  </link>
</robot>

launch file:

<launch>
  <!-- upload urdf -->
  <param name="robot_description" textfile="$(find your_package_name)/urdf/your_robot.urdf" />
 
  <!-- robot state publisher -->
  <node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher" />

  <!-- joint state publisher with gui -->
  <param name="use_gui" value="true" />
  <node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher"/>
</launch>

Originally posted by Martin Günther with karma: 11816 on 2011-04-03

This answer was ACCEPTED on the original site

Post score: 6


Original comments

Comment by David Lu on 2011-04-26:
Please post a new question with all of the relevant XML.

Comment by Tõnu Samuel on 2011-04-26:
I am not sure if I need to ask new question or extend it. I see on similar issue strace output like this: stat64("/home/it/ros/visualization_common/ogre_tools/media/materials/programs/package://xml/Roboti_algus - roomuk-1 Jalg-1 1-1.STL"... Why "package://" is not parsed/rewritten? Some trick?

Comment by PrasadNR on 2016-12-16:
+1 But, I would still like to know how a model created in Catia/Blender (say a simple two joint three link structure hand equivalent) can be simulated in ROS Gazebo interface through C++ code (from scratch).

Comment by Alessandro Melino on 2020-06-19:
Hello, I see that you declare the base_laser link in the urdf file, but is it possible to declare it using tf package and in the urdf file just declare the base_link with the stl model?

Comment by Martin Günther on 2020-06-19:
Sure, you can have a URDF that only has the base_laser link in it, and publish the TF transform yourself. If you want to display meshes for both the base_laser and base_link while publishing the base_link to base_laser joint yourself via TF, you cannot simply delete the base_link_to_base_laser_joint, because URDF doesn't allow two unconnected trees of links. Instead, you should change the joint type from fixed to floating. This will cause robot_state_publisher to ignore that joint and not publish TFs for it: https://github.com/ros/robot_state_publisher/blob/d8600f658aa09c3cb68f034feec357dc1d24bb72/src/robot_state_publisher.cpp#L66

Then you can publish that TF yourself.

Comment by Alessandro Melino on 2020-06-22:
Okay, I understood it perfectly. Thank you for your answer.

$\endgroup$
0
$\begingroup$

Rosanswers logo

Was the stl generated from Solidworks? If so, it might be related to this ticket. We can reopen the ticket and submit a patch to assimp if necessary.

Can you please post the stl file as well? To check, you can copy another working stl (e.g. from pr2_description) into auriga_model, and see if a different stl brings up correctly.


Originally posted by hsu with karma: 5780 on 2011-03-31

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.