A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
random-waypoint-mobility-model.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007 INRIA
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
#ifndef RANDOM_WAYPOINT_MOBILITY_MODEL_H
20
#define RANDOM_WAYPOINT_MOBILITY_MODEL_H
21
22
#include "
constant-velocity-helper.h
"
23
#include "
mobility-model.h
"
24
#include "
position-allocator.h
"
25
26
#include "ns3/ptr.h"
27
#include "ns3/random-variable-stream.h"
28
29
namespace
ns3
30
{
31
32
/**
33
* \ingroup mobility
34
* \brief Random waypoint mobility model.
35
*
36
* Each object starts by pausing at time zero for the duration governed
37
* by the random variable "Pause". After pausing, the object will pick
38
* a new waypoint (via the PositionAllocator) and a new random speed
39
* via the random variable "Speed", and will begin moving towards the
40
* waypoint at a constant speed. When it reaches the destination,
41
* the process starts over (by pausing).
42
*
43
* This mobility model enforces no bounding box by itself; the
44
* PositionAllocator assigned to this object will bound the movement.
45
* If the user fails to provide a pointer to a PositionAllocator to
46
* be used to pick waypoints, the simulation program will assert.
47
*
48
* The implementation of this model is not 2d-specific. i.e. if you provide
49
* a 3d random waypoint position model to this mobility model, the model
50
* will still work. There is no 3d position allocator for now but it should
51
* be trivial to add one.
52
*/
53
class
RandomWaypointMobilityModel
:
public
MobilityModel
54
{
55
public
:
56
/**
57
* Register this type with the TypeId system.
58
* \return the object TypeId
59
*/
60
static
TypeId
GetTypeId
();
61
62
protected
:
63
void
DoInitialize
()
override
;
64
65
private
:
66
/**
67
* Get next position, begin moving towards it, schedule future pause event
68
*/
69
void
BeginWalk
();
70
/**
71
* Begin current pause event, schedule future walk event
72
*/
73
void
DoInitializePrivate
();
74
Vector
DoGetPosition
()
const override
;
75
void
DoSetPosition
(
const
Vector& position)
override
;
76
Vector
DoGetVelocity
()
const override
;
77
int64_t
DoAssignStreams
(int64_t)
override
;
78
79
ConstantVelocityHelper
m_helper
;
//!< helper for velocity computations
80
Ptr<PositionAllocator>
m_position
;
//!< pointer to position allocator
81
Ptr<RandomVariableStream>
m_speed
;
//!< random variable to generate speeds
82
Ptr<RandomVariableStream>
m_pause
;
//!< random variable to generate pauses
83
EventId
m_event
;
//!< event ID of next scheduled event
84
};
85
86
}
// namespace ns3
87
88
#endif
/* RANDOM_WAYPOINT_MOBILITY_MODEL_H */
ns3::ConstantVelocityHelper
Utility class used to move node with constant velocity.
Definition:
constant-velocity-helper.h:38
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:56
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition:
mobility-model.h:40
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::RandomWaypointMobilityModel
Random waypoint mobility model.
Definition:
random-waypoint-mobility-model.h:54
ns3::RandomWaypointMobilityModel::BeginWalk
void BeginWalk()
Get next position, begin moving towards it, schedule future pause event.
Definition:
random-waypoint-mobility-model.cc:63
ns3::RandomWaypointMobilityModel::m_helper
ConstantVelocityHelper m_helper
helper for velocity computations
Definition:
random-waypoint-mobility-model.h:79
ns3::RandomWaypointMobilityModel::DoInitializePrivate
void DoInitializePrivate()
Begin current pause event, schedule future walk event.
Definition:
random-waypoint-mobility-model.cc:96
ns3::RandomWaypointMobilityModel::DoAssignStreams
int64_t DoAssignStreams(int64_t) override
The default implementation does nothing but return the passed-in parameter.
Definition:
random-waypoint-mobility-model.cc:127
ns3::RandomWaypointMobilityModel::m_position
Ptr< PositionAllocator > m_position
pointer to position allocator
Definition:
random-waypoint-mobility-model.h:80
ns3::RandomWaypointMobilityModel::m_speed
Ptr< RandomVariableStream > m_speed
random variable to generate speeds
Definition:
random-waypoint-mobility-model.h:81
ns3::RandomWaypointMobilityModel::DoInitialize
void DoInitialize() override
Initialize() implementation.
Definition:
random-waypoint-mobility-model.cc:89
ns3::RandomWaypointMobilityModel::GetTypeId
static TypeId GetTypeId()
Register this type with the TypeId system.
Definition:
random-waypoint-mobility-model.cc:36
ns3::RandomWaypointMobilityModel::DoGetPosition
Vector DoGetPosition() const override
Definition:
random-waypoint-mobility-model.cc:106
ns3::RandomWaypointMobilityModel::m_pause
Ptr< RandomVariableStream > m_pause
random variable to generate pauses
Definition:
random-waypoint-mobility-model.h:82
ns3::RandomWaypointMobilityModel::m_event
EventId m_event
event ID of next scheduled event
Definition:
random-waypoint-mobility-model.h:83
ns3::RandomWaypointMobilityModel::DoGetVelocity
Vector DoGetVelocity() const override
Definition:
random-waypoint-mobility-model.cc:121
ns3::RandomWaypointMobilityModel::DoSetPosition
void DoSetPosition(const Vector &position) override
Definition:
random-waypoint-mobility-model.cc:113
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
constant-velocity-helper.h
mobility-model.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
position-allocator.h
src
mobility
model
random-waypoint-mobility-model.h
Generated on Tue May 28 2024 23:38:19 for ns-3 by
1.9.6