void
PositionMonitor::ReportPosition ()
{
NodeContainer const & n = NodeContainer::GetGlobal ();
for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
{
Ptr<Node> node = *i;
std::string name = Names::FindName (node);
Ptr<MobilityModel> mob = node->GetObject<MobilityModel> ();
if (! mob) continue;
Vector pos = mob->GetPosition ();
PrintPosition (name, pos.x, pos.y);
Vector speed = mob->GetVelocity ();
double angle = 0;
if (speed.x == 0 && speed.y == 0 && speed.z == 0)
angle = -90;
else
angle = atan2 (-speed.y, speed.x) * 180 / M_PI;
PrintDirection (name, angle);
}
Simulator::Schedule (m_period, &PositionMonitor::ReportPosition, this);
}
Best regards,
Pavel
On Mon, Jan 31, 2011 at 5:56 AM, david arzola <arzo...@gmail.com> wrote:
> Hi, David. I'm making a mobility simulation in 3D. I want to know if
> someone knows how to see the positions of nodes every 0.5 sec (call
> function of position every half second) or so, because I would like
> to see in what position are the nodes and their speed.
>
> Thanks in advance.
>
> --
> 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.
>
>
Pavel
The votes you deserve;)
--