Ask Your Question
0

gazebo model dynamically modified by programming

asked 2011-03-15 01:32:21 -0500

sam gravatar image

Hi, How to modify the model in gazebo like stl file by C or C++? Example: I load a face model on gazebo, and I want to revise small portion of face model (lips) when speaking. How to do that? Is there any tutorials? I have found the gazebo Model Creation Tutorial http://playerstage.sourceforge.net/do... But it's in XML format,so how I can change it by programming? I can't find any information about that. Thank you~

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-06-07 08:57:37 -0500

scribbleink gravatar image

Hi sam,

A while back, I was trying something similar (walking legs), but I had to abandon it. Perhaps what I found could be of help, but I should warn you, my approach is rather hacky.

Gazebo runs as a server and you can connect to it using the client/server interfaces in libgazebo. The documentation with an example is available in the Gazebo manual.

Also, the ROS wrapper for gazebo very nicely uses these interfaces to expose some topics and services in ROS. You can find the code on your machine at this path:

$(find gazebo)/src/gazeboros.cpp
Specifically, you might want to look at functions used to retrieve and manipulate models at run-time:
gazebo::Model* model = dynamic_cast< gazebo::Model*>gazebo::World::Instance()->GetEntityByName(your_model_name));
const std::vector< gazebo::Entity*> children = model->GetChildren();
// iterate using variable 'iter'
gazebo::Body* body = dynamic_cast< gazebo::Body*>(*iter);
const std::map< std::string, gazebo::Geom* >* geoms = body->GetGeoms();
// magic happens here

Sorry I didn't get any further, but I'm interested in what you find.

Best,
Nikhil

PS: The model and entity names should be carefully specified to match the XML file that is loaded.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-03-15 01:32:21 -0500

Seen: 1,005 times

Last updated: Jun 07 '11