0
$\begingroup$

Just got into Gazebo. As the title mention, when I created my model using model editor implemented in gazebo (ctrl+m), its center coordinate seems weird (floating above the model) causing it to spawn underground. I would like to set the center to the bottom mid of the model.

gazebo version 11.14.0

$\endgroup$
1
  • $\begingroup$ Please edit your post to explain exactly which "model editor" tool you are using. $\endgroup$
    – Mike973
    Commented Oct 14, 2023 at 16:01

1 Answer 1

0
$\begingroup$

If your model is whether a stl file or a dae you could use Blender to load your model and change the point of reference of the model wherever you want. A fast solution is to move an offset of height/2 if you don't want to edit the model.

Edit 1: I hadn't used the model editor from Gazebo as much as I would like to, but the idea is the same. When you create a model, it generates two archives. One called model.config and the other model.sdf.

The first one has information about the model author, email, sdf version, etc.

The second one (.sdf) is the one you are looking for to modify. As @JRTG suggested, you can edit manually an sdf, just make sure you are using the correct syntax. Please see this for information about SDF specification.

The idea of the model creator, is to use it in .world files using the include tag, so the pose of the model would be written before including the model. It depends of the model you have created.

This is an example of creating a model using Model Editor from Gazebo:

Box and Cylinder model

As you can see, the frame of the model is set in the middle of the box that contains both objects. And the only poses that were saved into the .config file were the relative poses of both objects to this frame, as shown here:

<?xml version='1.0'?>
<sdf version='1.6'>
  <model name='Untitledx'>
    <link name='link_5'>
      <more tags...>
      <pose frame=''>0.108124 -1.05903 0 0 -0 0</pose>
      <more tags...>
    </link>
    <link name='link_6'>
      <more tags...>
      <pose frame=''>-0.108124 1.05903 0 0 -0 0</pose>
      <more tags...>
    </link>
  </model>
</sdf>

In my opinion, I would give a try on using Blender, or just making yourself the model from scratch, it is not that hard, and writing the model grants you full control where you want everything to be set.

I encourage you to try with the SDF specification I attached before to modify the model in order to change the frame position, and if not ask again and I will give you more hints.

$\endgroup$
5
  • $\begingroup$ I used the model editor in gazebo, which it only genarates .config and .sdf file when saving models. $\endgroup$
    – brian2lee
    Commented Oct 17, 2023 at 6:21
  • $\begingroup$ You can just edit the sdf file, it's a text file. $\endgroup$
    – JRTG
    Commented Oct 17, 2023 at 8:27
  • $\begingroup$ @JRTG How do I edit it? I didn't saw anything mentioning the origin pose in the sdf file? Or do I need to edit every component one by one? $\endgroup$
    – brian2lee
    Commented Oct 24, 2023 at 3:47
  • $\begingroup$ Sorry for not answering before, I haven't checked that I couldn't write answers to questions till I got enough reputation. But I will try to solve your problem, as I did start the answer. Please see my Edited Answer $\endgroup$
    – ÁngeLoGa
    Commented Oct 24, 2023 at 6:27
  • $\begingroup$ "Or do I need to edit every component one by one? " You can just add <pose> x y z roll pitch yaw </pose> somewhere in the <model> </model> section and the full model wil be referred to that pose. If you want to specify angles in degrees, use <pose degrees="true"> x y z roll pitch yaw </pose>. $\endgroup$
    – JRTG
    Commented Oct 24, 2023 at 8:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.