A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::ConstantVelocityHelper Class Reference

Utility class used to move node with constant velocity. More...

#include "constant-velocity-helper.h"

+ Collaboration diagram for ns3::ConstantVelocityHelper:

Public Member Functions

 ConstantVelocityHelper ()
 
 ConstantVelocityHelper (const Vector &position)
 Create object and set position.
 
 ConstantVelocityHelper (const Vector &position, const Vector &vel)
 Create object and set position and velocity.
 
Vector GetCurrentPosition () const
 Get current position vector.
 
Vector GetVelocity () const
 Get velocity; if paused, will return a zero vector.
 
void Pause ()
 Pause mobility at current position.
 
void SetPosition (const Vector &position)
 Set position vector.
 
void SetVelocity (const Vector &vel)
 Set new velocity vector.
 
void Unpause ()
 Resume mobility from current position at current velocity.
 
void Update () const
 Update position, if not paused, from last position and time of last update.
 
void UpdateWithBounds (const Box &bounds) const
 Update position, if not paused, from last position and time of last update.
 
void UpdateWithBounds (const Rectangle &rectangle) const
 Update position, if not paused, from last position and time of last update.
 

Private Attributes

Time m_lastUpdate
 time of last update
 
bool m_paused
 state variable for paused
 
Vector m_position
 state variable for current position
 
Vector m_velocity
 state variable for velocity
 

Detailed Description

Utility class used to move node with constant velocity.

Definition at line 26 of file constant-velocity-helper.h.

Constructor & Destructor Documentation

◆ ConstantVelocityHelper() [1/3]

ns3::ConstantVelocityHelper::ConstantVelocityHelper ( )

Definition at line 21 of file constant-velocity-helper.cc.

References NS_LOG_FUNCTION.

◆ ConstantVelocityHelper() [2/3]

ns3::ConstantVelocityHelper::ConstantVelocityHelper ( const Vector & position)

Create object and set position.

Parameters
positionthe position vector

Definition at line 27 of file constant-velocity-helper.cc.

References NS_LOG_FUNCTION.

◆ ConstantVelocityHelper() [3/3]

ns3::ConstantVelocityHelper::ConstantVelocityHelper ( const Vector & position,
const Vector & vel )

Create object and set position and velocity.

Parameters
positionthe position vector
velthe velocity vector

Definition at line 34 of file constant-velocity-helper.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ GetCurrentPosition()

◆ GetVelocity()

◆ Pause()

void ns3::ConstantVelocityHelper::Pause ( )

Pause mobility at current position.

Definition at line 116 of file constant-velocity-helper.cc.

References m_paused, and NS_LOG_FUNCTION.

Referenced by ns3::RandomDirection2dMobilityModel::BeginPause(), ns3::RandomWaypointMobilityModel::DoInitializePrivate(), ns3::SteadyStateRandomWaypointMobilityModel::DoInitializePrivate(), and ns3::SteadyStateRandomWaypointMobilityModel::Start().

+ Here is the caller graph for this function:

◆ SetPosition()

void ns3::ConstantVelocityHelper::SetPosition ( const Vector & position)

Set position vector.

Parameters
positionPosition vector

Definition at line 43 of file constant-velocity-helper.cc.

References m_lastUpdate, m_position, m_velocity, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Referenced by ns3::SteadyStateRandomWaypointMobilityModel::DoInitializePrivate(), ns3::ConstantVelocityMobilityModel::DoSetPosition(), ns3::GaussMarkovMobilityModel::DoSetPosition(), ns3::RandomDirection2dMobilityModel::DoSetPosition(), ns3::RandomWalk2dMobilityModel::DoSetPosition(), ns3::RandomWalk2dOutdoorMobilityModel::DoSetPosition(), ns3::RandomWaypointMobilityModel::DoSetPosition(), and ns3::SteadyStateRandomWaypointMobilityModel::DoSetPosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetVelocity()

void ns3::ConstantVelocityHelper::SetVelocity ( const Vector & vel)

◆ Unpause()

◆ Update()

void ns3::ConstantVelocityHelper::Update ( ) const

Update position, if not paused, from last position and time of last update.

Definition at line 74 of file constant-velocity-helper.cc.

References ns3::Time::GetSeconds(), m_lastUpdate, m_paused, m_position, m_velocity, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::RandomWalk2dOutdoorMobilityModel::AvoidBuilding(), ns3::RandomDirection2dMobilityModel::BeginPause(), ns3::RandomWaypointMobilityModel::BeginWalk(), ns3::SteadyStateRandomWaypointMobilityModel::BeginWalk(), ns3::ConstantVelocityMobilityModel::DoGetPosition(), ns3::GaussMarkovMobilityModel::DoGetPosition(), ns3::RandomWaypointMobilityModel::DoGetPosition(), ns3::SteadyStateRandomWaypointMobilityModel::DoGetPosition(), ns3::RandomWalk2dOutdoorMobilityModel::DoInitializePrivate(), ns3::RandomWaypointMobilityModel::DoInitializePrivate(), ns3::SteadyStateRandomWaypointMobilityModel::DoInitializePrivate(), ns3::RandomWalk2dMobilityModel::DrawRandomVelocityAndDistance(), ns3::ConstantVelocityMobilityModel::SetVelocity(), ns3::GaussMarkovMobilityModel::Start(), ns3::SteadyStateRandomWaypointMobilityModel::Start(), ns3::SteadyStateRandomWaypointMobilityModel::SteadyStateBeginWalk(), UpdateWithBounds(), and UpdateWithBounds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateWithBounds() [1/2]

void ns3::ConstantVelocityHelper::UpdateWithBounds ( const Box & bounds) const

Update position, if not paused, from last position and time of last update.

Parameters
bounds3D bounding box for resulting position; object will not move outside the box

Definition at line 103 of file constant-velocity-helper.cc.

References m_position, NS_LOG_FUNCTION, Update(), ns3::Box::xMax, ns3::Box::xMin, ns3::Box::yMax, ns3::Box::yMin, ns3::Box::zMax, and ns3::Box::zMin.

+ Here is the call graph for this function:

◆ UpdateWithBounds() [2/2]

void ns3::ConstantVelocityHelper::UpdateWithBounds ( const Rectangle & rectangle) const

Update position, if not paused, from last position and time of last update.

Parameters
rectangle2D bounding rectangle for resulting position; object will not move outside the rectangle

Definition at line 92 of file constant-velocity-helper.cc.

References m_position, NS_LOG_FUNCTION, Update(), ns3::Rectangle::xMax, ns3::Rectangle::xMin, ns3::Rectangle::yMax, and ns3::Rectangle::yMin.

Referenced by ns3::RandomDirection2dMobilityModel::DoGetPosition(), ns3::RandomWalk2dMobilityModel::DoGetPosition(), ns3::RandomWalk2dOutdoorMobilityModel::DoGetPosition(), ns3::GaussMarkovMobilityModel::DoWalk(), ns3::RandomWalk2dMobilityModel::Rebound(), ns3::RandomWalk2dOutdoorMobilityModel::Rebound(), ns3::RandomDirection2dMobilityModel::ResetDirectionAndSpeed(), and ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_lastUpdate

Time ns3::ConstantVelocityHelper::m_lastUpdate
mutableprivate

time of last update

Definition at line 88 of file constant-velocity-helper.h.

Referenced by SetPosition(), SetVelocity(), and Update().

◆ m_paused

bool ns3::ConstantVelocityHelper::m_paused
private

state variable for paused

Definition at line 91 of file constant-velocity-helper.h.

Referenced by GetVelocity(), Pause(), Unpause(), and Update().

◆ m_position

Vector ns3::ConstantVelocityHelper::m_position
mutableprivate

state variable for current position

Definition at line 89 of file constant-velocity-helper.h.

Referenced by GetCurrentPosition(), SetPosition(), Update(), UpdateWithBounds(), and UpdateWithBounds().

◆ m_velocity

Vector ns3::ConstantVelocityHelper::m_velocity
private

state variable for velocity

Definition at line 90 of file constant-velocity-helper.h.

Referenced by GetVelocity(), SetPosition(), SetVelocity(), and Update().


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