Khepera III Toolbox/The Toolbox/Modules/measurement

From Wikibooks, open books for an open world
< Khepera III Toolbox‎ | The Toolbox‎ | Modules
Jump to navigation Jump to search

The measurement module provides a common framework for all programs which solely read a sensor (or several sensors) and report the result. Programs using this module therefore accept the same command line options to specify

  • the interval between two measurements (-w US)
  • the number of measurements to be taken (-r N or just -r for continuous measurements)
  • whether to print the results
    • right after measuring (default)
    • at the end (-f)
    • not at all (-F)


Check out the source code of the battery program for an example.


This module controls the main program flow and requires only two hook functions:

  • A hook function take one measurement (hook_measure)
  • A hook function to print one measurement (hook_print)

Furthermore, an array for storing intermediate measurement must be provided.