Utility class used to move node with constant velocity. More...
#include "constant-velocity-helper.h"
Public Member Functions | |
ConstantVelocityHelper () | |
ConstantVelocityHelper (const Vector &position) | |
Create object and set position. More... | |
ConstantVelocityHelper (const Vector &position, const Vector &vel) | |
Create object and set position and velocity. More... | |
Vector | GetCurrentPosition () const |
Get current position vector. More... | |
Vector | GetVelocity () const |
Get velocity; if paused, will return a zero vector. More... | |
void | Pause () |
Pause mobility at current position. More... | |
void | SetPosition (const Vector &position) |
Set position vector. More... | |
void | SetVelocity (const Vector &vel) |
Set new velocity vector. More... | |
void | Unpause () |
Resume mobility from current position at current velocity. More... | |
void | Update () const |
Update position, if not paused, from last position and time of last update. More... | |
void | UpdateWithBounds (const Box &bounds) const |
Update position, if not paused, from last position and time of last update. More... | |
void | UpdateWithBounds (const Rectangle &rectangle) const |
Update position, if not paused, from last position and time of last update. More... | |
Private Attributes | |
Time | m_lastUpdate |
time of last update More... | |
bool | m_paused |
state variable for paused More... | |
Vector | m_position |
state variable for current position More... | |
Vector | m_velocity |
state variable for velocity More... | |
Utility class used to move node with constant velocity.
Definition at line 37 of file constant-velocity-helper.h.
ns3::ConstantVelocityHelper::ConstantVelocityHelper | ( | ) |
Definition at line 32 of file constant-velocity-helper.cc.
References NS_LOG_FUNCTION.
ns3::ConstantVelocityHelper::ConstantVelocityHelper | ( | const Vector & | position | ) |
Create object and set position.
position | the position vector |
Definition at line 38 of file constant-velocity-helper.cc.
References NS_LOG_FUNCTION.
ns3::ConstantVelocityHelper::ConstantVelocityHelper | ( | const Vector & | position, |
const Vector & | vel | ||
) |
Create object and set position and velocity.
position | the position vector |
vel | the velocity vector |
Definition at line 45 of file constant-velocity-helper.cc.
References NS_LOG_FUNCTION.
Vector ns3::ConstantVelocityHelper::GetCurrentPosition | ( | ) | const |
Get current position vector.
Definition at line 63 of file constant-velocity-helper.cc.
References m_position, and NS_LOG_FUNCTION.
Referenced by ns3::RandomWaypointMobilityModel::BeginWalk(), ns3::SteadyStateRandomWaypointMobilityModel::BeginWalk(), ns3::RandomWalk2dOutdoorMobilityModel::DoGetPosition(), ns3::ConstantVelocityMobilityModel::DoGetPosition(), ns3::GaussMarkovMobilityModel::DoGetPosition(), ns3::RandomDirection2dMobilityModel::DoGetPosition(), ns3::RandomWalk2dMobilityModel::DoGetPosition(), ns3::RandomWaypointMobilityModel::DoGetPosition(), ns3::SteadyStateRandomWaypointMobilityModel::DoGetPosition(), ns3::RandomWalk2dMobilityModel::DoInitializePrivate(), ns3::RandomWalk2dOutdoorMobilityModel::DoWalk(), ns3::GaussMarkovMobilityModel::DoWalk(), ns3::RandomWalk2dMobilityModel::DoWalk(), ns3::RandomWalk2dOutdoorMobilityModel::Rebound(), ns3::RandomWalk2dMobilityModel::Rebound(), ns3::RandomDirection2dMobilityModel::ResetDirectionAndSpeed(), ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed(), and ns3::SteadyStateRandomWaypointMobilityModel::SteadyStateBeginWalk().
Vector ns3::ConstantVelocityHelper::GetVelocity | ( | ) | const |
Get velocity; if paused, will return a zero vector.
Definition at line 70 of file constant-velocity-helper.cc.
References m_paused, m_velocity, and NS_LOG_FUNCTION.
Referenced by ns3::RandomWalk2dOutdoorMobilityModel::DoGetVelocity(), ns3::ConstantVelocityMobilityModel::DoGetVelocity(), ns3::GaussMarkovMobilityModel::DoGetVelocity(), ns3::RandomDirection2dMobilityModel::DoGetVelocity(), ns3::RandomWalk2dMobilityModel::DoGetVelocity(), ns3::RandomWaypointMobilityModel::DoGetVelocity(), ns3::SteadyStateRandomWaypointMobilityModel::DoGetVelocity(), ns3::RandomWalk2dOutdoorMobilityModel::DoWalk(), ns3::GaussMarkovMobilityModel::DoWalk(), ns3::RandomWalk2dMobilityModel::DoWalk(), ns3::RandomWalk2dOutdoorMobilityModel::Rebound(), and ns3::RandomWalk2dMobilityModel::Rebound().
void ns3::ConstantVelocityHelper::Pause | ( | ) |
Pause mobility at current position.
Definition at line 127 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().
void ns3::ConstantVelocityHelper::SetPosition | ( | const Vector & | position | ) |
Set position vector.
position | Position vector |
Definition at line 54 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::RandomWalk2dOutdoorMobilityModel::DoSetPosition(), ns3::ConstantVelocityMobilityModel::DoSetPosition(), ns3::GaussMarkovMobilityModel::DoSetPosition(), ns3::RandomDirection2dMobilityModel::DoSetPosition(), ns3::RandomWalk2dMobilityModel::DoSetPosition(), ns3::RandomWaypointMobilityModel::DoSetPosition(), and ns3::SteadyStateRandomWaypointMobilityModel::DoSetPosition().
void ns3::ConstantVelocityHelper::SetVelocity | ( | const Vector & | vel | ) |
Set new velocity vector.
vel | Velocity vector |
Definition at line 77 of file constant-velocity-helper.cc.
References m_lastUpdate, m_velocity, ns3::Simulator::Now(), and NS_LOG_FUNCTION.
Referenced by ns3::RandomWalk2dOutdoorMobilityModel::AvoidBuilding(), ns3::RandomWaypointMobilityModel::BeginWalk(), ns3::SteadyStateRandomWaypointMobilityModel::BeginWalk(), ns3::RandomWalk2dOutdoorMobilityModel::DoInitializePrivate(), ns3::RandomWalk2dMobilityModel::DoInitializePrivate(), ns3::GaussMarkovMobilityModel::DoWalk(), ns3::RandomWalk2dOutdoorMobilityModel::Rebound(), ns3::RandomWalk2dMobilityModel::Rebound(), ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed(), ns3::ConstantVelocityMobilityModel::SetVelocity(), ns3::GaussMarkovMobilityModel::Start(), and ns3::SteadyStateRandomWaypointMobilityModel::SteadyStateBeginWalk().
void ns3::ConstantVelocityHelper::Unpause | ( | ) |
Resume mobility from current position at current velocity.
Definition at line 134 of file constant-velocity-helper.cc.
References m_paused, and NS_LOG_FUNCTION.
Referenced by ns3::GaussMarkovMobilityModel::GaussMarkovMobilityModel(), ns3::RandomWalk2dOutdoorMobilityModel::AvoidBuilding(), ns3::RandomWaypointMobilityModel::BeginWalk(), ns3::SteadyStateRandomWaypointMobilityModel::BeginWalk(), ns3::RandomWalk2dOutdoorMobilityModel::DoInitializePrivate(), ns3::RandomWalk2dMobilityModel::DoInitializePrivate(), ns3::GaussMarkovMobilityModel::DoWalk(), ns3::RandomWalk2dOutdoorMobilityModel::Rebound(), ns3::RandomWalk2dMobilityModel::Rebound(), ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed(), ns3::ConstantVelocityMobilityModel::SetVelocity(), ns3::GaussMarkovMobilityModel::Start(), and ns3::SteadyStateRandomWaypointMobilityModel::SteadyStateBeginWalk().
void ns3::ConstantVelocityHelper::Update | ( | ) | const |
Update position, if not paused, from last position and time of last update.
Definition at line 85 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::RandomWalk2dMobilityModel::DoInitializePrivate(), ns3::RandomWaypointMobilityModel::DoInitializePrivate(), ns3::SteadyStateRandomWaypointMobilityModel::DoInitializePrivate(), ns3::ConstantVelocityMobilityModel::SetVelocity(), ns3::GaussMarkovMobilityModel::Start(), ns3::SteadyStateRandomWaypointMobilityModel::Start(), ns3::SteadyStateRandomWaypointMobilityModel::SteadyStateBeginWalk(), and UpdateWithBounds().
void ns3::ConstantVelocityHelper::UpdateWithBounds | ( | const Box & | bounds | ) | const |
Update position, if not paused, from last position and time of last update.
bounds | 3D bounding box for resulting position; object will not move outside the box |
Definition at line 114 of file constant-velocity-helper.cc.
References m_position, max, min, NS_LOG_FUNCTION, Update(), ns3::Box::xMax, ns3::Box::xMin, ns3::Box::yMax, ns3::Box::yMin, ns3::Box::zMax, and ns3::Box::zMin.
void ns3::ConstantVelocityHelper::UpdateWithBounds | ( | const Rectangle & | rectangle | ) | const |
Update position, if not paused, from last position and time of last update.
rectangle | 2D bounding rectangle for resulting position; object will not move outside the rectangle |
Definition at line 103 of file constant-velocity-helper.cc.
References m_position, max, min, NS_LOG_FUNCTION, Update(), ns3::Rectangle::xMax, ns3::Rectangle::xMin, ns3::Rectangle::yMax, and ns3::Rectangle::yMin.
Referenced by ns3::RandomWalk2dOutdoorMobilityModel::DoGetPosition(), ns3::RandomDirection2dMobilityModel::DoGetPosition(), ns3::RandomWalk2dMobilityModel::DoGetPosition(), ns3::GaussMarkovMobilityModel::DoWalk(), ns3::RandomWalk2dOutdoorMobilityModel::Rebound(), ns3::RandomWalk2dMobilityModel::Rebound(), ns3::RandomDirection2dMobilityModel::ResetDirectionAndSpeed(), and ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed().
|
mutableprivate |
time of last update
Definition at line 99 of file constant-velocity-helper.h.
Referenced by SetPosition(), SetVelocity(), and Update().
|
private |
state variable for paused
Definition at line 102 of file constant-velocity-helper.h.
Referenced by GetVelocity(), Pause(), Unpause(), and Update().
|
mutableprivate |
state variable for current position
Definition at line 100 of file constant-velocity-helper.h.
Referenced by GetCurrentPosition(), SetPosition(), Update(), and UpdateWithBounds().
|
private |
state variable for velocity
Definition at line 101 of file constant-velocity-helper.h.
Referenced by GetVelocity(), SetPosition(), SetVelocity(), and Update().