Gazebo | Ignition | Community
Ask Your Question

It's possible get a model link from other model?

asked 2018-03-22 12:33:58 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi there,

I'am writing a plugin for Gazebo and my question is if is possible get a model link from other model? With none relationship between them, no child or parent. Some thing like this:

hydrophone_pos = this->link->GetWorldPose().Ign().Pos();

beacon_pos = this->beacon_link->GetWorldPose().Ign().Pos();


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-22 17:58:41 -0500

chapulina gravatar image

First get the world:

auto world = this->GetWorld()

Then from the world get the other model:

auto beaconModel = world->GetModel("name_of_beacon_model")

Then get the link:

auto beaconLink = beaconModel->GetLink("name_of_beacon_link")

edit flag offensive delete link more


Thanks! It's works! :D

fredvaz gravatar imagefredvaz ( 2018-03-23 12:25:34 -0500 )edit

Question Tools

1 follower


Asked: 2018-03-22 12:33:58 -0500

Seen: 202 times

Last updated: Mar 22 '18