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
switch_servo module

Swicht using a Servo

No detailed description...

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="switch_servo">
2  <define name="SWITCH_SERVO_ON_VALUE" value="pwm" />
3  <define name="SWITCH_SERVO_OFF_VALUE" value="pwm" />
4  <define name="SWITCH_SERVO_SERVO" value="nb" />
5 </module>

Module configuration options

Define Options

  • name: SWITCH_SERVO_ON_VALUE value: pwm
    Description: servo value in usec
  • name: SWITCH_SERVO_OFF_VALUE value: pwm
    Description: servo value in usec
  • name: SWITCH_SERVO_SERVO value: nb
    Description: Id of the servo (default: SWITCH)

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.

  • switch_servo_periodic()
    • Frequency in Hz: 10.
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.


Header Files

The following headers are automatically included in modules.h

Source Files

Raw switch_servo.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="switch_servo" dir="switching">
<description>Swicht using a Servo</description>
<define name="SWITCH_SERVO_ON_VALUE" value="pwm" description="servo value in usec"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="pwm" description="servo value in usec"/>
<define name="SWITCH_SERVO_SERVO" value="nb" description="Id of the servo (default: SWITCH)"/>
<dl_settings NAME="Switch Servo">
<dl_settings NAME="SWITCH">
<dl_setting var="switch_servo_on" min="0" step="1" max="1" module="switching/switch_servo" values="Off|On">
<strip_button name="ON" value="1" group="switching"/>
<strip_button name="OFF" value="0" group="switching"/>
<file name="switch_servo.h"/>
<init fun="switch_servo_init()"/>
<periodic fun="switch_servo_periodic()" freq="10."/>
<makefile target="ap|sim|nps">
<!-- these parameters should be set for that module in the airframe file unless you want the defaults
Servo value in usec
<load name="switch_servo.xml">
<define name="SWITCH_SERVO_ON_VALUE" value="2000"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="1000"/>
<define name="SWITCH_SERVO_SERVO" value="SWITCH"/>
The servo will not exceed the min and max positions defined in the servo section
<file name="switch_servo.c"/>