Get Node Position from RandomWalk2d

888 views
Skip to first unread message

Fidbek

unread,
Jan 26, 2011, 12:05:23 PM1/26/11
to ns-3-users
Hi there!

I'm using RandomWalk2d Mobility Model.
Is there a way of get the position of each node?

Thanks,
Tomé

Rafael Fernandes Lopes

unread,
Jan 26, 2011, 1:10:13 PM1/26/11
to ns-3-...@googlegroups.com
Using the "Ptr<MobilityModel> mobility", you can get the position. You can use the following commands:

Ptr<MobilityModel> mob = nodes.Get(i)->GetObject<MobilityModel>();
Vector pos = mob->GetPosition ();
std::cout << "POS: x=" << pos.x << ", y=" << pos.y << std::endl;


Regards,


--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.




--
Rafael Fernandes Lopes
Lattes:  http://lattes.cnpq.br/1972734433460838
____________________________________________________________
Universidade Federal de Campina Grande -- UFCG
Unidade Acadêmica de Engenharia Elétrica -- UAEE
Instituto de Estudos Avançados em Comunicações -- IECOM
http://www.iecom.org.br

Instituto Federal de Educação, Ciência e Tecnologia do Maranhão -- IFMA
http://www.ifma.edu.br
____________________________________________________________
Reply all
Reply to author
Forward
0 new messages