00001 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2007 INRIA 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> 00019 */ 00020 #ifndef RANDOM_WAYPOINT_MOBILITY_MODEL_H 00021 #define RANDOM_WAYPOINT_MOBILITY_MODEL_H 00022 00023 #include "static-speed-helper.h" 00024 #include "mobility-model.h" 00025 #include "position-allocator.h" 00026 #include "ns3/ptr.h" 00027 #include "ns3/random-variable.h" 00028 00029 namespace ns3 { 00030 00031 /** 00032 * \brief a random waypoint mobility model 00033 * 00034 * Each object chooses a random destination "waypoint", a random speed, 00035 * and a random pause time: it then pauses for the specified pause time, 00036 * and starts moving towards the specified destination with the specified 00037 * speed. Once the destination is reached the process starts again. 00038 * 00039 * The implementation of this model is not 2d-specific. i.e. if you provide 00040 * a 3d random waypoint position model to this mobility model, the model 00041 * will still work. There is no 3d position allocator for now but it should 00042 * be trivial to add one. 00043 */ 00044 class RandomWaypointMobilityModel : public MobilityModel 00045 { 00046 public: 00047 static TypeId GetTypeId (void); 00048 RandomWaypointMobilityModel (); 00049 private: 00050 void Start (void); 00051 void BeginWalk (void); 00052 virtual Vector DoGetPosition (void) const; 00053 virtual void DoSetPosition (const Vector &position); 00054 virtual Vector DoGetVelocity (void) const; 00055 00056 StaticSpeedHelper m_helper; 00057 Ptr<PositionAllocator> m_position; 00058 RandomVariable m_speed; 00059 RandomVariable m_pause; 00060 EventId m_event; 00061 }; 00062 00063 } // namespace ns3 00064 00065 #endif /* RANDOM_WAYPOINT_MOBILITY_MODEL_H */