|
|
| 56 |
|
56 |
|
| 57 |
RandomWaypointMobilityModel::RandomWaypointMobilityModel () |
57 |
RandomWaypointMobilityModel::RandomWaypointMobilityModel () |
| 58 |
{ |
58 |
{ |
| 59 |
Simulator::ScheduleNow (&RandomWaypointMobilityModel::Start, this); |
59 |
m_event = Simulator::ScheduleNow (&RandomWaypointMobilityModel::Start, this); |
| 60 |
} |
60 |
} |
| 61 |
|
61 |
|
| 62 |
void |
62 |
void |
|
|
| 72 |
double k = speed / std::sqrt (dx*dx + dy*dy + dz*dz); |
72 |
double k = speed / std::sqrt (dx*dx + dy*dy + dz*dz); |
| 73 |
|
73 |
|
| 74 |
m_helper.SetVelocity (Vector (k*dx, k*dy, k*dz)); |
74 |
m_helper.SetVelocity (Vector (k*dx, k*dy, k*dz)); |
|
|
75 |
m_helper.Unpause (); |
| 75 |
Time travelDelay = Seconds (CalculateDistance (destination, m_current) / speed); |
76 |
Time travelDelay = Seconds (CalculateDistance (destination, m_current) / speed); |
| 76 |
m_event = Simulator::Schedule (travelDelay, |
77 |
m_event = Simulator::Schedule (travelDelay, |
| 77 |
&RandomWaypointMobilityModel::Start, this); |
78 |
&RandomWaypointMobilityModel::Start, this); |
|
|
| 99 |
{ |
100 |
{ |
| 100 |
m_helper.SetPosition (position); |
101 |
m_helper.SetPosition (position); |
| 101 |
Simulator::Remove (m_event); |
102 |
Simulator::Remove (m_event); |
| 102 |
Simulator::ScheduleNow (&RandomWaypointMobilityModel::Start, this); |
103 |
m_event = Simulator::ScheduleNow (&RandomWaypointMobilityModel::Start, this); |
| 103 |
} |
104 |
} |
| 104 |
Vector |
105 |
Vector |
| 105 |
RandomWaypointMobilityModel::DoGetVelocity (void) const |
106 |
RandomWaypointMobilityModel::DoGetVelocity (void) const |