A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::RandomWaypointMobilityModel Class Reference

Random waypoint mobility model. More...

#include <random-waypoint-mobility-model.h>

+ Inheritance diagram for ns3::RandomWaypointMobilityModel:
+ Collaboration diagram for ns3::RandomWaypointMobilityModel:

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::RandomWaypointMobilityModel.

Protected Member Functions

virtual void DoStart (void)
- Protected Member Functions inherited from ns3::MobilityModel
void NotifyCourseChange (void) const
- Protected Member Functions inherited from ns3::Object
 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< RandomVariableStreamm_pause
Ptr< PositionAllocatorm_position
Ptr< RandomVariableStreamm_speed

Additional Inherited Members

- Public Member Functions inherited from ns3::MobilityModel
 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)

Detailed Description

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.

Definition at line 52 of file random-waypoint-mobility-model.h.

Member Function Documentation

int64_t ns3::RandomWaypointMobilityModel::DoAssignStreams ( int64_t  stream)
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().

+ Here is the call graph for this function:

Vector ns3::RandomWaypointMobilityModel::DoGetPosition ( void  ) const
privatevirtual

Definition at line 98 of file random-waypoint-mobility-model.cc.

References ns3::ConstantVelocityHelper::GetCurrentPosition(), m_helper, and ns3::ConstantVelocityHelper::Update().

+ Here is the call graph for this function:

Vector ns3::RandomWaypointMobilityModel::DoGetVelocity ( void  ) const
privatevirtual

Definition at line 111 of file random-waypoint-mobility-model.cc.

References ns3::ConstantVelocityHelper::GetVelocity(), and m_helper.

+ Here is the call graph for this function:

void ns3::RandomWaypointMobilityModel::DoSetPosition ( const Vector position)
privatevirtual
void ns3::RandomWaypointMobilityModel::DoStart ( void  )
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().

+ Here is the call graph for this function:

void ns3::RandomWaypointMobilityModel::DoStartPrivate ( void  )
private
TypeId ns3::RandomWaypointMobilityModel::GetTypeId ( void  )
static

This method returns the TypeId associated to ns3::RandomWaypointMobilityModel.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/$ns3::MobilityModel/$ns3::RandomWaypointMobilityModel

Attributes defined for this type:

Attributes defined in parent class ns3::MobilityModel:

  • Position: The current position of the mobility model.
  • Velocity: The current velocity of the mobility model.

No TraceSources defined for this type.
TraceSources defined in parent class ns3::MobilityModel:

  • CourseChange: The value of the position and/or velocity vector changed

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().

+ Here is the call graph for this function:

Member Data Documentation

EventId ns3::RandomWaypointMobilityModel::m_event
private

Definition at line 70 of file random-waypoint-mobility-model.h.

Referenced by BeginWalk(), DoSetPosition(), and DoStartPrivate().

ConstantVelocityHelper ns3::RandomWaypointMobilityModel::m_helper
private
Ptr<RandomVariableStream> ns3::RandomWaypointMobilityModel::m_pause
private

Definition at line 69 of file random-waypoint-mobility-model.h.

Referenced by DoAssignStreams(), DoStartPrivate(), and GetTypeId().

Ptr<PositionAllocator> ns3::RandomWaypointMobilityModel::m_position
private

Definition at line 67 of file random-waypoint-mobility-model.h.

Referenced by BeginWalk(), DoAssignStreams(), and GetTypeId().

Ptr<RandomVariableStream> ns3::RandomWaypointMobilityModel::m_speed
private

Definition at line 68 of file random-waypoint-mobility-model.h.

Referenced by BeginWalk(), DoAssignStreams(), and GetTypeId().


The documentation for this class was generated from the following files: