21 #include "ns3/abort.h"
22 #include "ns3/simulator.h"
23 #include "ns3/uinteger.h"
25 #include "ns3/boolean.h"
27 #include "ns3/config.h"
40 static TypeId tid =
TypeId (
"ns3::WaypointMobilityModel")
42 .SetGroupName (
"Mobility")
44 .AddAttribute (
"NextWaypoint",
"The next waypoint used to determine position.",
49 .AddAttribute (
"WaypointsLeft",
"The number of waypoints remaining.",
53 MakeUintegerChecker<uint32_t> ())
54 .AddAttribute (
"LazyNotify",
"Only call NotifyCourseChange when position is calculated.",
58 .AddAttribute (
"InitialPositionIsWaypoint",
"Calling SetPosition with no waypoints creates a waypoint.",
70 m_initialPositionIsWaypoint (false)
92 "Waypoints must be added in ascending time order");
117 bool newWaypoint =
false;
AttributeValue implementation for Boolean.
Keep track of the current position and velocity of an object.
void NotifyCourseChange(void) const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
virtual void DoDispose(void)
Destructor implementation.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now(void)
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
@ ATTR_GET
The attribute can be read.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
Time time
The waypoint time.
Vector position
The position of the waypoint.
Waypoint-based mobility model.
Vector m_velocity
The current velocity vector.
bool m_initialPositionIsWaypoint
If true, calling SetPosition with no waypoints creates a waypoint.
virtual void DoSetPosition(const Vector &position)
Sets a new position for the node
virtual ~WaypointMobilityModel()
virtual void Update(void) const
Update the underlying state corresponding to the stored waypoints.
static TypeId GetTypeId(void)
Register this type with the TypeId system.
virtual Vector DoGetPosition(void) const
Get current position.
virtual void DoDispose(void)
The dispose method.
WaypointMobilityModel()
Create a path with no waypoints at location (0,0,0).
void EndMobility(void)
Clear any existing waypoints and set the current waypoint time to infinity.
Waypoint GetNextWaypoint(void) const
Get the waypoint that this object is traveling towards.
Waypoint m_current
The ns3::Waypoint currently being used.
bool m_first
This variable is set to true if there are no waypoints in the std::deque.
std::deque< Waypoint > m_waypoints
The double ended queue containing the ns3::Waypoint objects.
bool m_lazyNotify
If true, course change updates are only notified when position is calculated.
uint32_t WaypointsLeft(void) const
Get the number of waypoints left for this object, excluding the next one.
Waypoint m_next
The next ns3::Waypoint in the deque.
void AddWaypoint(const Waypoint &waypoint)
virtual Vector DoGetVelocity(void) const
Returns the current velocity of a node.
AttributeValue implementation for Waypoint.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeWaypointAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeWaypointChecker(void)
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.