I have referred some previous post here: https://groups.google.com/forum/#!msg/ns-3-users/P1m9AK66fsQ/vAybS8b_eJAJand I got the following codes for calling the SetVelocity method. It can compile well, but there's still no position changes of the stanodes being reported. Could you give me some hints on how to code this? Thanks a lot.ConstantVelocityHelper staVel;Vector spd (10.0,0.0,0.0);staVel.SetVelocity(spd);
mobility.SetMobilityModel ("ns3::ConstantVelocityMobilityModel",
"Velocity", VectorValue (spd));mobility.Install (wifiStaNodes);
在 2014年2月25日星期二UTC下午11时50分12秒,Konstantinos写道:
| private |
Used to alert subscribers that a change in direction, velocity, or position has occurred.
Definition at line 117 of file mobility-model.h.
Referenced by GetTypeId(), and NotifyCourseChange().
Hi Konstantinos,Sorry for the silly problems I asked. I am so unfamiliar with the programming style with NS3. However, I think I got you now. I have changed the codes without using the CourseChange method. Instead, I use the codes below to generate the position I want: (Ref: https://groups.google.com/forum/#!topic/ns-3-users/godXdo-NirY)Ptr<MobilityModel> mob = nodes.Get(i)->GetObject<MobilityModel>();
Vector pos = mob->GetPosition ();
std::cout << "POS: x=" << pos.x << ", y=" << pos.y << std::endl;
However, this could only report one position (either start position or end position after moving in a constant speed) when I put these codes before or after the command simulator:Run (); I am interested to report all the positions with some time interval that I want, for example, reported every 1second. So, how can I change the codes to make this possible?Thanks again for your help.
hi