Public Member Functions | Protected Attributes

Move Class Reference
[baseUtils - utilities for base MiXiMutils - utility classesBaseUtility - blackboard related stuff]

Class to store object position and movement. More...

#include <Move.h>

Inherits BBItem.

Collaboration diagram for Move:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual BBItemparentObject () const
 Provides BBItem meta information for this class.
double getSpeed () const
 Returns the current speed.
void setSpeed (double speed)
 Sets the current speed in meters per second.
const CoordgetStartPos () const
 Returns the start position.
simtime_t getStartTime () const
 Returns start time, i.e. time point of the start at start position.
void setStart (const Coord &startPos, simtime_t startTime)
 Sets start position (components in meters) and start time.
void setStart (const Coord &startPos)
 Sets start position to passed value (components in meters), start time will be set to current simulation-time.
const CoordgetDirection () const
 Returns the direction vector.
void setDirectionByVector (const Coord &direction)
 Sets the direction to the passed vector, which must be already normalized or the 0-vector.
void setDirectionByTarget (const Coord &target)
 Sets the direction to the normalized vector pointing from the current start position to the passed target point.
virtual Coord getPositionAt (simtime_t actualTime) const
 Returns the position of the Move (Host) at the specified point in time. It is intended to be passed simTime() as actualTime and returns the actual position.
std::string info () const
 Returns information about the current state.

Protected Attributes

Coord startPos
 Start position of the host (in meters).
simtime_t startTime
 start time at which host started at startPos
Coord direction
 direction the host is moving to, must be normalized
double speed
 speed of the host in meters per second

Detailed Description

Class to store object position and movement.

Author:
Andreas Koepke, Michael Swigulski

Definition at line 42 of file Move.h.


Member Function Documentation

virtual Coord Move::getPositionAt ( simtime_t  actualTime  )  const [inline, virtual]

Returns the position of the Move (Host) at the specified point in time. It is intended to be passed simTime() as actualTime and returns the actual position.

Assumes that direction represents a normalized vector (length equals 1.0). Further this function does not check whether the given time point is before the startTime of the actual move pattern. So in this case one might obtain an unintended result.

Definition at line 153 of file Move.h.

References FWMath::close(), direction, speed, startPos, and startTime.

Referenced by ChannelAccess::calculatePropagationDelay(), UWBIRStochasticPathlossModel::filterSignal(), UWBIRIEEE802154APathlossModel::filterSignal(), SimplePathlossModel::filterSignal(), and BreakpointPathlossModel::filterSignal().

    {
      // if speed is very close to 0.0, the host is practically standing still
      if ( FWMath::close(speed, 0.0) ) return startPos;

      // otherwise: actualPos = startPos + ( direction * v * t )
      return startPos + ( direction * speed * SIMTIME_DBL(actualTime - startTime) );
    }

void Move::setDirectionByTarget ( const Coord target  )  [inline]

Sets the direction to the normalized vector pointing from the current start position to the passed target point.

NOTE: The target point must not be the current start position or too close to it.

Definition at line 135 of file Move.h.

References FWMath::close(), direction, Coord::length(), and startPos.

Referenced by LineSegmentsMobilityBase::beginNextMove(), TractorMobility::calculateXY(), RectangleMobility::calculateXY(), MassMobility::handleSelfMsg(), MassMobility::initialize(), LinearMobility::makeMove(), CircleMobility::makeMove(), and ConstSpeedMobility::setTargetPosition().

  {
      direction = target - startPos;

      assert( !FWMath::close(direction.length(), 0.0) );
      direction /= direction.length();
    }


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