From 6951f13ce4fee55cd9241681d0a7caee7c91fe2c Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Fri, 28 Sep 2007 19:13:19 +0100 Subject: [PATCH] On course-change, print velocity in addition to position. --- samples/main-random-walk.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/samples/main-random-walk.cc b/samples/main-random-walk.cc index b1b542c17..cccd64936 100644 --- a/samples/main-random-walk.cc +++ b/samples/main-random-walk.cc @@ -16,11 +16,13 @@ using namespace ns3; static void -CourseChange (ns3::TraceContext const&, Ptr position) +CourseChange (ns3::TraceContext const&, Ptr mobility) { - Position pos = position->Get (); - std::cout << Simulator::Now () << ", pos=" << position << ", x=" << pos.x << ", y=" << pos.y - << ", z=" << pos.z << std::endl; + Position pos = mobility->Get (); + Speed vel = mobility->GetSpeed (); + std::cout << Simulator::Now () << ", model=" << mobility << ", POS: x=" << pos.x << ", y=" << pos.y + << ", z=" << pos.z << "; VEL:" << vel.dx << ", y=" << vel.dy + << ", z=" << vel.dz << std::endl; } int main (int argc, char *argv[])