Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Digital Photo Camera Triggering (using a GPIO pin)

Module XML file: digital_cam.xml

This module controls triggering of an attached external digital camera via one or more GPIO pins for on/off/shoot/zoom. It can trigger photos based on GPS distance, time or circle radius in both fixedwings and rotorcraft.

Example for airframe file

This example contains all possible configuration options, not all of them are mandatory!

1 <modules>
2  <load name="digital_cam.xml">
3  <define name="DC_SHOOT_ON_BUTTON_RELEASE" />
4  <define name="DC_SHUTTER_GPIO" value="GPIOC,GPIO12" />
5  <define name="DC_ZOOM_IN_GPIO" value="GPIOC,GPIO2" />
6  <define name="DC_ZOOM_OUT_GPIO" value="GPIOC,GPIO5" />
7  <define name="DC_POWER_GPIO" value="GPIOB,GPIO1" />
8  <define name="DC_POWER_OFF_GPIO" value="GPIOC,GPIO1" />
9  <define name="DC_PUSH" value="gpio_set|gpio_clear" />
10  <define name="DC_RELEASE" value="gpio_clear|gpio_set" />
11  <define name="DC_SHUTTER_DELAY" value="0.5" />
12  <define name="DC_POWER_OFF_DELAY" value="0.75" />
13  <define name="DC_AUTOSHOOT_PERIOD" value="1.0" />
14  <define name="DC_AUTOSHOOT_DISTANCE_INTERVAL" value="50" />
15  <define name="DC_AUTOSHOOT_SURVEY_INTERVAL" value="50" />
16  <define name="DC_SHOT_SYNC_SEND" value="TRUE|FALSE" />
17  </load>
18 </modules>

Module configuration options

Define Options

  • name: DC_SHOOT_ON_BUTTON_RELEASE value: None
    Description: if defined, call dc_send_shot_postion on button release instead of on push
  • name: DC_SHUTTER_GPIO value: GPIOC,GPIO12
    Description: mandatory, gpio to control shutter
  • name: DC_ZOOM_IN_GPIO value: GPIOC,GPIO2
    Description: optional, gpio to activate zoom in
  • name: DC_ZOOM_OUT_GPIO value: GPIOC,GPIO5
    Description: optional, gpio to activate zoom out
  • name: DC_POWER_GPIO value: GPIOB,GPIO1
    Description: optional, gpio to turn power on
  • name: DC_POWER_OFF_GPIO value: GPIOC,GPIO1
    Description: optional, gpio to turn power off
  • name: DC_PUSH value: gpio_set|gpio_clear
    Description: specifies whether to set or clear gpio to push the shutter (default: gpio_set)
  • name: DC_RELEASE value: gpio_clear|gpio_set
    Description: specifies whether to set or clear gpio to release the shutter (default: gpio_clear)
  • name: DC_SHUTTER_DELAY value: 0.5
    Description: how long to push shutter in seconds
  • name: DC_POWER_OFF_DELAY value: 0.75
    Description: how long to send power off in seconds
  • name: DC_AUTOSHOOT_PERIOD value: 1.0
    Description: time period for DC_AUTOSHOOT_PERIODIC in seconds
  • name: DC_AUTOSHOOT_DISTANCE_INTERVAL value: 50
    Description: distance interval for DC_AUTOSHOOT_DISTANCE in meters
  • name: DC_AUTOSHOOT_SURVEY_INTERVAL value: 50
    Description: distance interval for DC_AUTOSHOOT_SURVEY in meters
  • name: DC_SHOT_SYNC_SEND value: TRUE|FALSE
    Description: send DC_SHOT message when photo was taken (default: TRUE)

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.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw digital_cam.xml file:

<!DOCTYPE module SYSTEM "./module.dtd">
<module name="digital_cam">
<doc>
<description>
Digital Photo Camera Triggering (using a GPIO pin)
This module controls triggering of an attached external digital camera via one or more GPIO pins for on/off/shoot/zoom.
It can trigger photos based on GPS distance, time or circle radius in both fixedwings and rotorcraft.
</description>
<define name="DC_SHOOT_ON_BUTTON_RELEASE" description="if defined, call dc_send_shot_postion on button release instead of on push"/>
<define name="DC_SHUTTER_GPIO" value="GPIOC,GPIO12" description="mandatory, gpio to control shutter"/>
<define name="DC_ZOOM_IN_GPIO" value="GPIOC,GPIO2" description="optional, gpio to activate zoom in"/>
<define name="DC_ZOOM_OUT_GPIO" value="GPIOC,GPIO5" description="optional, gpio to activate zoom out"/>
<define name="DC_POWER_GPIO" value="GPIOB,GPIO1" description="optional, gpio to turn power on"/>
<define name="DC_POWER_OFF_GPIO" value="GPIOC,GPIO1" description="optional, gpio to turn power off"/>
<define name="DC_PUSH" value="gpio_set|gpio_clear" description="specifies whether to set or clear gpio to push the shutter (default: gpio_set)"/>
<define name="DC_RELEASE" value="gpio_clear|gpio_set" description="specifies whether to set or clear gpio to release the shutter (default: gpio_clear)"/>
<define name="DC_SHUTTER_DELAY" value="0.5" description="how long to push shutter in seconds"/>
<define name="DC_POWER_OFF_DELAY" value="0.75" description="how long to send power off in seconds"/>
<define name="DC_AUTOSHOOT_PERIOD" value="1.0" description="time period for DC_AUTOSHOOT_PERIODIC in seconds"/>
<define name="DC_AUTOSHOOT_DISTANCE_INTERVAL" value="50" description="distance interval for DC_AUTOSHOOT_DISTANCE in meters"/>
<define name="DC_AUTOSHOOT_SURVEY_INTERVAL" value="50" description="distance interval for DC_AUTOSHOOT_SURVEY in meters"/>
<define name="DC_SHOT_SYNC_SEND" value="TRUE|FALSE" description="send DC_SHOT message when photo was taken (default: TRUE)"/>
</doc>
<settings>
<dl_settings name="control">
<dl_settings name="dc">
<dl_setting max="255" min="0" step="1" module="digital_cam/dc" var="0" handler="send_command" shortname="Shutter">
<strip_button name="Photo" icon="digital-camera.png" value="32" group="maindc"/>
<strip_button name="Power" icon="off.png" value="111" group="maindc"/>
<strip_button name="ZoomIn" icon="zoom.png" value="116" group="dczoom"/>
<strip_button name="ZoomOut" icon="zoom.png" value="119" group="dczoom"/>
</dl_setting>
<dl_setting max="3" min="0" step="1" var="dc_autoshoot" values="STOP|PERIODIC|DISTANCE|EXT_TRIG">
<strip_button name="Start Autoshoot" icon="dcstart.png" value="1" group="dcauto"/>
<strip_button name="Stop Autoshoot" icon="dcstart.png" value="0" group="dcauto"/>
</dl_setting>
<dl_setting max="60" min="0.1" step="0.5" var="dc_autoshoot_period" shortname="Periodic" param="DC_AUTOSHOOT_PERIOD" unit="sec"/>
<dl_setting max="255" min="0" step="1" var="dc_distance_interval" shortname="dist" param="DC_AUTOSHOOT_DISTANCE_INTERVAL" unit="meter"/>
<dl_setting max="250" min="0" step="5" module="digital_cam/dc" var="dc_survey_interval" handler="Survey" shortname="Survey-Interval"/>
<dl_setting max="90" min="5" step="5" module="digital_cam/dc" var="dc_circle_interval" handler="Circle" shortname="Circle-Interval"/>
<dl_setting max="1" min="0" step="1" var="dc_cam_tracing" shortname="Cam-Tracing"/>
</dl_settings>
</dl_settings>
</settings>
<conflicts>digital_cam_i2c,digital_cam_servo,digital_cam_uart,digital_cam_video</conflicts>
<header>
<file name="gpio_cam_ctrl.h"/>
<file name="dc.h"/>
</header>
<init fun="gpio_cam_ctrl_init()"/>
<periodic fun="gpio_cam_ctrl_periodic()" freq="10" autorun="TRUE"/>
<makefile target="ap|sim|nps">
<define name="DIGITAL_CAM" />
<file name="gpio_cam_ctrl.c"/>
<file name="dc.c"/>
</makefile>
</module>