Random waypoint mobility model. More...
#include <random-waypoint-mobility-model.h>
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Protected Member Functions | |
virtual void | DoStart (void) |
![]() | |
void | NotifyCourseChange (void) const |
![]() | |
Object (const Object &o) | |
virtual void | DoDispose (void) |
virtual void | NotifyNewAggregate (void) |
Private Member Functions | |
void | BeginWalk (void) |
virtual int64_t | DoAssignStreams (int64_t) |
virtual Vector | DoGetPosition (void) const |
virtual Vector | DoGetVelocity (void) const |
virtual void | DoSetPosition (const Vector &position) |
void | DoStartPrivate (void) |
Private Attributes | |
EventId | m_event |
ConstantVelocityHelper | m_helper |
Ptr< RandomVariableStream > | m_pause |
Ptr< PositionAllocator > | m_position |
Ptr< RandomVariableStream > | m_speed |
Additional Inherited Members | |
![]() | |
MobilityModel () | |
virtual | ~MobilityModel ()=0 |
int64_t | AssignStreams (int64_t stream) |
double | GetDistanceFrom (Ptr< const MobilityModel > position) const |
Vector | GetPosition (void) const |
double | GetRelativeSpeed (Ptr< const MobilityModel > other) const |
Vector | GetVelocity (void) const |
void | SetPosition (const Vector &position) |
Random waypoint mobility model.
Each object starts by pausing at time zero for the duration governed by the random variable "Pause". After pausing, the object will pick a new waypoint (via the PositionAllocator) and a new random speed via the random variable "Speed", and will begin moving towards the waypoint at a constant speed. When it reaches the destination, the process starts over (by pausing).
This mobility model enforces no bounding box by itself; the PositionAllocator assigned to this object will bound the movement. If the user fails to provide a pointer to a PositionAllocator to be used to pick waypoints, the simulation program will assert.
The implementation of this model is not 2d-specific. i.e. if you provide a 3d random waypoint position model to this mobility model, the model will still work. There is no 3d position allocator for now but it should be trivial to add one.
ns3::RandomWaypointMobilityModel is accessible through the following paths with Config::Set and Config::Connect:
No TraceSources are defined for this type.
Definition at line 52 of file random-waypoint-mobility-model.h.
|
private |
Definition at line 59 of file random-waypoint-mobility-model.cc.
References ns3::CalculateDistance(), ns3::EventId::Cancel(), DoStartPrivate(), ns3::ConstantVelocityHelper::GetCurrentPosition(), ns3::PositionAllocator::GetNext(), ns3::RandomVariableStream::GetValue(), m_event, m_helper, m_position, m_speed, ns3::MobilityModel::NotifyCourseChange(), NS_ASSERT_MSG, ns3::Simulator::Schedule(), ns3::Seconds(), ns3::ConstantVelocityHelper::SetVelocity(), ns3::ConstantVelocityHelper::Unpause(), ns3::ConstantVelocityHelper::Update(), ns3::Vector3D::x, ns3::Vector3D::y, and ns3::Vector3D::z.
Referenced by DoStartPrivate().
|
privatevirtual |
Definition at line 116 of file random-waypoint-mobility-model.cc.
References ns3::PositionAllocator::AssignStreams(), m_pause, m_position, m_speed, NS_ASSERT_MSG, and ns3::RandomVariableStream::SetStream().
|
privatevirtual |
Definition at line 98 of file random-waypoint-mobility-model.cc.
References ns3::ConstantVelocityHelper::GetCurrentPosition(), m_helper, and ns3::ConstantVelocityHelper::Update().
|
privatevirtual |
Definition at line 111 of file random-waypoint-mobility-model.cc.
References ns3::ConstantVelocityHelper::GetVelocity(), and m_helper.
|
privatevirtual |
Definition at line 104 of file random-waypoint-mobility-model.cc.
References DoStartPrivate(), m_event, m_helper, ns3::Simulator::Remove(), ns3::Simulator::ScheduleNow(), and ns3::ConstantVelocityHelper::SetPosition().
|
protectedvirtual |
This method is called only once by Object::Start. If the user calls Object::Start multiple times, DoStart is called only the first time.
Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject and AggregateObject from within this method.
Reimplemented from ns3::Object.
Definition at line 81 of file random-waypoint-mobility-model.cc.
References DoStartPrivate().
|
private |
Definition at line 88 of file random-waypoint-mobility-model.cc.
References BeginWalk(), ns3::RandomVariableStream::GetValue(), m_event, m_helper, m_pause, ns3::MobilityModel::NotifyCourseChange(), ns3::ConstantVelocityHelper::Pause(), ns3::Simulator::Schedule(), ns3::Seconds(), and ns3::ConstantVelocityHelper::Update().
Referenced by BeginWalk(), DoSetPosition(), and DoStart().
|
static |
Reimplemented from ns3::MobilityModel.
Definition at line 33 of file random-waypoint-mobility-model.cc.
References m_pause, m_position, m_speed, and ns3::TypeId::SetParent().
|
private |
Definition at line 70 of file random-waypoint-mobility-model.h.
Referenced by BeginWalk(), DoSetPosition(), and DoStartPrivate().
|
private |
Definition at line 66 of file random-waypoint-mobility-model.h.
Referenced by BeginWalk(), DoGetPosition(), DoGetVelocity(), DoSetPosition(), and DoStartPrivate().
|
private |
Definition at line 69 of file random-waypoint-mobility-model.h.
Referenced by DoAssignStreams(), DoStartPrivate(), and GetTypeId().
|
private |
Definition at line 67 of file random-waypoint-mobility-model.h.
Referenced by BeginWalk(), DoAssignStreams(), and GetTypeId().
|
private |
Definition at line 68 of file random-waypoint-mobility-model.h.
Referenced by BeginWalk(), DoAssignStreams(), and GetTypeId().