Creating custom models
Hello,
I want to create world files (having some obstacles in it). As an example of the world/environment, please consider the attached image. Please note that some polygons in the image are not rectangles.
To create this environment, from what I understand, I can create sdf files of each of the polygons in the image and create a world where I will include these polygons.
Doubt: how to create the sdf files of the polygons which are not rectangles.
Please do tell if the question is not clear. Thanks in advance.
Edit 1: I would appreciate if the solution is as less cumbersome as possible while implementing for a large number of images. Thank you.
Asked by trishantroy on 2019-07-23 13:33:54 UTC
Answers
You can create complex models and shapes using Blender or Sketchup and exporting the mesh as a .dae file. Then you would need to create a folder for the model in your models directory and include a model.config and model.sdf files. You can view the structure of these files here: http://gazebosim.org/tutorials?tut=model_structure&cat=build_robot
For example, take a look at the mcity model in the car_demo repo: https://github.com/osrf/car_demo/tree/master/car_demo/models/mcity
Once you create your model folder and files, you can just include them at their position in the world file.
Related question: https://answers.ros.org/question/220484/how-to-create-custom-models-and-include-that-in-world-file/
Asked by bhej on 2019-07-23 13:44:40 UTC
Comments
Thanks a lot for the answer and the relevant links. But, is there a way to do this without using software where I would have to manually create the object and import the mesh file? Is there a workaround for this? Basically, it would be easier if there is a way to generate mesh (for simple polygons) by just giving the vertices' coordinates through code?
Asked by trishantroy on 2019-07-23 14:12:28 UTC
What about this?
One can use the existing nist_maze_wall_120 model as walls for making the 3D polygons.
Though this may be the solution for this specific problem. Definitely, the solution suggested by @bhej is for general situations.
Still curious about other solutions.
Asked by trishantroy on 2019-07-23 14:26:56 UTC
Is extruding SVG files enough for you? http://gazebosim.org/tutorials?tut=extrude_svg
Asked by chapulina on 2019-07-23 14:29:03 UTC
Yes. This is a great feature. Though, I am looking for a solution which is less cumbersome to implement in case of a large number of images like these. Thanks a lot @chapulina
Asked by trishantroy on 2019-07-23 14:34:55 UTC
You can try using the <heightmap>
or <image>
tags in the SDF specification http://sdformat.org/spec?ver=1.6&elem=geometry
Check out this tutorial: https://github.com/AS4SR/general_info/wiki/Creating-Heightmaps-for-Gazebo and http://gazebosim.org/tutorials/?tut=dem
If your image is black and white as the one you provided, then this solution may be ideal for your case.
Asked by bhej on 2019-07-23 14:51:16 UTC
Great solution! I checked the video in the Github link. I will implement and post the remarks. Thanks a lot!
Asked by trishantroy on 2019-07-23 15:07:52 UTC
Comments