Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
rpm_sensor module

RPM sensor based on time difference between pulses

It uses an PWM input to measure the period between pulses.

Example for airframe file

Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!

1 <module name="pwm_meas"/>
2 <module name="rpm_sensor">
3  <define name="RPM_PULSE_PER_RND" value="14" />
4  <define name="RPM_FILTER_TAU" value="0.3" />
5  <configure name="RPM_PWM_CHANNEL" value="PWM_INPUTX" />
6 </module>

Module configuration options

Configure Options

  • name: RPM_PWM_CHANNEL value: PWM_INPUTX
    Description: Select PWM input channel for RPM sensor

Define Options

  • name: RPM_PULSE_PER_RND value: 14
    Description: Amount of pulses per round
  • name: RPM_FILTER_TAU value: 0.3
    Description: 1/cut-off-frequency = filter time

Dependencies

Module functions

Init Functions

These initialization functions are called once on startup.

Periodic Functions

These functions are called periodically at the specified frequency from the module periodic loop.

  • rpm_sensor_periodic()
    • Running at maximum module frequency.
    • Autorun: TRUE
      Periodic function automatically starts after init.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw rpm_sensor.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="rpm_sensor" dir="sensors">
<doc>
<description>RPM sensor based on time difference between pulses
It uses an PWM input to measure the period between pulses.
</description>
<configure name="RPM_PWM_CHANNEL" value="PWM_INPUTX" description="Select PWM input channel for RPM sensor"/>
<define name="RPM_PULSE_PER_RND" value="14" description="Amount of pulses per round"/>
<define name="RPM_FILTER_TAU" value="0.3" description="1/cut-off-frequency = filter time"/>
</doc>
<depends>pwm_meas</depends>
<header>
<file name="rpm_sensor.h"/>
</header>
<init fun="rpm_sensor_init()"/>
<periodic fun="rpm_sensor_periodic()" autorun="TRUE"/>
<makefile>
<file name="rpm_sensor.c"/>
<configure name="RPM_PWM_CHANNEL" default="PWM_INPUT1"/>
<define name="RPM_PWM_CHANNEL" value="$(RPM_PWM_CHANNEL)"/>
<define name="$(RPM_PWM_CHANNEL)_TICKS_PER_USEC" value="1" />
<define name="USE_$(RPM_PWM_CHANNEL)" value="PWM_PULSE_TYPE_ACTIVE_HIGH" />
</makefile>
</module>