From: ahoward <ah...@us...> - 2004-12-01 17:56:02
|
On Sun, 28 Nov 2004, M.E. Ahiyya wrote: > I have a question about multiple interfaces in a > model. Is it possible to have multiple instances of > the same interface in a model? If so, is there an > example of this somewhere? If not, what do people > think would be the best way to go about implementing > this functionality? Thanks. Hi Mahalelel: The only difficulty with having multiple interfaces of the same type is working out a unique interface id. Generally speaking, interfaces simply take the id of the model they belong to, but this is not a strict requirement: you can easily add a unique suffix to distinguish the interfaces. For example, say you have a robot with two position interfaces; you can always do something like this: myrobot.world: <model:myrobot> <id>robot1</id> ... <model:/myrobot> MyRobot.cc: snprintf(id, sizeof(id), "%s_foo", this->GetId()); gz_position_create(this->foo_iface, this->world->gz_server, id, ...) snprintf(id, sizeof(id), "%s_bar", this->GetId()); gz_position_create(this->bar_iface, this->world->gz_server, id, ...) On the libgazebo/Player side, you would access these two interfaces using the gz_ids "robot1_foo" and "robot1_bar" respectively. A. Andrew Howard email: ah...@po... Department of Computer Science http: www-robotics.usc.edu/~ahoward University of Southern California phone: 1 (213) 740 6416 Los Angeles, CA, U.S.A. 90089-0781 fax: 1 (213) 821 5696 << Insert pithy saying here >>> |