21 #include "ns3/abort.h"
22 #include "ns3/boolean.h"
23 #include "ns3/config.h"
25 #include "ns3/simulator.h"
27 #include "ns3/uinteger.h"
42 TypeId(
"ns3::WaypointMobilityModel")
44 .SetGroupName(
"Mobility")
46 .AddAttribute(
"NextWaypoint",
47 "The next waypoint used to determine position.",
51 MakeWaypointChecker())
52 .AddAttribute(
"WaypointsLeft",
53 "The number of waypoints remaining.",
57 MakeUintegerChecker<uint32_t>())
58 .AddAttribute(
"LazyNotify",
59 "Only call NotifyCourseChange when position is calculated.",
63 .AddAttribute(
"InitialPositionIsWaypoint",
64 "Calling SetPosition with no waypoints creates a waypoint.",
74 m_initialPositionIsWaypoint(false)
99 "Waypoints must be added in ascending time order");
127 bool newWaypoint =
false;
Keep track of the current position and velocity of an object.
void NotifyCourseChange() const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
virtual void DoDispose()
Destructor implementation.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
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.
void DoDispose() override
The dispose method.
Waypoint GetNextWaypoint() const
Get the waypoint that this object is traveling towards.
bool m_initialPositionIsWaypoint
If true, calling SetPosition with no waypoints creates a waypoint.
virtual void Update() const
Update the underlying state corresponding to the stored waypoints.
Vector DoGetVelocity() const override
Returns the current velocity of a node.
WaypointMobilityModel()
Create a path with no waypoints at location (0,0,0).
uint32_t WaypointsLeft() const
Get the number of waypoints left for this object, excluding the next one.
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.
void EndMobility()
Clear any existing waypoints and set the current waypoint time to infinity.
void DoSetPosition(const Vector &position) override
Sets a new position for the node.
Vector DoGetPosition() const override
Get current position.
Waypoint m_next
The next ns3::Waypoint in the deque.
static TypeId GetTypeId()
Register this type with the TypeId system.
void AddWaypoint(const Waypoint &waypoint)
~WaypointMobilityModel() override
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#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.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)