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.
https://anrg.usc.edu/contiki/index.php/Mobility_of_Nodes_in_Cooja

Another good read that may help on this plugin-install is
http://contikiemj.blogspot.com/

Plugin source

The mobility plugin source used in this article is available at the Github link
https://github.com/JayanthEM/Contiki

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.

~/contiki-ng/tools/cooja/apps/mobility/java/Mobility.java:69:
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

import org.contikios.cooja.dialogs.MessageListUI;

private MessageListUI log = new MessageListUI();

And then
$sudo ant jar
for the plugin would be a success as below.

Finally...

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
https://github.com/JayanthEM/Contiki/tree/master/mobility

Here is a sample video I created

https://youtu.be/bYit46sAFWs

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store