contikicontiki-ng

Contiki: How to switch between different RPL objective functions?


In Contiki 3.0 it was possible to change the RPL objective function by modifying the file Makefile.rpl.

How to do this in Contiki 3.x or Contiki-NG?


Solution

  • You can do this through modifying the compile-time configuration. For example, to switch from the default RPL objective function (MRHOF) to OF0, add these lines to project-conf.h:

    #define RPL_CONF_OF_OCP RPL_OCP_OF0 /* tells to use OF0 for DAGs rooted at this node */
    #define RPL_CONF_SUPPORTED_OFS {&rpl_of0, &rpl_mrhof} /* tells to compile in support for both OF0 and MRHOF */
    

    You can then verify that you are using the selected objective function with the viewconf tool:

    $ make viewconf
    ...
    ##### "RPL_CONF_OF_OCP": __________________________ == RPL_OCP_OF0
    ...