INET Framework for OMNeT++/OMNEST
|
Abstract base class for mobility modules. More...
#include <MobilityBase.h>
Public Types | |
enum | BorderPolicy { REFLECT, WRAP, PLACERANDOMLY, RAISEERROR } |
Selects how a mobility module should behave if it reaches the edge of the constraint area. More... | |
Public Member Functions | |
virtual double | getMaxSpeed () const override |
Returns the maximum possible speed at any future time. More... | |
virtual EulerAngles | getCurrentAngularPosition () override |
Returns the current acceleration at the current simulation time. More... | |
virtual EulerAngles | getCurrentAngularSpeed () override |
Returns the current angular speed at the current simulation time. More... | |
virtual Coord | getConstraintAreaMax () const override |
Returns the current angular acceleration at the current simulation time. More... | |
virtual Coord | getConstraintAreaMin () const override |
Public Member Functions inherited from inet::IMobility | |
virtual | ~IMobility () |
virtual Coord | getCurrentPosition ()=0 |
Returns the current position at the current simulation time. More... | |
virtual Coord | getCurrentSpeed ()=0 |
Returns the current speed at the current simulation time. More... | |
Protected Member Functions | |
MobilityBase () | |
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 | 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 | initializeOrientation () |
Initializes the orientation from module parameters. More... | |
virtual void | handleMessage (cMessage *msg) override |
This modules should only receive self-messages. More... | |
virtual void | handleSelfMessage (cMessage *msg)=0 |
Called upon arrival of a self messages, subclasses must override. More... | |
virtual void | updateVisualRepresentation () |
Moves the visual representation module's icon to the new position on the screen. 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 * | findVisualRepresentation () |
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 &speed, double &angle) |
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 &speed, double &angle) |
Invokes one of reflectIfOutside(), wrapIfOutside() and placeRandomlyIfOutside(), depending on the given border policy. More... | |
Protected Attributes | |
cModule * | visualRepresentation |
Pointer to visual representation module, to speed up repeated access. More... | |
const CanvasProjection * | canvasProjection |
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... | |
EulerAngles | lastOrientation |
The last position that was reported. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from inet::IMobility | |
static simsignal_t | mobilityStateChangedSignal = cComponent::registerSignal("mobilityStateChanged") |
A signal used to publish mobility state changes. More... | |
Abstract base class for mobility modules.
Mobility modules inheriting from this base class may be stationary or may change their mobility state over simulation time. This base class only provides a few utility methods to handle some common tasks among mobility modules.
Subclasses must redefine handleSelfMessage() to update the mobility state and schedule the next update. Subclasses must also redefine initialize() to read their specific parameters and schedule the first update.
This base class also provides random initial placement as a default mechanism. After initialization the module updates the display and emits a signal to subscribers providing the mobility state. Receivers of this signal can query the mobility state through the IMobility interface.
Selects how a mobility module should behave if it reaches the edge of the constraint area.
|
protected |
|
protectedvirtual |
Checks whether the position is valid or not.
Referenced by initializePosition().
|
protectedvirtual |
Emits a signal with the updated mobility state.
Referenced by initializePosition(), inet::MovingMobilityBase::moveAndUpdate(), and inet::RotatingMobilityBase::rotateAndUpdate().
|
inlineprotectedvirtual |
Returns the module that represents the object moved by this mobility module.
Reimplemented in inet::MoBANCoordinator.
Referenced by initialize().
|
inlineoverridevirtual |
Returns the current angular acceleration at the current simulation time.
Implements inet::IMobility.
Reimplemented in inet::StationaryMobility.
|
inlineoverridevirtual |
Implements inet::IMobility.
Reimplemented in inet::StationaryMobility.
|
inlineoverridevirtual |
Returns the current acceleration at the current simulation time.
Returns the current angular position at the current simulation time.
Implements inet::IMobility.
Reimplemented in inet::MovingMobilityBase, and inet::RotatingMobilityBase.
|
inlineoverridevirtual |
Returns the current angular speed at the current simulation time.
Implements inet::IMobility.
Reimplemented in inet::RotatingMobilityBase.
|
inlineoverridevirtual |
Returns the maximum possible speed at any future time.
Implements inet::IMobility.
Reimplemented in inet::MoBANCoordinator, inet::MoBANLocal, inet::Ns2MotionMobility, inet::TurtleMobility, inet::BonnMotionMobility, inet::ANSimMobility, inet::MassMobility, inet::CircleMobility, inet::GaussMarkovMobility, inet::RectangleMobility, inet::TractorMobility, inet::ChiangMobility, inet::VehicleMobility, inet::RandomWPMobility, inet::ConstSpeedMobility, inet::StationaryMobility, and inet::LinearMobility.
|
protectedvirtual |
Returns a new random position satisfying the constraint area.
Referenced by placeRandomlyIfOutside(), inet::MoBANCoordinator::selectDestination(), setInitialPosition(), inet::RandomWPMobility::setTargetPosition(), and inet::ConstSpeedMobility::setTargetPosition().
|
protectedvirtual |
Invokes one of reflectIfOutside(), wrapIfOutside() and placeRandomlyIfOutside(), depending on the given border policy.
Referenced by inet::LinearMobility::move(), inet::ChiangMobility::move(), inet::GaussMarkovMobility::move(), inet::MassMobility::move(), inet::CircleMobility::move(), and inet::TurtleMobility::move().
|
overrideprotectedvirtual |
This modules should only receive self-messages.
|
protectedpure virtual |
Called upon arrival of a self messages, subclasses must override.
Implemented in inet::MovingMobilityBase, inet::RotatingMobilityBase, and inet::StationaryMobility.
Referenced by handleMessage().
|
overrideprotectedvirtual |
Initializes mobility model parameters.
Reimplemented in inet::MoBANCoordinator, inet::MoBANLocal, inet::Ns2MotionMobility, inet::MovingMobilityBase, inet::RotatingMobilityBase, inet::MassMobility, inet::TurtleMobility, inet::CircleMobility, inet::RectangleMobility, inet::LinearNodeDistributionMobility, inet::VehicleMobility, inet::BonnMotionMobility, inet::GaussMarkovMobility, inet::TractorMobility, inet::ANSimMobility, inet::ConstSpeedMobility, inet::LinearMobility, inet::ChiangMobility, and inet::RandomWPMobility.
Referenced by inet::LinearNodeDistributionMobility::initialize(), inet::RotatingMobilityBase::initialize(), and inet::MovingMobilityBase::initialize().
|
protectedvirtual |
Initializes the orientation from module parameters.
Reimplemented in inet::RotatingMobilityBase, and inet::LinearRotatingMobilityBase.
Referenced by initialize(), inet::LinearRotatingMobilityBase::initializeOrientation(), and inet::RotatingMobilityBase::initializeOrientation().
|
protectedvirtual |
Initializes mobility position.
Reimplemented in inet::MovingMobilityBase, and inet::LineSegmentsMobilityBase.
Referenced by initialize(), inet::LineSegmentsMobilityBase::initializePosition(), and inet::MovingMobilityBase::initializePosition().
|
protectedvirtual |
Returns true if the mobility is outside of the constraint area.
Referenced by checkPosition(), placeRandomlyIfOutside(), and raiseErrorIfOutside().
|
inlineoverrideprotectedvirtual |
Returns the required number of initialize stages.
Reimplemented in inet::MoBANCoordinator, inet::MoBANLocal, inet::Ns2MotionMobility, inet::MassMobility, inet::TurtleMobility, inet::CircleMobility, inet::LinearNodeDistributionMobility, inet::BonnMotionMobility, inet::GaussMarkovMobility, inet::RectangleMobility, inet::TractorMobility, inet::ANSimMobility, inet::ConstSpeedMobility, inet::LinearMobility, inet::ChiangMobility, and inet::RandomWPMobility.
|
protectedvirtual |
Utility function to place the node randomly if it goes outside the constraint area.
Decision is made on lastPosition, but targetPosition will also be updated. (Pass a dummy you don't have it).
Referenced by handleIfOutside().
|
protectedvirtual |
Utility function to raise an error if the node gets outside the constraint area.
Referenced by handleIfOutside(), inet::RandomWPMobility::move(), inet::ANSimMobility::move(), inet::BonnMotionMobility::move(), and inet::Ns2MotionMobility::move().
|
protectedvirtual |
Utility function to reflect the node if it goes outside the constraint area.
Decision is made on pos, but the variables passed as args will also be updated. (Pass dummies you don't have some of them).
Referenced by handleIfOutside().
|
protectedvirtual |
Initializes the position from the display string or from module parameters.
Reimplemented in inet::MoBANCoordinator, inet::MoBANLocal, inet::Ns2MotionMobility, inet::TurtleMobility, inet::CircleMobility, inet::RectangleMobility, inet::LinearNodeDistributionMobility, inet::BonnMotionMobility, inet::TractorMobility, inet::ANSimMobility, inet::VehicleMobility, inet::StaticConcentricMobility, and inet::StaticGridMobility.
Referenced by initializePosition(), inet::RectangleMobility::setInitialPosition(), and inet::TurtleMobility::setInitialPosition().
|
protectedvirtual |
Moves the visual representation module's icon to the new position on the screen.
Reimplemented in inet::MoBANLocal.
Referenced by initializePosition(), inet::MovingMobilityBase::moveAndUpdate(), and inet::RotatingMobilityBase::rotateAndUpdate().
|
protectedvirtual |
Utility function to wrap the node to the opposite edge (torus) if it goes outside the constraint area.
Decision is made on pos, but targetPosition will also be updated. (Pass a dummy you don't have it).
Referenced by handleIfOutside().
|
protected |
The 2D projection used on the canvas.
Referenced by initialize(), and updateVisualRepresentation().
|
protected |
Referenced by checkPosition(), getRandomPosition(), inet::TurtleMobility::getValue(), inet::RectangleMobility::initialize(), initialize(), isOutside(), inet::RectangleMobility::move(), inet::GaussMarkovMobility::preventBorderHugging(), raiseErrorIfOutside(), reflectIfOutside(), inet::LinearNodeDistributionMobility::setInitialPosition(), and wrapIfOutside().
|
protected |
3 dimensional position and size of the constraint area (in meters).
Referenced by checkPosition(), getRandomPosition(), inet::TurtleMobility::getValue(), inet::RectangleMobility::initialize(), initialize(), isOutside(), inet::RectangleMobility::move(), inet::GaussMarkovMobility::preventBorderHugging(), raiseErrorIfOutside(), reflectIfOutside(), inet::StaticGridMobility::setInitialPosition(), inet::StaticConcentricMobility::setInitialPosition(), and wrapIfOutside().
|
protected |
The last position that was reported.
Referenced by inet::RotatingMobilityBase::getCurrentAngularPosition(), inet::MovingMobilityBase::getCurrentAngularPosition(), initializeOrientation(), inet::MovingMobilityBase::moveAndUpdate(), and inet::LinearRotatingMobilityBase::rotate().
|
protected |
The last position that was reported.
Referenced by checkPosition(), inet::TurtleMobility::executeStatement(), inet::LinearNodeDistributionMobility::finish(), inet::MovingMobilityBase::getCurrentPosition(), initialize(), inet::MoBANCoordinator::initialize(), inet::LineSegmentsMobilityBase::initializePosition(), isOutside(), inet::LineSegmentsMobilityBase::move(), inet::LinearMobility::move(), inet::VehicleMobility::move(), inet::RectangleMobility::move(), inet::MassMobility::move(), inet::CircleMobility::move(), placeRandomlyIfOutside(), inet::GaussMarkovMobility::preventBorderHugging(), raiseErrorIfOutside(), inet::MoBANCoordinator::readConfigurationFile(), reflectIfOutside(), inet::TurtleMobility::resumeScript(), inet::MoBANCoordinator::selectDestination(), inet::MoBANCoordinator::selectPosture(), inet::StaticGridMobility::setInitialPosition(), inet::StaticConcentricMobility::setInitialPosition(), inet::VehicleMobility::setInitialPosition(), inet::ANSimMobility::setInitialPosition(), inet::BonnMotionMobility::setInitialPosition(), inet::TractorMobility::setInitialPosition(), inet::LinearNodeDistributionMobility::setInitialPosition(), inet::TurtleMobility::setInitialPosition(), inet::Ns2MotionMobility::setInitialPosition(), inet::MoBANLocal::setInitialPosition(), setInitialPosition(), inet::MoBANLocal::setMoBANParameters(), inet::RandomWPMobility::setTargetPosition(), inet::ConstSpeedMobility::setTargetPosition(), inet::ChiangMobility::setTargetPosition(), inet::ANSimMobility::setTargetPosition(), inet::BonnMotionMobility::setTargetPosition(), inet::TractorMobility::setTargetPosition(), inet::GaussMarkovMobility::setTargetPosition(), inet::MassMobility::setTargetPosition(), inet::Ns2MotionMobility::setTargetPosition(), inet::MoBANLocal::setTargetPosition(), inet::MoBANCoordinator::setTargetPosition(), inet::MoBANLocal::updateVisualRepresentation(), updateVisualRepresentation(), and wrapIfOutside().
|
protected |
Pointer to visual representation module, to speed up repeated access.
Referenced by initialize(), inet::StaticGridMobility::setInitialPosition(), inet::StaticConcentricMobility::setInitialPosition(), inet::LinearNodeDistributionMobility::setInitialPosition(), setInitialPosition(), inet::MoBANLocal::updateVisualRepresentation(), and updateVisualRepresentation().