Cooja Simulator Mobility Plugin
The Cooja Simulator can be used to simulate and test mobile ad-hoc network protocols. However, an external Mobility plugin needs to be added to the simulator to achieve this.
This article brings clarity over installing the Cooja Simulator plugin on the Contiki-NG (Next Generation) — the OS for IoT devices.
Where to begin
A good way to enable the mobility plugin in Cooja Simulator is shown at the link below.
Another good read that may help on this plugin-install is
The mobility plugin source used in this article is available at the Github link
The standard steps for setting up Contiki Mobility Plugin in Cooja Simulator are summarized in the supplied README.txt look as below.
Hmm.. the blocker
However, while building the Cooja Mobility Plugin, you may be blocked by the below error.
error: MessageList is abstract; cannot be instantiated
This error can be resolved by adding/modifying the code lines in Mobility.java
at location (~/Contiki-ng/tools/coojs/apps/mobility/java/Mobility.java) as below
private MessageListUI log = new MessageListUI();
$sudo ant jar
for the plugin would be a success as below.
Launch the cooja simulator as below from ~/contiki-ng/tools/cooja location
If you followed other steps correctly from the above links, you should see the Mobility plugin added in the Cooja Simulator.
How to use
The Mobility plugin picks the location (x,y) coordinates of a node and its progressive time values from a positions.dat file. This file needs to be created under the mobility folder. It does not come with the default Github download. The time values are in seconds and the x,y positions are in meters, with the origin specified in the top left corner.
As input, it takes
line separated position data in the following format:
nodeid time xpos ypos
Here is an example with two nodes:
0 0.00000000 10 10
1 0.00000000 20 15
0 0.25000000 10.5000000000 20
1 0.25000000 20.5000000000 25
0 0.50000000 20 10
1 0.50000000 30 15
Read more here at the Readme.txt
Here is a sample video I created