Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Camera control for rotorcraft

Module XML file: rotorcraft_cam.xml

The camera is controled by the heading of the vehicle for pan and can be controlled by a servo for tilt if defined.

Four modes:

  • NONE: no control
  • MANUAL: the servo position is set with PWM
  • HEADING: the servo position and the heading of the rotorcraft are set with angles
  • WP: the camera is tracking a waypoint (Default: CAM)

If ROTORCRAFT_CAM_SWITCH_GPIO is defined, this gpio is set/cleared to switch the power of the camera on in normal modes and disable it when in NONE mode. On boards with CAM_SWITCH, ROTORCRAFT_CAM_SWITCH_GPIO can be defined to CAM_SWITCH_GPIO.

Module configuration options

Airframe file section

  • section name: CAM prefix: ROTORCRAFT_CAM_
    • name DEFAULT_MODE value: MODE_NONE|MODE_MANUAL|MODE_HEADING|MODE_WP
      Description: Select default mode (default: MODE_NONE)
    • name SWITCH_GPIO value: gpio
      Description: GPIO used to turn on/off the camer power, e.g. CAM_SWITCH_GPIO or GPIOB,GPIO22. Nothing set by default.
    • name CAM_ON value: gpio_set|gpio_clear
      Description: Gpio output level to turn camera power power on. gpio_set (default) or gpio_clear
    • name CAM_OFF value: gpio_set|gpio_clear
      Description: Gpio output level to turn camera power power off. gpio_set or gpio_clear (default)
    • name TILT_SERVO value: name
      Description: Servo name for tilt control (no tilt control if not defined)
    • name TILT_ANGLE_MIN value: angle
      Description: Tilt angle corresponding to the servo min position
    • name TILT_ANGLE_MAX value: angle
      Description: Tilt angle corresponding to the servo max position
    • name USE_PAN value: TRUE|FALSE
      Description: Enable pan control with heading (default: TRUE)
    • name TRACK_WP value: WP_XXX
      Description: Enable waypoint tracking mode on the selected WP (default: enable if waypoint CAM is defined)
    • name STICK_TILT_INC value: angle/stick_input
      Description: Sensitivity of the datalink stick tilt control (default: 10 deg)
    • name STICK_PAN_INC value: angle/stick_input
      Description: Sensitivity of the datalink stick pan control (default: 20 deg)

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.

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

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw rotorcraft_cam.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="rotorcraft_cam" dir="cam_control">
<doc>
<description>
Camera control for rotorcraft.
The camera is controled by the heading of the vehicle for pan and can be controlled by a servo for tilt if defined.
Four modes:
- NONE: no control
- MANUAL: the servo position is set with PWM
- HEADING: the servo position and the heading of the rotorcraft are set with angles
- WP: the camera is tracking a waypoint (Default: CAM)
If ROTORCRAFT_CAM_SWITCH_GPIO is defined, this gpio is set/cleared to switch the power
of the camera on in normal modes and disable it when in NONE mode.
On boards with CAM_SWITCH, ROTORCRAFT_CAM_SWITCH_GPIO can be defined to CAM_SWITCH_GPIO.
</description>
<section name="CAM" prefix="ROTORCRAFT_CAM_">
<define name="DEFAULT_MODE" value="MODE_NONE|MODE_MANUAL|MODE_HEADING|MODE_WP" description="Select default mode (default: MODE_NONE)"/>
<define name="SWITCH_GPIO" value="gpio" description="GPIO used to turn on/off the camer power, e.g. CAM_SWITCH_GPIO or GPIOB,GPIO22. Nothing set by default."/>
<define name="CAM_ON" value="gpio_set|gpio_clear" description="Gpio output level to turn camera power power on. gpio_set (default) or gpio_clear"/>
<define name="CAM_OFF" value="gpio_set|gpio_clear" description="Gpio output level to turn camera power power off. gpio_set or gpio_clear (default) "/>
<define name="TILT_SERVO" value="name" description="Servo name for tilt control (no tilt control if not defined)"/>
<define name="TILT_ANGLE_MIN" value="angle" description="Tilt angle corresponding to the servo min position"/>
<define name="TILT_ANGLE_MAX" value="angle" description="Tilt angle corresponding to the servo max position"/>
<define name="USE_PAN" value="TRUE|FALSE" description="Enable pan control with heading (default: TRUE)"/>
<define name="TRACK_WP" value="WP_XXX" description="Enable waypoint tracking mode on the selected WP (default: enable if waypoint CAM is defined)"/>
<define name="STICK_TILT_INC" value="angle/stick_input" description="Sensitivity of the datalink stick tilt control (default: 10 deg)"/>
<define name="STICK_PAN_INC" value="angle/stick_input" description="Sensitivity of the datalink stick pan control (default: 20 deg)"/>
</section>
</doc>
<header>
<file name="rotorcraft_cam.h"/>
</header>
<init fun="rotorcraft_cam_init()"/>
<periodic fun="rotorcraft_cam_periodic()" freq="10."/>
<datalink message="ROTORCRAFT_CAM_STICK" fun="ROTORCRAFT_CAM_STICK_PARSE(dl_buffer)"/>
<makefile>
<file name="rotorcraft_cam.c"/>
</makefile>
</module>