Friday 30 March 2018

Mobility Plugin in Contiki-3.0 Cooja Simulator

Hi all, In this blog I have included the step by step process of how to add mobility plugin in the cooja simulator.

1. Download the mobility plugin from the below link.

https://github.com/JayanthEM/Contiki

2. Extract the downloaded mobility plugin and move the mobility folder to the below path.


   
    contiki-3.0/tools/cooja/apps/

3. Go to mobility folder and open the build.xml file.

   In the 7th line you will find this
    
    <property name="cooja_jar" value="/home/user/contiki-3.0/tools/cooja/dist/cooja.jar"/>





You want to change the value .

Go to contiki-3.0/tools/cooja/dist/


Right click on cooja.jar and open the properties.Then Copy the location and paste it in the value parameter.i.e, "copied path/cooja.jar"




In mobility folder, check mobility.java file if se.sics.cooja directory is present then change the directory to org.contikios.cooja. Same for the cooja.config file.

4. Open the terminal and run the below command
   It will build the plugin.

   cd contiki-3.0/tools/cooja/apps/mobility

   sudo ant jar




5. Open the cooja simulator

   cd contiki-3.0/tools/cooja
   
   sudo ant run


6. In the Cooja simulator go to

  settings->External tools path

  In the DEFAULT_PROJECTDIRs you want to add the path of the mobility folder. Copy paste the below one.

[CONTIKI_DIR]/tools/cooja/apps/mobility






7. Save and close the cooja simulator.

8. Once again open the cooja simulator and go to

   settings->Cooja extensions.

   There you can find the mobility folder path .Once you click the path you can see mobility.jar.




 click on apply for session.


9. Now go to tools there you can able to find the mobility.
    
  




Note: These process are common for all the contiki versions.

If you find any difficulties let me know in the comments.

Thanks :-)


21 comments:

  1. I can't download the mobility plugin from the link you puted here, i try with another link https://sourceforge.net/p/contikiprojects/code/HEAD/tree/sics.se/mobility/
    I followed all your steps but i didn't get Mobility in tools
    Any help please???

    ReplyDelete
    Replies
    1. https://github.com/JayanthEM/Contiki Try download from this link

      Delete
    2. The Mobility plugin that you downloaded from that link is outdated because the old cooja java directory paths are still being used (se.sics.cooja), while the current structure is org.contikios.cooja.
      Replace all se.sics.cooja by org.contikios.cooja in Mobility.java and also in the cooja.config file. or else download mobility from above link and follow all the steps it will work fine.. :-)

      Delete
  2. After changing DEFAULT_PROJECTDIRs I cant open the cooja simulator.when I run it shows following error

    [delete] Deleting directory /home/iiitmk/Downloads/contiki/contiki/tools/cooja/apps/serial_socket/build

    BUILD FAILED
    /home/iiitmk/Downloads/contiki/contiki/tools/cooja/build.xml:201: The following error occurred while executing this line:
    /home/iiitmk/Downloads/contiki/contiki/tools/cooja/apps/serial_socket/build.xml:22: Unable to delete file /home/iiitmk/Downloads/contiki/contiki/tools/cooja/apps/serial_socket/build/org/contikios/cooja/serialsocket/SerialSocketServer.class

    ReplyDelete
    Replies
    1. I think you would have removed something in the DEFAULT_PROJECTDIRs.Maybe thats why it messed up. Just add the [CONTIKI_DIR]/tools/cooja/apps/mobility .

      Delete
    2. I added that by inserting ; symbol.
      after that I cant run cooja. When I remove the mobility folder from apps ant run will opens.

      Delete
    3. position.dat file is missing in mobility folder. Here you can find https://github.com/msloth/RWMMSim

      Delete
    4. Also in step 4, sudo ant clean then sudo ant jar

      Delete
  3. Sir,
    How can we introduce simulation parameters to contiki3. like
    Simulation Area
    Number of Nodes
    Transmit Power
    Receiving Power
    Initial Energy 100 J
    Simulation Time
    Application Temperature Sensor
    Application Rate
    Packet Size
    No. of Simulation Runs

    ReplyDelete
    Replies
    1. Hi,
      You can able to get the many parameters from powertrace. Include powertrace in your program. For more details check this link http://personal.ee.surrey.ac.uk/Personal/P.Barnaghi/teaching/EEEM048/2015/labs/Lab6.pdf

      Sorry for late reply.

      Delete
    2. how to calculate throughput of CoAP packets

      Delete
  4. Hi
    I am not able to open cooja simulator after plugin. It shows an error that it could not find the MSPSim build file. Did you run " git submodule update --init"?

    ReplyDelete
  5. Hi
    I am not able to open cooja simulator after plugin. It shows an error that it could not find the MSPSim build file. Did you run "git submodule update --init"?

    ReplyDelete
  6. hi
    i want to use of bonnmotion in contiki 2.7. when i type my java binary path it replies:
    No executable "/usr/lib/jvm/java-7-openjdk-1386/bin/java", aborting.
    what can i do
    thank you

    ReplyDelete
    Replies
    1. For Bonnmition check this link https://www.researchgate.net/publication/316464233_A_Tutorial_for_BonnMotion_with_Contiki_Cooja

      Delete
  7. hi ...
    for make position.dat file in cooja contiki 3.0 how can i use of RWMMSim (github)
    thank you

    ReplyDelete
  8. Hi, I want to develop a plugin that would have some functionality like mobility plugin.
    Can anyone help me about from where I should start?

    ReplyDelete
  9. thank you so much . for the solving.

    ReplyDelete
  10. Hi,
    In the step8 it is not showing the plugins:Mobility and jar mobility.
    Do u know how to solve it?

    ReplyDelete
  11. Hello...
    I am not able to find mobility under tools option...Plz help me

    ReplyDelete