Create model during runtime
Hello,
is there a way to create a model during runtime? I've created a little GUI overlay plugin with a button and some other elements. If the button is pressed i want to create some cylinders in the scene that are connected by joints at specified positions with specified dimensions. The position and size of the cylinders are not known during startup of Gazebo, so i don't want to use SDF files as used in most tutorials.
I've tried to find tutorials or a way to create models during runtime, but couldn't find anything. Is there a way to solve my problem?
Maybe i could create a string, that looks like a SDF file, as in this tutorial: http://gazebosim.org/tutorials?tut=gu... But i hope there is a better way, because the creation of such a string that simulates a SDF file with a couple of calculated parameters, that need to be used, would be complex and not very convenient. Maybe there are some already existing methods of gazebo, like (pseudocode): "createCylinder(position, radius, length); addJoint(cylinder, jointType); ...."
Thank you very much, skmCry
I'm actually interested in doing this as well... I think if we start looking at the model editor code we will find the examples we want. the path from the root of gazebo is `gazebo/gui/model/`
I'm actually interested in doing this as well... I think if we start looking at the model editor code we will find the examples we want. the path from the root of gazebo is ```gazebo/gui/model/```
The model editor uses SDF as well, see this: https://bitbucket.org/osrf/gazebo/src/411807a3a83074ef00bea1482a62d81775003e28/gazebo/gui/model/ModelCreator.cc?fileviewer=file-view-default#ModelCreator.cc-1435 You don't necessarily have to handle a string. You can have an `sdf::ElementPtr` and manipulate its attributes with the SDF API: http://osrf-distributions.s3.amazonaws.com/sdformat/api/dev/classsdf_1_1Element.html