INET Framework for OMNeT++/OMNEST
inet::RandomWaypointMobility Class Reference

Random Waypoint mobility model. More...

#include <RandomWaypointMobility.h>

Inheritance diagram for inet::RandomWaypointMobility:
inet::LineSegmentsMobilityBase inet::MovingMobilityBase inet::MobilityBase inet::IMobility

Public Member Functions

 RandomWaypointMobility ()
 
virtual double getMaxSpeed () const override
 Returns the maximum possible speed at any future time. More...
 
- Public Member Functions inherited from inet::LineSegmentsMobilityBase
 LineSegmentsMobilityBase ()
 
- Public Member Functions inherited from inet::MovingMobilityBase
virtual const CoordgetCurrentPosition () override
 Returns the position at the current simulation time. More...
 
virtual const CoordgetCurrentVelocity () override
 Returns the velocity at the current simulation time. More...
 
virtual const CoordgetCurrentAcceleration () override
 Returns the acceleration at the current simulation time. More...
 
virtual const QuaterniongetCurrentAngularPosition () override
 Returns the angular position at the current simulation time. More...
 
virtual const QuaterniongetCurrentAngularVelocity () override
 Returns the angular velocity at the current simulation time. More...
 
virtual const QuaterniongetCurrentAngularAcceleration () override
 Returns the angular acceleration at the current simulation time. More...
 
- Public Member Functions inherited from inet::MobilityBase
virtual const CoordgetConstraintAreaMax () const override
 Returns the maximum position along each axes for. More...
 
virtual const CoordgetConstraintAreaMin () const override
 Returns the minimum position along each axes for. More...
 
- Public Member Functions inherited from inet::IMobility
virtual ~IMobility ()
 

Protected Member Functions

virtual int numInitStages () const override
 Returns the required number of initialize stages. More...
 
virtual void initialize (int stage) override
 Initializes mobility model parameters. More...
 
virtual void setTargetPosition () override
 Overridden from LineSegmentsMobilityBase. More...
 
virtual void move () override
 Overridden from LineSegmentsMobilityBase. More...
 
- Protected Member Functions inherited from inet::LineSegmentsMobilityBase
virtual void initializePosition () override
 Initializes mobility position. More...
 
- Protected Member Functions inherited from inet::MovingMobilityBase
 MovingMobilityBase ()
 
virtual ~MovingMobilityBase ()
 
virtual void handleSelfMessage (cMessage *message) override
 Called upon arrival of a self messages, subclasses must override. More...
 
void scheduleUpdate ()
 Schedules the move timer that will update the mobility state. More...
 
void moveAndUpdate ()
 Moves and notifies listeners. More...
 
virtual void orient ()
 
- Protected Member Functions inherited from inet::MobilityBase
 MobilityBase ()
 
virtual int getId () const override
 
virtual void setInitialPosition ()
 Initializes the position from the display string or from module parameters. More...
 
virtual void checkPosition ()
 Checks whether the position is valid or not. More...
 
virtual void initializeOrientation ()
 Initializes the orientation from module parameters. More...
 
virtual void refreshDisplay () const override
 Moves the visual representation module's icon to the new position on the screen. More...
 
virtual void updateDisplayStringFromMobilityState () const
 
virtual void handleParameterChange (const char *name) override
 Allows changing parameters from the GUI. More...
 
virtual void handleMessage (cMessage *msg) override
 This modules should only receive self-messages. More...
 
virtual void emitMobilityStateChangedSignal ()
 Emits a signal with the updated mobility state. More...
 
virtual Coord getRandomPosition ()
 Returns a new random position satisfying the constraint area. More...
 
virtual cModule * findSubjectModule ()
 Returns the module that represents the object moved by this mobility module. More...
 
virtual bool isOutside ()
 Returns true if the mobility is outside of the constraint area. More...
 
virtual void reflectIfOutside (Coord &targetPosition, Coord &velocity, rad &angle, rad &elevation, Quaternion &quaternion)
 Utility function to reflect the node if it goes outside the constraint area. More...
 
virtual void wrapIfOutside (Coord &targetPosition)
 Utility function to wrap the node to the opposite edge (torus) if it goes outside the constraint area. More...
 
virtual void placeRandomlyIfOutside (Coord &targetPosition)
 Utility function to place the node randomly if it goes outside the constraint area. More...
 
virtual void raiseErrorIfOutside ()
 Utility function to raise an error if the node gets outside the constraint area. More...
 
virtual void handleIfOutside (BorderPolicy policy, Coord &targetPosition, Coord &velocity)
 Invokes one of reflectIfOutside(), wrapIfOutside() and placeRandomlyIfOutside(), depending on the given border policy. More...
 
virtual void handleIfOutside (BorderPolicy policy, Coord &targetPosition, Coord &velocity, rad &heading)
 
virtual void handleIfOutside (BorderPolicy policy, Coord &targetPosition, Coord &velocity, rad &heading, rad &elevation)
 
virtual void handleIfOutside (BorderPolicy policy, Coord &targetPosition, Coord &velocity, rad &heading, rad &elevation, Quaternion &quaternion)
 

Protected Attributes

bool nextMoveIsWait
 
cPar * speedParameter = nullptr
 
cPar * waitTimeParameter = nullptr
 
bool hasWaitTime
 
- Protected Attributes inherited from inet::LineSegmentsMobilityBase
Coord targetPosition
 End position of current linear movement. More...
 
- Protected Attributes inherited from inet::MovingMobilityBase
cMessage * moveTimer
 The message used for mobility state changes. More...
 
simtime_t updateInterval
 The simulation time interval used to regularly signal mobility state changes. More...
 
bool stationary
 A mobility model may decide to become stationary at any time. More...
 
Coord lastVelocity
 The last velocity that was reported at lastUpdate. More...
 
Quaternion lastAngularVelocity
 The last angular velocity that was reported at lastUpdate. More...
 
simtime_t lastUpdate
 The simulation time when the mobility state was last updated. More...
 
simtime_t nextChange
 The next simulation time when the mobility module needs to update its internal state. More...
 
bool faceForward
 
- Protected Attributes inherited from inet::MobilityBase
cModule * subjectModule
 Pointer to visual representation module, to speed up repeated access. More...
 
const CanvasProjectioncanvasProjection
 The 2D projection used on the canvas. More...
 
Coord constraintAreaMin
 3 dimensional position and size of the constraint area (in meters). More...
 
Coord constraintAreaMax
 
Coord lastPosition
 The last position that was reported. More...
 
Quaternion lastOrientation
 The last orientation that was reported. More...
 
StringFormat format
 

Additional Inherited Members

- Public Types inherited from inet::MobilityBase
enum  BorderPolicy { REFLECT, WRAP, PLACERANDOMLY, RAISEERROR }
 Selects how a mobility module should behave if it reaches the edge of the constraint area. More...
 
- Static Public Attributes inherited from inet::IMobility
static simsignal_t mobilityStateChangedSignal = cComponent::registerSignal("mobilityStateChanged")
 A signal used to publish mobility state changes. More...
 

Detailed Description

Random Waypoint mobility model.

See NED file for more info.

Author
Georg Lutz (georglutz AT gmx DOT de), Institut fuer Telematik, Universitaet Karlsruhe, http://www.tm.uka.de, 2004-2005

Constructor & Destructor Documentation

◆ RandomWaypointMobility()

inet::RandomWaypointMobility::RandomWaypointMobility ( )
16 {
17  nextMoveIsWait = false;
18 }

Member Function Documentation

◆ getMaxSpeed()

double inet::RandomWaypointMobility::getMaxSpeed ( ) const
overridevirtual

Returns the maximum possible speed at any future time.

Reimplemented from inet::MobilityBase.

56 {
57  return speedParameter->isExpression() ? NaN : speedParameter->doubleValue();
58 }

◆ initialize()

void inet::RandomWaypointMobility::initialize ( int  stage)
overrideprotectedvirtual

Initializes mobility model parameters.

Reimplemented from inet::MovingMobilityBase.

21 {
23 
24  if (stage == INITSTAGE_LOCAL) {
25  waitTimeParameter = &par("waitTime");
26  hasWaitTime = waitTimeParameter->isExpression() || waitTimeParameter->doubleValue() != 0;
27  speedParameter = &par("speed");
28  stationary = !speedParameter->isExpression() && speedParameter->doubleValue() == 0;
29  }
30 }

◆ move()

void inet::RandomWaypointMobility::move ( )
overrideprotectedvirtual

Overridden from LineSegmentsMobilityBase.

Reimplemented from inet::LineSegmentsMobilityBase.

◆ numInitStages()

virtual int inet::RandomWaypointMobility::numInitStages ( ) const
inlineoverrideprotectedvirtual

Returns the required number of initialize stages.

Reimplemented from inet::MobilityBase.

31 { return NUM_INIT_STAGES; }

◆ setTargetPosition()

void inet::RandomWaypointMobility::setTargetPosition ( )
overrideprotectedvirtual

Overridden from LineSegmentsMobilityBase.

Implements inet::LineSegmentsMobilityBase.

33 {
34  if (nextMoveIsWait) {
35  simtime_t waitTime = waitTimeParameter->doubleValue();
36  nextChange = simTime() + waitTime;
37  nextMoveIsWait = false;
38  }
39  else {
41  double speed = speedParameter->doubleValue();
42  double distance = lastPosition.distance(targetPosition);
43  simtime_t travelTime = distance / speed;
44  nextChange = simTime() + travelTime;
46  }
47 }

Member Data Documentation

◆ hasWaitTime

bool inet::RandomWaypointMobility::hasWaitTime
protected

Referenced by initialize(), and setTargetPosition().

◆ nextMoveIsWait

bool inet::RandomWaypointMobility::nextMoveIsWait
protected

◆ speedParameter

cPar* inet::RandomWaypointMobility::speedParameter = nullptr
protected

◆ waitTimeParameter

cPar* inet::RandomWaypointMobility::waitTimeParameter = nullptr
protected

Referenced by initialize(), and setTargetPosition().


The documentation for this class was generated from the following files:
inet::MobilityBase::lastPosition
Coord lastPosition
The last position that was reported.
Definition: MobilityBase.h:73
inet::LineSegmentsMobilityBase::targetPosition
Coord targetPosition
End position of current linear movement.
Definition: LineSegmentsMobilityBase.h:28
inet::MovingMobilityBase::stationary
bool stationary
A mobility model may decide to become stationary at any time.
Definition: MovingMobilityBase.h:32
inet::Coord::distance
double distance(const Coord &a) const
Returns the distance to Coord 'a'.
Definition: Coord.h:251
inet::LineSegmentsMobilityBase::move
virtual void move() override
Moves according to the mobility model to the current simulation time.
Definition: LineSegmentsMobilityBase.cc:31
inet::RandomWaypointMobility::hasWaitTime
bool hasWaitTime
Definition: RandomWaypointMobility.h:28
inet::MovingMobilityBase::initialize
virtual void initialize(int stage) override
Initializes mobility model parameters.
Definition: MovingMobilityBase.cc:26
inet::MovingMobilityBase::nextChange
simtime_t nextChange
The next simulation time when the mobility module needs to update its internal state.
Definition: MovingMobilityBase.h:46
NaN
#define NaN
Definition: INETMath.h:91
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::RandomWaypointMobility::nextMoveIsWait
bool nextMoveIsWait
Definition: RandomWaypointMobility.h:25
inet::MobilityBase::raiseErrorIfOutside
virtual void raiseErrorIfOutside()
Utility function to raise an error if the node gets outside the constraint area.
Definition: MobilityBase.cc:343
NUM_INIT_STAGES
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
inet::RandomWaypointMobility::waitTimeParameter
cPar * waitTimeParameter
Definition: RandomWaypointMobility.h:27
inet::RandomWaypointMobility::speedParameter
cPar * speedParameter
Definition: RandomWaypointMobility.h:26
inet::MobilityBase::getRandomPosition
virtual Coord getRandomPosition()
Returns a new random position satisfying the constraint area.
Definition: MobilityBase.cc:251