bug 1386: assert if PositionAllocator not provided to RandomWaypointMobilityModel

This commit is contained in:
Tom Henderson
2012-08-01 13:19:33 -07:00
parent 980bcff084
commit 879c2a68cf
2 changed files with 12 additions and 4 deletions

View File

@@ -59,6 +59,7 @@ RandomWaypointMobilityModel::BeginWalk (void)
{
m_helper.Update ();
Vector m_current = m_helper.GetCurrentPosition ();
NS_ASSERT_MSG (m_position, "No position allocator added before using this model");
Vector destination = m_position->GetNext ();
double speed = m_speed.GetValue ();
double dx = (destination.x - m_current.x);

View File

@@ -32,10 +32,17 @@ namespace ns3 {
* \ingroup mobility
* \brief Random waypoint mobility model.
*
* Each object chooses a random destination "waypoint", a random speed,
* and a random pause time: it then pauses for the specified pause time,
* and starts moving towards the specified destination with the specified
* speed. Once the destination is reached the process starts again.
* Each object starts by pausing at time zero for the duration governed
* by the random variable "Pause". After pausing, the object will pick
* a new waypoint (via the PositionAllocator) and a new random speed
* via the random variable "Speed", and will begin moving towards the
* waypoint at a constant speed. When it reaches the destination,
* the process starts over (by pausing).
*
* This mobility model enforces no bounding box by itself; the
* PositionAllocator assigned to this object will bound the movement.
* If the user fails to provide a pointer to a PositionAllocator to
* be used to pick waypoints, the simulation program will assert.
*
* The implementation of this model is not 2d-specific. i.e. if you provide
* a 3d random waypoint position model to this mobility model, the model