Difference between revisions of "Mobility of Nodes in Cooja"
(→Enabling the Mobility Plugin in Cooja) |
(→Enabling the Mobility Plugin in Cooja) |
||
Line 60: | Line 60: | ||
Now, we need to append the plugin’s path to the existing plugin paths | Now, we need to append the plugin’s path to the existing plugin paths | ||
− | + | Go the end of this field DEFAULT_PROJECTDIRS | |
'''''Insert ‘ ; ‘ symbol''''' | '''''Insert ‘ ; ‘ symbol''''' |
Revision as of 02:21, 7 November 2014
Contents
Introduction
This tutorial teaches you how to enable mobility in Cooja Simulator. This feature can be used to simulate and test mobile ad-hoc network protocols in the Cooja Simulator. After following all the steps mentioned in this tutorial you will be able to sucessfully simulate mobile nodes in your Cooja simulator.
You Will Learn
- How to download and enable mobility plugin in Cooja
- How to use the plugin
Plugins for Cooja
The mobility plugin for cooja can be found at this URL
Create a new directory at
cd contiki/tools/cooja/apps
mkdir mobility
Download and Save all the files into this mobility folder
Now, you have successfully downloaded all the files needed for this plugin
The next thing we need to do is enable this plugin in Cooja
Building the plugin
Navigate to
cd contiki/tools/cooja/apps/mobility
sudo ant jar
This will build the plugin
Enabling the Mobility Plugin in Cooja
Start Cooja Simulator
cd contiki/tools/cooja
sudo ant run
In Cooja,
Settings > External Tools Path…
Edit Settings Screen will pop-up
Scroll down to DEFAULT_PROJECTDIRS
This field is used to specify paths to all the plugins in Cooja Simulator
Here you have to add a path to the downloaded plugin. We do this for linking the plugin with Cooja Simulator
Now, we need to append the plugin’s path to the existing plugin paths
Go the end of this field DEFAULT_PROJECTDIRS
Insert ‘ ; ‘ symbol
Add the plugin’s path
[CONTIKI_DIR]/tools/cooja/apps/mobility
Click Save
Close Cooja Simulator and Start it again.
cd contiki/tools/cooja/
sudo ant run
Now go to
Settings>Cooja Extensions
Cooja Extensions Window will pop-up.
Scroll down to mobility select it and click on “Apply for the session”
Under the Tools tab in Cooja you should see a new “Mobility…” option now
Testing the Plugin
Start a new simulation
File > New Simulation
Add a test mote to your simulation to test the new plugin
Motes > Add Mote > Create a new mote type > Sky Mote …
Compile a simple hello-world.c code on this mote. Now create the mote
Now, we will test our plugin on this mote
Under Tools tab click on mobility Tools > Mobility
Browse and Navigate to
contiki/tools/cooja/apps/mobility/positions.dat
We have instructed our mobility plugin to get the positional information from this positions.dat file
Click Open. A small window will pop-up as shown below
Now, Click on “Start Simulation”
Voila! Your mote will start start moving according to the specified positions.dat file
Positions.dat File structure
Position.dat file contains this information
node time(s) x y 0 0.0 0 10 0 1.0 10 10 0 2.0 10 0 0 3.0 0 0 0 4.0 0 10
The first column specifies the node number The second column is the time-stamp The third column is the x-coordinate The fourth column is the y-coordinate
- node time(s) x y
0 0.0 0 10
This line means node 0 at 0.0sec will be at position co-ordinates (0, 10) Here node 0 is the node ‘1’ on your cooja simulator
If you specify node 1 in the first column it is for node 2
So positions.dat node (n) is actually node (n+1)
Changing positions.dat file
If you want to change the position.dat file. Replace position.dat file with the new file
Under Tools>Mobility
The new positions will be loaded now. Add the required number of nodes in the simulator and start your simulation.
References
This Mobility Plugin is listed in the official Contiki wiki and can be found at these links
https://github.com/contiki-os/contiki/wiki http://sourceforge.net/p/contikiprojects/code/HEAD/tree/sics.se/mobility/
Edited by: Pratyush Deshpande