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;
virtual void DoDispose(void)
The dispose method.
virtual Vector DoGetVelocity(void) const
Returns the current velocity of a node.
Simulation virtual time values and global simulation resolution.
Time time
The waypoint time.
AttributeValue implementation for Boolean.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
virtual ~WaypointMobilityModel()
bool m_lazyNotify
If true, course change updates are only notified when position is calculated.
void AddWaypoint(const Waypoint &waypoint)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Vector m_velocity
The current velocity vector.
std::deque< Waypoint > m_waypoints
The double ended queue containing the ns3::Waypoint objects.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
virtual void DoDispose(void)
Destructor implementation.
uint32_t WaypointsLeft(void) const
Get the number of waypoints left for this object, excluding the next one.
The attribute can be read.
Keep track of the current position and velocity of an object.
bool m_first
This variable is set to true if there are no waypoints in the std::deque.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Vector position
The position of the waypoint.
virtual void DoSetPosition(const Vector &position)
Sets a new position for the node
Hold an unsigned integer type.
Ptr< const AttributeChecker > MakeWaypointChecker(void)
virtual void Update(void) const
Update the underlying state corresponding to the stored waypoints.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
static TypeId GetTypeId(void)
Register this type with the TypeId system.
Waypoint m_next
The next ns3::Waypoint in the deque.
virtual Vector DoGetPosition(void) const
Get current position.
Waypoint GetNextWaypoint(void) const
Get the waypoint that this object is traveling towards.
static Time Now(void)
Return the current simulation virtual time.
void NotifyCourseChange(void) const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
Ptr< const AttributeAccessor > MakeWaypointAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void EndMobility(void)
Clear any existing waypoints and set the current waypoint time to infinity.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Time Seconds(double value)
Construct a Time in the indicated unit.
Waypoint m_current
The ns3::Waypoint currently being used.
Waypoint-based mobility model.
WaypointMobilityModel()
Create a path with no waypoints at location (0,0,0).
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
bool m_initialPositionIsWaypoint
If true, calling SetPosition with no waypoints creates a waypoint.
AttributeValue implementation for Waypoint.