Rosanswers logo

I am currently drawing out my robot using URDF. I am at the end of the first URDF tutorial (see http://wiki.ros.org/urdf/Tutorials/Building%20a%20Visual%20Robot%20Model%20with%20URDF%20from%20Scratch#Finishing_the_Model). My problem: once I added my mesh, it is very disproportionate to the rest of the drawing, and I have no idea how to resize the mesh. The tutorial states that: "Meshes can also be sized using relative scaling parameters or a bounding box size"

where do I find an example? Where is the documentation? and if no documentation or examples exist, could you please provide an example of code for a "bounding box" or "relative scaling"?

More detail:

image before meshes are added in urdf file:

image description

image after meshes are added in urdf file:

image description

the code importing the meshes:

   <!-- *********************(21) LMS LINK - MESHES****************************-->
  <!-- a "link" is the part that we are creating. All the internal tags describe
       this part. This is the body of Jimmy (both square levels) -->
  <link name="LMS_link">
        <!--box dimensions is Meters. L X W X H where the L X H is a rectangle, 
            and the H extrudes it upwards -->
        <mesh filename="package://urdf_tutorial/meshes/LMS-200-30106.dae"/>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <material name="white"/>
    <!-- *********************(22) LMS to LMS PLATE JOINT **********************-->
    <!-- a joint allows us to create a relationship between two links (parts)-->
      <joint name="LMS_to_LMS_plate_joint" type="fixed">
        <parent link="LMS_plate_link"/>
        <child link="LMS_link"/>
        <!-- this is the point at which the two parts attach to one another-->
        <origin xyz="0 0 0"/>

I am building a URDF because it was suggested here: https://answers.ros.org/question/271819/please-suggest-all-packages-to-achieve-slam-for-robot/

Originally posted by BuilderMike on ROS Answers with karma: 247 on 2017-10-18

Post score: 5

Original comments

Comment by gvdhoorn on 2017-10-19:
@BuilderMike: please attach your images to your question directly. I've given you enough karma to do that.

Comment by gvdhoorn on 2017-10-19:
Also: I would advise you follow regular ROS Naming conventions when naming links and joints as well. In summary: no capitals, anywhere, no whitespace, no special chars.

Comment by BuilderMike on 2017-10-19:
@gvdhoorn Thanks for the karma, I updated all my questions to include images instead of links. Also, thank you for the link to the URDF XML wiki.... I missed it when reading the tutorial. As for the naming convention, thanks for pointing out my error. Is there a document outlining these conventions?

Comment by gvdhoorn on 2017-10-20:
re: conventions: I think I linked you to those ("ROS Naming conventions").

If you're looking for joint/link/frame naming conventions, there is geometry/CoordinateFrameConventions, but it's not too explicit.

No capitals or special chars ..

Comment by gvdhoorn on 2017-10-20:
.. and no whitespace just makes sense: no guessing as to how someone CaPiTaLiseD their frames, no weird international char / localisation issues, etc.

I always follow wiki/Names with everything (files, directories, xacros, etc).


1 Answer 1


Rosanswers logo

This should do it:

<mesh filename="package://pkg_name/filepath/your_stl.stl" scale="0.001 0.001 0.001"/>

Alternatively, you could install Blender. It lets you scale stl's and also change the coordinate frame. See http://gazebosim.org/tutorials?tut=guided_i2

Originally posted by AndyZe with karma: 2331 on 2017-10-18

This answer was ACCEPTED on the original site

Post score: 11

Original comments

Comment by BuilderMike on 2017-10-18:
Hi AndyZe, Thanks for your answer and suggestion, At this point, I have so many packages to learn that it's overwhelming. Could you expand your answer on what the scale values mean? is it % or actual distance units, and if so which ones? Is there any documentation for this xml tag in a URDF context?

Comment by AndyZe on 2017-10-18:
It's just multiplied by that factor. So in my example, the STL would be 1/1000th of the original size.

Comment by BuilderMike on 2017-10-18:
How did you know this... is there documentation on this xml tag somewhere? Thank you very much for your answer it did work for me.

Comment by AndyZe on 2017-10-18:
Tribal knowledge. But seriously, I learned it from another person firsthand.

Comment by gvdhoorn on 2017-10-19:\

Tribal knowledge

This is all documented on the wiki, see wiki/urdf/XML.

Comment by lucasw on 2021-09-21:
Negative scale values do a flip/mirror image on that axis, a left wheel can become a right wheel and so on, which is less trouble than having to maintain separate otherwise identical mesh files.


Your Answer

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