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

How to resize meshes in URDF?

asked 2017-10-18 18:09:20 -0500

updated 2017-10-19 16:34:40 -0500

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/Bu... ). 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">
    <visual>
      <geometry>
        <!--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"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <material name="white"/>
    </visual>
  </link>

    <!-- *********************(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"/>
      </joint>

I am building a URDF because it was suggested here: https://answers.ros.org/question/2718...

edit retag flag offensive close merge delete

Comments

@BuilderMike: please attach your images to your question directly. I've given you enough karma to do that.

gvdhoorn gravatar image gvdhoorn  ( 2017-10-19 02:31:03 -0500 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2017-10-19 02:33:09 -0500 )edit

@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?

BuilderMike gravatar image BuilderMike  ( 2017-10-19 16:52:24 -0500 )edit

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 ..

gvdhoorn gravatar image gvdhoorn  ( 2017-10-20 02:34:48 -0500 )edit

.. 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).

gvdhoorn gravatar image gvdhoorn  ( 2017-10-20 02:36:03 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
11

answered 2017-10-18 18:35:12 -0500

AndyZe gravatar image

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

edit flag offensive delete link more

Comments

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?

BuilderMike gravatar image BuilderMike  ( 2017-10-18 19:00:05 -0500 )edit

It's just multiplied by that factor. So in my example, the STL would be 1/1000th of the original size.

AndyZe gravatar image AndyZe  ( 2017-10-18 19:03:06 -0500 )edit

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.

BuilderMike gravatar image BuilderMike  ( 2017-10-18 19:10:54 -0500 )edit

Tribal knowledge. But seriously, I learned it from another person firsthand.

AndyZe gravatar image AndyZe  ( 2017-10-18 19:46:39 -0500 )edit

Tribal knowledge

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

gvdhoorn gravatar image gvdhoorn  ( 2017-10-19 02:29:15 -0500 )edit

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.

... scale="1.0 -1.0 1.0" />

lucasw gravatar image lucasw  ( 2021-09-21 22:47:41 -0500 )edit
0

answered 2021-04-20 11:26:36 -0500

lorepieri gravatar image

This works for a SDF:

<mesh>
  <uri>model://my_stl_path.stl</uri>
  <scale> 0.001 0.001 0.001 </scale>
</mesh>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-10-18 18:09:20 -0500

Seen: 14,427 times

Last updated: Oct 19 '17