Skip to first unread message

Pedro Nobre

unread,
Aug 25, 2016, 10:11:25 AM8/25/16
to ns-3-users
Hey guys,
I'm developing a NS3 App with an ad-hoc network, and I need the app installed in the nodes to be aware of the node's coordinates. I know that a way to obtain this, is using something like this:

Ptr<MobilityModel> mob = GetNode()->GetObject<MobilityModel>();
Vector pos = mob->GetPosition();

My problem is that the node app does not have access to the nodecontainer, nor the pointer to the node required to get the correspondent location. My node application is in a different class from where it's mobility is set up. 
How can I solve this ?
Thank you in advance
Pedro

Konstantinos

unread,
Aug 25, 2016, 10:18:59 AM8/25/16
to ns-3-users
Hi,

The application is installed on the node and the method you have posted (GetNode) will give you a pointer to the node.

PtrNode > GetNode () const

Perhaps you are missing "this->GetNode()", where "this" refers to the Application instance you are working.

beletu dagne

unread,
Oct 22, 2019, 7:27:39 AM10/22/19
to ns-3-users
Reply all
Reply to author
Forward
0 new messages