INET Framework for OMNeT++/OMNEST
inet::LinearRotatingMobilityBase Class Referenceabstract

#include <LinearRotatingMobilityBase.h>

Inheritance diagram for inet::LinearRotatingMobilityBase:
inet::RotatingMobilityBase inet::MobilityBase inet::IMobility

Public Member Functions

 LinearRotatingMobilityBase ()
 
- Public Member Functions inherited from inet::RotatingMobilityBase
virtual const QuaterniongetCurrentAngularPosition () override
 Returns the current angular position at the current simulation time. More...
 
virtual const QuaterniongetCurrentAngularVelocity () override
 Returns the current angular velocity at the current simulation time. More...
 
- Public Member Functions inherited from inet::MobilityBase
virtual double getMaxSpeed () const override
 Returns the maximum possible speed at any future time. More...
 
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 ()
 
virtual const CoordgetCurrentPosition ()=0
 Returns the position at the current simulation time. More...
 
virtual const CoordgetCurrentVelocity ()=0
 Returns the velocity at the current simulation time. More...
 
virtual const CoordgetCurrentAcceleration ()=0
 Returns the acceleration at the current simulation time. More...
 
virtual const QuaterniongetCurrentAngularAcceleration ()=0
 Returns the angular acceleration at the current simulation time. More...
 

Protected Member Functions

virtual void initializeOrientation () override
 Initializes the orientation from module parameters. More...
 
virtual void rotate () override
 Moves according to the mobility model to the current simulation time. More...
 
virtual void setTargetOrientation ()=0
 Should be redefined in subclasses. More...
 
- Protected Member Functions inherited from inet::RotatingMobilityBase
 RotatingMobilityBase ()
 
virtual ~RotatingMobilityBase ()
 
virtual void initialize (int stage) override
 Initializes mobility model parameters. More...
 
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 rotateAndUpdate ()
 Moves and notifies listeners. More...
 
- Protected Member Functions inherited from inet::MobilityBase
 MobilityBase ()
 
virtual int getId () const override
 
virtual int numInitStages () const override
 Returns the required number of initialize stages. More...
 
virtual void initializePosition ()
 Initializes mobility position. More...
 
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 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

Quaternion targetOrientation
 End position of current linear movement. More...
 
- Protected Attributes inherited from inet::RotatingMobilityBase
cMessage * rotateTimer
 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...
 
Quaternion lastAngularVelocity
 The last 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...
 
- 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...
 

Constructor & Destructor Documentation

◆ LinearRotatingMobilityBase()

inet::LinearRotatingMobilityBase::LinearRotatingMobilityBase ( )
13 {
14 }

Member Function Documentation

◆ initializeOrientation()

void inet::LinearRotatingMobilityBase::initializeOrientation ( )
overrideprotectedvirtual

Initializes the orientation from module parameters.

Reimplemented from inet::RotatingMobilityBase.

17 {
19  if (!stationary) {
21  EV_INFO << "current target orientation = " << targetOrientation << ", next change = " << nextChange << endl;
22  }
23  lastUpdate = simTime();
25 }

◆ rotate()

void inet::LinearRotatingMobilityBase::rotate ( )
overrideprotectedvirtual

Moves according to the mobility model to the current simulation time.

Subclasses must override and update lastPosition, lastVelocity, lastUpdate, nextChange and other state according to the mobility model.

Implements inet::RotatingMobilityBase.

28 {
29  simtime_t now = simTime();
30  if (now == nextChange) {
32  EV_INFO << "reached current target orientation = " << lastOrientation << endl;
34  EV_INFO << "new target orientation = " << targetOrientation << ", next change = " << nextChange << endl;
35  }
36  else if (now > lastUpdate) {
37  ASSERT(nextChange == -1 || now < nextChange);
38  double delta = (simTime() - lastUpdate).dbl() / (nextChange - lastUpdate).dbl();
40  }
41 }

◆ setTargetOrientation()

virtual void inet::LinearRotatingMobilityBase::setTargetOrientation ( )
protectedpure virtual

Should be redefined in subclasses.

This method gets called when targetOrientation and nextChange has been reached, and its task is to set a new targetOrientation and nextChange. At the end of the movement sequence, it should set nextChange to -1.

Referenced by initializeOrientation(), and rotate().

Member Data Documentation

◆ targetOrientation

Quaternion inet::LinearRotatingMobilityBase::targetOrientation
protected

End position of current linear movement.

Referenced by initializeOrientation(), and rotate().


The documentation for this class was generated from the following files:
inet::LinearRotatingMobilityBase::targetOrientation
Quaternion targetOrientation
End position of current linear movement.
Definition: LinearRotatingMobilityBase.h:19
inet::MobilityBase::lastOrientation
Quaternion lastOrientation
The last orientation that was reported.
Definition: MobilityBase.h:76
inet::RotatingMobilityBase::lastUpdate
simtime_t lastUpdate
The simulation time when the mobility state was last updated.
Definition: RotatingMobilityBase.h:35
inet::Quaternion::slerp
static Quaternion slerp(const Quaternion &q1, const Quaternion &q2, double t)
spherical linear interpolation
Definition: Quaternion.cc:89
inet::RotatingMobilityBase::stationary
bool stationary
A mobility model may decide to become stationary at any time.
Definition: RotatingMobilityBase.h:29
inet::RotatingMobilityBase::scheduleUpdate
void scheduleUpdate()
Schedules the move timer that will update the mobility state.
Definition: RotatingMobilityBase.cc:60
inet::LinearRotatingMobilityBase::setTargetOrientation
virtual void setTargetOrientation()=0
Should be redefined in subclasses.
inet::MobilityBase::initializeOrientation
virtual void initializeOrientation()
Initializes the orientation from module parameters.
Definition: MobilityBase.cc:176
inet::RotatingMobilityBase::nextChange
simtime_t nextChange
The next simulation time when the mobility module needs to update its internal state.
Definition: RotatingMobilityBase.h:40