Programmatic Model Creation - Model is visible in world but cannot be queried

asked 2013-12-16 18:24:51 -0500

James Taylor gravatar image

updated 2013-12-16 18:25:09 -0500

I have programmaticaly generated a model using sdf::SDF. I can load the model into the world using gazebo::physics::World.InsertModelSDF or InsertModelString, and the loaded model is visible and involved in dynamics. However, the model cannot be retrieved using gazebo::physics::World.GetModel( name ), is not listed in the Model_V vector from GetModels, and does not show up when PrintEntityTree is invoked.

I can successfully access the model if I make this a multistage process where I generate the model then write the sdf data to a file, then launch gazebo with a world configuration that uses this model as if it is any other model file. However, I would prefer to be able to attach the programmatic model instead rather than have the additional overhead of generating a file in a separate program, building the model file structure, altering the world file, and then launching gazebo.

I have tried everything obvious to make the programmatic model work and the sdf definition is correct as evidenced by loading from disk works. What World method(s) must be invoked after building the sdf definition and inserting it into the World instance to properly register the model such that it can be accessed like any other model instance?

For reference, this is gazebo 1.8.6.

edit retag flag offensive close merge delete


Can you post a copy of your model somewhere so that we can try to reproduce the error?

scpeters gravatar imagescpeters ( 2013-12-18 18:33:35 -0500 )edit