[dc] add pprzlink digital cam module and factorize modules (#3111)

- new digital_cam_pprzlink module
- factorize module with digital_cam_common
- rename digital_cam to digital_cam_gpio
- add test nodes to modules
This commit is contained in:
Gautier Hattenberger
2023-09-27 14:31:14 +02:00
committed by GitHub
parent 63fd5837a8
commit 6948aef012
24 changed files with 317 additions and 178 deletions
+1 -1
View File
@@ -54,7 +54,7 @@
<configure name="EXTRA_DL_PORT" value="UART6"/> <configure name="EXTRA_DL_PORT" value="UART6"/>
<configure name="EXTRA_DL_BAUD" value="B115200"/> <configure name="EXTRA_DL_BAUD" value="B115200"/>
</module> </module>
<module name="digital_cam"> <module name="digital_cam_gpio">
<define name="DC_SHUTTER_GPIO" value="GPIOB,GPIO15"/> <!-- Apogee AUX4 --> <define name="DC_SHUTTER_GPIO" value="GPIOB,GPIO15"/> <!-- Apogee AUX4 -->
<define name="DC_AUTOSHOOT_DISTANCE_INIT" value="4"/> <define name="DC_AUTOSHOOT_DISTANCE_INIT" value="4"/>
</module> </module>
@@ -263,7 +263,7 @@
<define name="POLYSURVEY_DEFAULT_DISTANCE" value="10"/><!-- in M --> <define name="POLYSURVEY_DEFAULT_DISTANCE" value="10"/><!-- in M -->
</module> </module>
<!--<module name="digital_cam">--> <!--<module name="digital_cam_gpio">-->
<!-- <define name="DC_SHUTTER_GPIO" value="GPIOB,GPIO22"/>--> <!-- should be value="CAM_SWITCH_GPIO"/>--> <!-- <define name="DC_SHUTTER_GPIO" value="GPIOB,GPIO22"/>--> <!-- should be value="CAM_SWITCH_GPIO"/>-->
<!--</module>--> <!--</module>-->
@@ -344,7 +344,7 @@ NOTES:
<module name="photogrammetry_calculator"/> <module name="photogrammetry_calculator"/>
<!--Unkn aux camsw --> <!--Unkn aux camsw -->
<module name="digital_cam"> <module name="digital_cam_gpio">
<define name="DC_SHUTTER_GPIO" value="GPIOB,GPIO2"/><!-- correct pin add to board file one from Wifi pins--> <define name="DC_SHUTTER_GPIO" value="GPIOB,GPIO2"/><!-- correct pin add to board file one from Wifi pins-->
</module> </module>
@@ -225,7 +225,7 @@
<define name="AGL_DIST_FILTER" value="0.1"/> <define name="AGL_DIST_FILTER" value="0.1"/>
</module> </module>
<!--<module name="digital_cam">--> <!--<module name="digital_cam_gpio">-->
<!-- <define name="DC_SHUTTER_GPIO" value="GPIOB,GPIO22"/>--> <!-- should be value="CAM_SWITCH_GPIO"/>--> <!-- <define name="DC_SHUTTER_GPIO" value="GPIOB,GPIO22"/>--> <!-- should be value="CAM_SWITCH_GPIO"/>-->
<!--</module>--> <!--</module>-->
+1 -1
View File
@@ -67,7 +67,7 @@
<define name="STROBE_LIGHT_MODE_DEFAULT" value="6"/> <define name="STROBE_LIGHT_MODE_DEFAULT" value="6"/>
<define name="NAV_LIGHT_MODE_DEFAULT" value="4"/> <define name="NAV_LIGHT_MODE_DEFAULT" value="4"/>
</module> </module>
<module name="digital_cam"> <module name="digital_cam_gpio">
<define name="DC_SHUTTER_GPIO" value="GPIOC,GPIO12"/> <define name="DC_SHUTTER_GPIO" value="GPIOC,GPIO12"/>
</module> </module>
<!-- module name="nav" type="catapult"/--> <!-- module name="nav" type="catapult"/-->
+1 -1
View File
@@ -288,7 +288,7 @@
</module> </module>
<!-- <module name="digital_cam_i2c"/> --> <!-- <module name="digital_cam_i2c"/> -->
<module name="digital_cam"> <module name="digital_cam_gpio">
<define name="DC_SHUTTER_GPIO" value="GPIOC,GPIO12"/> <define name="DC_SHUTTER_GPIO" value="GPIOC,GPIO12"/>
</module> </module>
+7 -61
View File
@@ -1,74 +1,20 @@
<!DOCTYPE module SYSTEM "./module.dtd"> <!DOCTYPE module SYSTEM "./module.dtd">
<module name="digital_cam"> <module name="digital_cam" dir="digital_cam">
<doc> <doc>
<description> <description>
Digital Photo Camera Triggering (using a GPIO pin) 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. Deprecated, use digital_cam_gpio module instead
It can trigger photos based on GPS distance, time or circle radius in both fixedwings and rotorcraft.
</description> </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)"/>
<define name="DC_SHOT_EXTRA_DL" value="TRUE|FALSE" description="send DC_SHOT message other extra datalink like companion CPU (default: FALSE, requires DC_SHOT_SYNC_SEND)"/>
</doc> </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>
<dep> <dep>
<conflicts>digital_cam_i2c,digital_cam_servo,digital_cam_uart,digital_cam_video</conflicts> <depends>digital_cam_gpio</depends>
<provides>digital_cam</provides>
</dep> </dep>
<makefile>
<header> <raw>
<file name="gpio_cam_ctrl.h"/> $(warning Warning: digital_cam is deprecated. Use digital_cam_gpio instead.)
<file name="dc.h"/> </raw>
</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> </makefile>
</module> </module>
+61
View File
@@ -0,0 +1,61 @@
<!DOCTYPE module SYSTEM "./module.dtd">
<module name="digital_cam_common" dir="digital_cam">
<doc>
<description>
Digital Photo Camera Triggering, common interface
This module controls triggering of an attached external digital camera.
It can trigger photos based on GPS distance, time or circle radius in both fixedwings and rotorcraft.
The specific way to trigger the camera is implemented in specific modules.
</description>
<section name="DIGITAL_CAM" prefix="DC_">
<define name="AUTOSHOOT_PERIOD" value="1.0" description="time period for DC_AUTOSHOOT_PERIODIC in seconds"/>
<define name="AUTOSHOOT_DISTANCE_INTERVAL" value="50" description="distance interval for DC_AUTOSHOOT_DISTANCE in meters"/>
<define name="AUTOSHOOT_SURVEY_INTERVAL" value="50" description="distance interval for DC_AUTOSHOOT_SURVEY in meters"/>
<define name="SHOT_SYNC_SEND" value="TRUE|FALSE" description="send DC_SHOT message when photo was taken (default: TRUE)"/>
<define name="SHOT_EXTRA_DL" value="TRUE|FALSE" description="send DC_SHOT message other extra datalink like companion CPU (default: FALSE, requires DC_SHOT_SYNC_SEND)"/>
</section>
</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|SURVEY|CIRCLE">
<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>
<dep>
<provides>digital_cam</provides>
</dep>
<header>
<file name="dc.h"/>
</header>
<init fun="dc_init()"/>
<makefile>
<define name="DIGITAL_CAM" />
<file name="dc.c"/>
<test firmware="rotorcraft">
<define name="DOWNLINK_TRANSPORT" value="pprz_tp"/>
<define name="DOWNLINK_DEVICE" value="uart0"/>
<define name="USE_UART0"/>
</test>
</makefile>
</module>
+39
View File
@@ -0,0 +1,39 @@
<!DOCTYPE module SYSTEM "./module.dtd">
<module name="digital_cam_gpio" dir="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.
</description>
<section name="DIGITAL_CAM" prefix="DC_">
<define name="SHOOT_ON_BUTTON_RELEASE" description="if defined, call dc_send_shot_postion on button release instead of on push"/>
<define name="SHUTTER_GPIO" value="GPIOC,GPIO12" description="mandatory, gpio to control shutter"/>
<define name="ZOOM_IN_GPIO" value="GPIOC,GPIO2" description="optional, gpio to activate zoom in"/>
<define name="ZOOM_OUT_GPIO" value="GPIOC,GPIO5" description="optional, gpio to activate zoom out"/>
<define name="POWER_GPIO" value="GPIOB,GPIO1" description="optional, gpio to turn power on"/>
<define name="POWER_OFF_GPIO" value="GPIOC,GPIO1" description="optional, gpio to turn power off"/>
<define name="PUSH" value="gpio_set|gpio_clear" description="specifies whether to set or clear gpio to push the shutter (default: gpio_set)"/>
<define name="RELEASE" value="gpio_clear|gpio_set" description="specifies whether to set or clear gpio to release the shutter (default: gpio_clear)"/>
<define name="SHUTTER_DELAY" value="0.5" description="how long to push shutter in seconds"/>
<define name="POWER_OFF_DELAY" value="0.75" description="how long to send power off in seconds"/>
</section>
</doc>
<dep>
<depends>digital_cam_common</depends>
<conflicts>digital_cam_i2c,digital_cam_servo,digital_cam_uart,digital_cam_video,digital_cam_pprzlink</conflicts>
</dep>
<header>
<file name="gpio_cam_ctrl.h"/>
</header>
<init fun="gpio_cam_ctrl_init()"/>
<periodic fun="gpio_cam_ctrl_periodic()" freq="10" autorun="TRUE"/>
<makefile>
<file name="gpio_cam_ctrl.c"/>
<test arch="chibios">
<define name="DC_SHUTTER_GPIO" value="GPIOC,GPIO12"/>
<define name="GPIO_CAM_CTRL_PERIODIC_FREQ" value="10."/>
</test>
</makefile>
</module>
+16 -10
View File
@@ -8,25 +8,22 @@
This module controls triggering of an attached device via an I2C command. This module controls triggering of an attached device via an I2C command.
Typically a remote microcontroller (atmega/arduino) will then use the triggering/zoom/power commands. Typically a remote microcontroller (atmega/arduino) will then use the triggering/zoom/power commands.
Using the PAYLOAD_COMMAND, all functions of the camera can be controlled. Using the PAYLOAD_COMMAND, all functions of the camera can be controlled.
It can trigger photos based on GPS distance, time or circle radius in both fixedwings and rotorcraft.
</description> </description>
<configure name="ATMEGA_I2C_DEV" value="i2cX" description="select which i2c peripheral to use (default i2c0)"/> <configure name="ATMEGA_I2C_DEV" value="i2cX" description="select which i2c peripheral to use (default i2c0)"/>
<define name="DC_SHOOT_ON_BUTTON_RELEASE" /> <section name="DIGITAL_CAM" prefix="DC_">
<define name="DC_SHOT_SYNC_SEND" value="TRUE|FALSE" description="send DC_SHOT message when photo was taken (default: TRUE)"/> <define name="SHOOT_ON_BUTTON_RELEASE" />
</section>
</doc> </doc>
<dep> <dep>
<conflicts>digital_cam,digital_cam_servo,digital_cam_uart,digital_cam_video</conflicts> <depends>digital_cam_common</depends>
<provides>digital_cam</provides> <conflicts>digital_cam_gpio,digital_cam_servo,digital_cam_uart,digital_cam_video,digital_cam_pprzlink</conflicts>
</dep> </dep>
<header> <header>
<file name="atmega_i2c_cam_ctrl.h"/> <file name="atmega_i2c_cam_ctrl.h"/>
<file name="dc.h"/>
</header> </header>
<init fun="atmega_i2c_cam_ctrl_init()"/> <init fun="atmega_i2c_cam_ctrl_init()"/>
<periodic fun="atmega_i2c_cam_ctrl_periodic()" autorun="TRUE" freq="10"/> <periodic fun="atmega_i2c_cam_ctrl_periodic()" autorun="TRUE" freq="10"/>
<event fun="atmega_i2c_cam_ctrl_event()"/> <event fun="atmega_i2c_cam_ctrl_event()"/>
<datalink message="PAYLOAD_COMMAND" fun="ParseCameraCommand(buf)"/> <datalink message="PAYLOAD_COMMAND" fun="ParseCameraCommand(buf)"/>
<makefile target="ap"> <makefile target="ap">
@@ -34,12 +31,21 @@
<define name="USE_$(ATMEGA_I2C_DEV_UPPER)"/> <define name="USE_$(ATMEGA_I2C_DEV_UPPER)"/>
<define name="ATMEGA_I2C_DEV" value="$(ATMEGA_I2C_DEV_LOWER)"/> <define name="ATMEGA_I2C_DEV" value="$(ATMEGA_I2C_DEV_LOWER)"/>
<file name="atmega_i2c_cam_ctrl.c"/> <file name="atmega_i2c_cam_ctrl.c"/>
<file name="dc.c"/> <test firmware="rotorcraft">
<define name="DOWNLINK_TRANSPORT" value="pprz_tp"/>
<define name="DOWNLINK_DEVICE" value="uart0"/>
<define name="USE_UART0"/>
<define name="USE_I2C0"/>
</test>
</makefile> </makefile>
<makefile target="sim"> <makefile target="sim">
<file name="sim_i2c_cam_ctrl.c"/> <file name="sim_i2c_cam_ctrl.c"/>
<file name="dc.c"/> <test firmware="rotorcraft">
<define name="DOWNLINK_TRANSPORT" value="pprz_tp"/>
<define name="DOWNLINK_DEVICE" value="uart0"/>
<define name="USE_UART0"/>
</test>
</makefile> </makefile>
</module> </module>
+42
View File
@@ -0,0 +1,42 @@
<!DOCTYPE module SYSTEM "./module.dtd">
<module name="digital_cam_pprzlink" dir="digital_cam">
<doc>
<description>
Digital Photo Camera Triggering using PPRZLINK messages
Sends DC_SHOT and PAYLOAD_COMMAND messages over serial link.
Flags DC_SHOT_SYNC_SEND and DC_SHOT_EXTRA_DL are set to TRUE.
An example application can be found at: https://github.com/enacuavlab/ueye_pprzlink
This project controls a ueye camera with a NanoPI (or equivalent)
connected to the autopilot. It is possible to trigger the camera
with DC_SHOT messages (images are georeference with GPS coordinates
in Exif), but also to change the exposure and get the feedback
from the camera (useful to check the result when autoexpo is requested).
</description>
</doc>
<dep>
<depends>digital_cam_common,extra_dl</depends>
<conflicts>digital_cam_gpio,digital_cam_i2c,digital_cam_servo,digital_cam_uart,digital_cam_video</conflicts>
</dep>
<header>
<file name="pprzlink_cam_ctrl.h"/>
</header>
<init fun="pprzlink_cam_ctrl_init()"/>
<periodic fun="pprzlink_cam_ctrl_periodic()" freq="10" autorun="TRUE"/>
<datalink message="PAYLOAD_COMMAND" fun="dc_expo_cb(buf)"/>
<makefile target="ap|sim|nps">
<define name="DIGITAL_CAM"/>
<define name="DC_SHOT_SYNC_SEND"/>
<define name="DC_SHOT_EXTRA_DL"/>
<file name="pprzlink_cam_ctrl.c"/>
<test>
<define name="DOWNLINK_TRANSPORT" value="pprz_tp"/>
<define name="DOWNLINK_DEVICE" value="uart0"/>
<define name="USE_UART0"/>
<define name="EXTRA_DOWNLINK_DEVICE" value="uart1"/>
<define name="USE_UART1"/>
</test>
</makefile>
</module>
+16 -18
View File
@@ -6,36 +6,34 @@
Digital Photo Camera Triggering (using a servo) Digital Photo Camera Triggering (using a servo)
This module controls triggering of an attached external digital camera via a servo channel. This module controls triggering of an attached external digital camera via a servo channel.
It can trigger photos based on GPS distance, time or circle radius in both fixedwings and rotorcraft.
</description> </description>
<define name="DC_SHOOT_ON_BUTTON_RELEASE" description="if defined, call dc_send_shot_postion on button release instead of on push"/> <section name="DIGITAL_CAM" prefix="DC_">
<define name="DC_SHUTTER_SERVO" value="servo" description="mandatory, Servo to control shutter"/> <define name="SHOOT_ON_BUTTON_RELEASE" description="if defined, call dc_send_shot_postion on button release instead of on push"/>
<define name="DC_ZOOM_IN_SERVO" value="servo" description="optional, Servo to activate zoom in"/> <define name="SHUTTER_SERVO" value="servo" description="mandatory, Servo to control shutter"/>
<define name="DC_ZOOM_OUT_SERVO" value="servo" description="optional, Servo to activate zoom out"/> <define name="ZOOM_IN_SERVO" value="servo" description="optional, Servo to activate zoom in"/>
<define name="DC_POWER_SERVO" value="servo" description="optional, Servo to control power"/> <define name="ZOOM_OUT_SERVO" value="servo" description="optional, Servo to activate zoom out"/>
<define name="DC_AUTOSHOOT_PERIOD" value="0.5" description="time period for DC_AUTOSHOOT_PERIODIC in seconds"/> <define name="POWER_SERVO" value="servo" description="optional, Servo to control power"/>
<define name="DC_AUTOSHOOT_DISTANCE_INTERVAL" value="50" description="grid in meters"/> </section>
</doc> </doc>
<dep> <dep>
<conflicts>digital_cam,digital_cam_i2c,digital_cam_uart,digital_cam_video</conflicts> <depends>digital_cam_common</depends>
<provides>digital_cam</provides> <conflicts>digital_cam_gpio,digital_cam_i2c,digital_cam_uart,digital_cam_video,digital_cam_pprzlink</conflicts>
</dep> </dep>
<header> <header>
<file name="servo_cam_ctrl.h"/> <file name="servo_cam_ctrl.h"/>
<file name="dc.h"/>
</header> </header>
<init fun="servo_cam_ctrl_init()"/> <init fun="servo_cam_ctrl_init()"/>
<periodic fun="servo_cam_ctrl_periodic()" freq="10" autorun="TRUE"/> <periodic fun="servo_cam_ctrl_periodic()" freq="10" autorun="TRUE"/>
<makefile target="ap|sim|nps"> <makefile target="ap|sim|nps">
<define name="DIGITAL_CAM"/> <define name="DIGITAL_CAM"/>
<file name="servo_cam_ctrl.c"/> <file name="servo_cam_ctrl.c"/>
<file name="dc.c"/>
<define name="SENSOR_SYNC_SEND" value="1"/> <define name="SENSOR_SYNC_SEND" value="1"/>
<test firmware="rotorcraft">
<define name="DC_SHUTTER_SERVO" value="1"/>
<define name="DOWNLINK_TRANSPORT" value="pprz_tp"/>
<define name="DOWNLINK_DEVICE" value="uart0"/>
<define name="USE_UART0"/>
<define name="SERVO_CAM_CTRL_PERIODIC_FREQ" value="10."/>
</test>
</makefile> </makefile>
</module> </module>
+1 -2
View File
@@ -12,8 +12,7 @@
<define name="DC_RADIO_SHOOT" value="RADIO_xxx" description="specifies the channel to be used to trigger the camera by radio transmiter"/> <define name="DC_RADIO_SHOOT" value="RADIO_xxx" description="specifies the channel to be used to trigger the camera by radio transmiter"/>
</doc> </doc>
<dep> <dep>
<depends>digital_cam|digital_cam_servo|digital_cam_uart|digital_cam_i2c|digital_cam_video</depends> <depends>digital_cam|digital_cam_gpio|digital_cam_servo|digital_cam_uart|digital_cam_i2c|digital_cam_video|digital_cam_pprzlink</depends>
<provides>digital_cam</provides>
</dep> </dep>
<header> <header>
<file name="dc_shoot_rc.h"/> <file name="dc_shoot_rc.h"/>
+7 -28
View File
@@ -5,9 +5,8 @@
Digital Photo Camera Triggering (using a UART link) Digital Photo Camera Triggering (using a UART link)
This module controls triggering of an attached external digital camera via UART commands. This module controls triggering of an attached external digital camera via UART commands.
It can trigger photos based on GPS distance, time or circle radius in both fixedwings and rotorcraft.
This module fullfilss 4 functions: This module fullfills 4 functions:
1) send shoot commands over UART 1) send shoot commands over UART
2) Besides triggering the shooting of images, the module also sends attitude and other relevant data. 2) Besides triggering the shooting of images, the module also sends attitude and other relevant data.
Typically an external linux camera or linux computer will receive the attitude and position data and add Typically an external linux camera or linux computer will receive the attitude and position data and add
@@ -19,30 +18,9 @@
The linux program used to parse the UART command is given in the subdirectory. The linux program used to parse the UART command is given in the subdirectory.
</description> </description>
<define name="DC_AUTOSHOOT_PERIOD" value="0.5" description="time period for DC_AUTOSHOOT_PERIODIC in seconds"/>
<define name="DC_AUTOSHOOT_DISTANCE_INTERVAL" value="50" description="grid in meters"/>
<define name="DC_SHOT_SYNC_SEND" value="TRUE|FALSE" description="send DC_SHOT message when photo was taken (default: TRUE)"/>
</doc> </doc>
<settings> <settings>
<dl_settings name="control"> <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"/>
</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="dcstop.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 name="tb"> <dl_settings name="tb">
<dl_setting max="2" min="0" step="1" var="digital_cam_uart_thumbnails" shortname="thumbs"> <dl_setting max="2" min="0" step="1" var="digital_cam_uart_thumbnails" shortname="thumbs">
<strip_button name="DL Thumbs High" icon="on.png" value="2" group="ticket"/> <strip_button name="DL Thumbs High" icon="on.png" value="2" group="ticket"/>
@@ -54,12 +32,11 @@
</dl_settings> </dl_settings>
</settings> </settings>
<dep> <dep>
<conflicts>digital_cam,digital_cam_servo,digital_cam_i2c</conflicts> <depends>digital_cam_common</depends>
<provides>digital_cam</provides> <conflicts>digital_cam_gpio,digital_cam_servo,digital_cam_i2c,digital_cam_pprzlink</conflicts>
</dep> </dep>
<header> <header>
<file name="uart_cam_ctrl.h"/> <file name="uart_cam_ctrl.h"/>
<file name="dc.h"/>
</header> </header>
<init fun="digital_cam_uart_init()"/> <init fun="digital_cam_uart_init()"/>
<periodic fun="digital_cam_uart_periodic()" freq="10" autorun="TRUE"/> <periodic fun="digital_cam_uart_periodic()" freq="10" autorun="TRUE"/>
@@ -69,14 +46,16 @@
<define name="UART5_DEV" value="ttyUSB0"/> <define name="UART5_DEV" value="ttyUSB0"/>
</makefile> </makefile>
<makefile target="ap|sim|nps"> <makefile target="ap|sim|nps">
<define name="DIGITAL_CAM" />
<file name="uart_cam_ctrl.c"/> <file name="uart_cam_ctrl.c"/>
<file name="catia/protocol.c"/> <file name="catia/protocol.c"/>
<file name="dc.c"/>
<configure name="CAMERA_PORT" case="upper|lower"/> <configure name="CAMERA_PORT" case="upper|lower"/>
<define name="USE_$(CAMERA_PORT_UPPER)"/> <define name="USE_$(CAMERA_PORT_UPPER)"/>
<define name="CAMERA_LINK" value="$(CAMERA_PORT_LOWER)"/> <define name="CAMERA_LINK" value="$(CAMERA_PORT_LOWER)"/>
<define name="$(CAMERA_PORT_UPPER)_BAUD" value="B115200"/> <define name="$(CAMERA_PORT_UPPER)_BAUD" value="B115200"/>
<test>
<define name="CAMERA_LINK" value="uart0"/>
<define name="USE_UART0"/>
</test>
</makefile> </makefile>
</module> </module>
+3 -38
View File
@@ -5,55 +5,20 @@
Digital Photo Camera Triggering (using embedded video) Digital Photo Camera Triggering (using embedded video)
This module controls triggering of an embedded digital camera on a linux based autopilot. This particular version triggers the video_rtp_stream.xml module to store jpeg images. This module controls triggering of an embedded digital camera on a linux based autopilot. This particular version triggers the video_rtp_stream.xml module to store jpeg images.
It can trigger photos based on GPS distance, time or circle radius in both fixedwings and rotorcraft.
</description> </description>
<define name="DC_AUTOSHOOT_PERIOD" value="0.5" description="time period for DC_AUTOSHOOT_PERIODIC in seconds"/>
<define name="DC_AUTOSHOOT_DISTANCE_INTERVAL" value="50" description="grid in meters"/>
<define name="DC_SHOT_SYNC_SEND" value="TRUE|FALSE" description="send DC_SHOT message when photo was taken (default: TRUE)"/>
</doc> </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="dc"/>
</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="dc"/>
<strip_button name="Stop Autoshoot" icon="dcstop.png" value="0" group="dc"/>
</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>
<dep> <dep>
<depends>video_capture</depends> <depends>digital_cam_common,video_capture</depends>
<conflicts>digital_cam,digital_cam_servo,digital_cam_i2c,digital_cam_uart</conflicts> <conflicts>digital_cam_gpio,digital_cam_servo,digital_cam_i2c,digital_cam_uart,digital_cam_pprzlink</conflicts>
<provides>digital_cam</provides>
</dep> </dep>
<header> <header>
<file name="video_cam_ctrl.h"/> <file name="video_cam_ctrl.h"/>
<file name="dc.h"/>
</header> </header>
<init fun="digital_cam_video_init()"/> <init fun="digital_cam_video_init()"/>
<periodic fun="digital_cam_video_periodic()" freq="10" autorun="TRUE"/> <periodic fun="digital_cam_video_periodic()" freq="10" autorun="TRUE"/>
<makefile target="ap"> <makefile target="ap">
<define name="DIGITAL_CAM" />
<file name="video_cam_ctrl.c"/> <file name="video_cam_ctrl.c"/>
<file name="dc.c"/> <test/>
</makefile> </makefile>
</module> </module>
@@ -62,7 +62,6 @@ uint8_t atmega_i2c_cam_ctrl_just_sent_command = 0;
void atmega_i2c_cam_ctrl_init(void) void atmega_i2c_cam_ctrl_init(void)
{ {
atmega_i2c_cam_ctrl_trans.status = I2CTransDone; atmega_i2c_cam_ctrl_trans.status = I2CTransDone;
dc_init();
} }
void atmega_i2c_cam_ctrl_periodic(void) void atmega_i2c_cam_ctrl_periodic(void)
@@ -116,9 +116,6 @@ struct Dc_Ctrl_Parrot_Mykonos dc_ctrl_parrot_mykonos;
void dc_ctrl_parrot_mykonos_init(void) void dc_ctrl_parrot_mykonos_init(void)
{ {
// Call common DC init
dc_init();
dc_ctrl_parrot_mykonos.status = DC_CTRL_PARROT_MYKONOS_NONE; dc_ctrl_parrot_mykonos.status = DC_CTRL_PARROT_MYKONOS_NONE;
dc_ctrl_parrot_mykonos.timer = 0; dc_ctrl_parrot_mykonos.timer = 0;
dc_ctrl_parrot_mykonos.photo_nr = 0; dc_ctrl_parrot_mykonos.photo_nr = 0;
@@ -73,9 +73,6 @@ uint8_t dc_timer;
void gpio_cam_ctrl_init(void) void gpio_cam_ctrl_init(void)
{ {
// Call common DC init
dc_init();
// Do gpio specific DC init // Do gpio specific DC init
dc_timer = 0; dc_timer = 0;
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2023 Gautier Hattenberger <gautier.hattenberger@enac.fr>
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
/** @file modules/digital_cam/pprzlink_cam_ctrl.h
* @brief Digital Camera Control with PPRZLINK messages
*/
#include "modules/digital_cam/pprzlink_cam_ctrl.h"
#include "generated/airframe.h"
#include "generated/modules.h"
// Include Standard Camera Control Interface
#include "dc.h"
float digital_cam_exposure;
void pprzlink_cam_ctrl_init(void)
{
digital_cam_exposure = 0.f; // auto expo
}
void pprzlink_cam_ctrl_periodic(void)
{
// Common DC Periodic task
dc_periodic();
}
/* Command The Camera */
void dc_send_command(uint8_t cmd)
{
if (cmd == DC_SHOOT) {
dc_send_shot_position();
}
// call command send_command function
dc_send_command_common(cmd);
}
#include "modules/datalink/downlink.h"
#include "modules/datalink/extra_pprz_dl.h"
void pprzlink_cam_ctrl_set_expo(float expo)
{
digital_cam_exposure = expo;
uint8_t tab[2];
tab[0] = 'e';
tab[1] = (uint8_t)(expo * 10.f);
uint8_t dst_id = 0;
DOWNLINK_SEND_PAYLOAD_COMMAND(extra_pprz_tp, EXTRA_DOWNLINK_DEVICE, &dst_id, 2, tab);
}
void dc_expo_cb(uint8_t* buf) {
if (DL_PAYLOAD_COMMAND_ac_id(buf) != AC_ID) { return; }
// feedback from camera
if (DL_PAYLOAD_COMMAND_command_length(buf) == 2 && DL_PAYLOAD_COMMAND_command(buf)[0] == 'e') {
digital_cam_exposure = DL_PAYLOAD_COMMAND_command(buf)[1] / 10.0;
}
}
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2023 Gautier Hattenberger <gautier.hattenberger@enac.fr>
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
/** @file modules/digital_cam/pprzlink_cam_ctrl.h
* @brief Digital Camera Control with PPRZLINK messages
*/
#ifndef PPRZLINK_CAM_CTRL_H
#define PPRZLINK_CAM_CTRL_H
#include "stdint.h"
extern void pprzlink_cam_ctrl_init(void);
/** Periodic */
extern void pprzlink_cam_ctrl_periodic(void);
/** Set expo setting */
extern float digital_cam_exposure;
extern void pprzlink_cam_ctrl_set_expo(float expo);
extern void dc_expo_cb(uint8_t* buf);
#define PPRZLINK_CAM_AUTO_EXPO 0.f
#endif // PPRZLINK_CAM_CTRL_H
@@ -55,9 +55,6 @@ static uint8_t dc_timer;
void servo_cam_ctrl_init(void) void servo_cam_ctrl_init(void)
{ {
// Call common DC init
dc_init();
// Do Servo specific DC init // Do Servo specific DC init
dc_timer = 0; dc_timer = 0;
} }
@@ -38,7 +38,6 @@
void atmega_i2c_cam_ctrl_init(void) void atmega_i2c_cam_ctrl_init(void)
{ {
dc_init();
} }
void atmega_i2c_cam_ctrl_periodic(void) void atmega_i2c_cam_ctrl_periodic(void)
@@ -115,8 +115,6 @@ static void send_thumbnails(struct transport_tx *trans, struct link_device *dev)
void digital_cam_uart_init(void) void digital_cam_uart_init(void)
{ {
// Call common DC init
dc_init();
digital_cam_uart_thumbnails = 0; digital_cam_uart_thumbnails = 0;
for (int t = 0; t < THUMB_COUNT; t++) { for (int t = 0; t < THUMB_COUNT; t++) {
for (int i = 0; i < THUMB_MSG_SIZE; i++) { for (int i = 0; i < THUMB_MSG_SIZE; i++) {
@@ -32,8 +32,6 @@
void digital_cam_video_init(void) void digital_cam_video_init(void)
{ {
// Call common DC init
dc_init();
} }
void digital_cam_video_periodic(void) void digital_cam_video_periodic(void)