0
$\begingroup$

Rosanswers logo

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/doc/Gazebo-manual-svn-html/tutorial_model.html But it's in XML format,so how I can change it by programming? I can't find any information about that. Thank you~


Originally posted by sam on ROS Answers with karma: 2570 on 2011-03-15

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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_castgazebo::World::Instance()->GetEntityByName(your_model_name));
const std::vector children = model->GetChildren();
// iterate using variable 'iter'
gazebo::Body* body = dynamic_cast(*iter);
const std::map* 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.


Originally posted by scribbleink with karma: 116 on 2011-06-07

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

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