Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
dc.h File Reference

Standard Digital Camera Control Interface. More...

#include "float.h"
#include "std.h"
#include "state.h"
#include "generated/airframe.h"
#include "modules/gps/gps.h"
+ Include dependency graph for dc.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DC_IGNORE   FLT_MAX
 
#define DC_IMAGE_BUFFER   65535
 
#define dc_Circle(interval)   dc_circle(interval, DC_IGNORE)
 
#define dc_Survey(interval)   dc_survey(interval, DC_IGNORE, DC_IGNORE)
 
#define dc_Stop(_)   dc_stop()
 

Enumerations

enum  dc_command_type {
  DC_GET_STATUS = 0 , DC_HOLD = 13 , DC_SHOOT = 32 , DC_WIDER = 'w' ,
  DC_TALLER = 't' , DC_UP = 'u' , DC_DOWN = 'd' , DC_CENTER = 'c' ,
  DC_LEFT = 'l' , DC_RIGHT = 'r' , DC_MENU = 'm' , DC_HOME = 'h' ,
  DC_PLAY = 'p' , DC_ON = 'O' , DC_OFF = 'o'
}
 Generic Set of Digital Camera Commands. More...
 
enum  dc_autoshoot_type {
  DC_AUTOSHOOT_STOP = 0 , DC_AUTOSHOOT_PERIODIC = 1 , DC_AUTOSHOOT_DISTANCE = 2 , DC_AUTOSHOOT_EXT_TRIG = 3 ,
  DC_AUTOSHOOT_SURVEY = 4 , DC_AUTOSHOOT_CIRCLE = 5
}
 Auotmatic Digital Camera Photo Triggering modes. More...
 

Functions

void dc_send_command (uint8_t cmd)
 Send Command To Camera. More...
 
void dc_send_command_common (uint8_t cmd)
 Command sending function. More...
 
void dc_set_expo (float expo)
 Set camera exposure. More...
 
void dc_send_shot_position (void)
 Send Down the coordinates of where the photo was taken. More...
 
void dc_init (void)
 initialize settings More...
 
void dc_periodic (void)
 periodic function More...
 
uint8_t dc_distance (float interval)
 Sets the dc control in distance mode. More...
 
uint8_t dc_circle (float interval, float start)
 Sets the dc control in circle mode. More...
 
uint8_t dc_survey (float interval, float x, float y)
 Sets the dc control in distance mode. More...
 
uint8_t dc_stop (void)
 Stop dc control. More...
 
uint8_t dc_info (void)
 Send an info message. More...
 

Variables

uint16_t dc_photo_nr
 export the number of the last photo More...
 
uint16_t dc_gps_count
 number of images taken since the last change of dc_mode More...
 
float dc_exposure
 camera exposure More...
 
float dc_autoshoot_period
 AutoShoot photos every X seconds. More...
 
float dc_distance_interval
 AutoShoot photos on distance to last shot in meters. More...
 
float dc_survey_interval
 distance between dc shots in meters More...
 
float dc_gps_x
 point of reference for the survey mode More...
 
float dc_gps_y
 
float dc_gps_next_dist
 
float dc_circle_start_angle
 angle a where first image will be taken at a + delta More...
 
float dc_circle_interval
 angle between dc shots in degree More...
 
float dc_circle_max_blocks
 
float dc_circle_last_block
 
float dc_cam_angle
 camera angle More...
 
uint8_t dc_cam_tracing
 
dc_autoshoot_type dc_autoshoot
 

Detailed Description

Standard Digital Camera Control Interface.

-Standard IO -I2C Control

Usage: (from the flight plan, the settings or any airborne code):

  • dc_send_command( )
  • set the appropriate autoshoot mode (off/time/distance/trigger)
  • use the module periodic function to set the autorepeat interval
  • define SENSOR_SYNC_SEND to get the DC_SHOT_MESSAGE on every SHOOT command

Definition in file dc.h.

Macro Definition Documentation

◆ dc_Circle

#define dc_Circle (   interval)    dc_circle(interval, DC_IGNORE)

Definition at line 196 of file dc.h.

◆ DC_IGNORE

#define DC_IGNORE   FLT_MAX

Definition at line 147 of file dc.h.

◆ DC_IMAGE_BUFFER

#define DC_IMAGE_BUFFER   65535

Definition at line 152 of file dc.h.

◆ dc_Stop

#define dc_Stop (   _)    dc_stop()

Definition at line 232 of file dc.h.

◆ dc_Survey

#define dc_Survey (   interval)    dc_survey(interval, DC_IGNORE, DC_IGNORE)

Definition at line 222 of file dc.h.

Enumeration Type Documentation

◆ dc_autoshoot_type

Auotmatic Digital Camera Photo Triggering modes.

Enumerator
DC_AUTOSHOOT_STOP 
DC_AUTOSHOOT_PERIODIC 
DC_AUTOSHOOT_DISTANCE 
DC_AUTOSHOOT_EXT_TRIG 
DC_AUTOSHOOT_SURVEY 
DC_AUTOSHOOT_CIRCLE 

Definition at line 132 of file dc.h.

◆ dc_command_type

Generic Set of Digital Camera Commands.

Enumerator
DC_GET_STATUS 
DC_HOLD 
DC_SHOOT 
DC_WIDER 
DC_TALLER 
DC_UP 
DC_DOWN 
DC_CENTER 
DC_LEFT 
DC_RIGHT 
DC_MENU 
DC_HOME 
DC_PLAY 
DC_ON 
DC_OFF 

Definition at line 98 of file dc.h.

Function Documentation

◆ dc_circle()

uint8_t dc_circle ( float  interval,
float  start 
)

Sets the dc control in circle mode.

In this mode the dc control assumes a perfect circular course.

The 'start' value is the reference course and 'interval' the minimum angle between shots. If 'start' is DC_IGNORE the current course is used instead.

The first picture is taken at angle start+interval.

Parameters
intervalminimum angle between shots in deg
startreference course in deg (or special DC_IGNORE)
Returns
zero

Definition at line 218 of file dc.c.

References dc_autoshoot, DC_AUTOSHOOT_CIRCLE, dc_circle_interval, dc_circle_last_block, dc_circle_max_blocks, dc_circle_start_angle, dc_gps_count, DC_IGNORE, dc_info(), and stateGetNedToBodyEulers_f().

+ Here is the call graph for this function:

◆ dc_distance()

uint8_t dc_distance ( float  interval)

Sets the dc control in distance mode.

Shoot the next pic if distance to last saved shot position is greater than interval.

The first picture is taken at after interval.

Parameters
intervalminimum distance between shots in m
Returns
zero

Definition at line 205 of file dc.c.

References dc_autoshoot, DC_AUTOSHOOT_DISTANCE, dc_distance_interval, dc_gps_count, dc_info(), last_shot_pos, FloatVect2::x, and FloatVect2::y.

+ Here is the call graph for this function:

◆ dc_info()

uint8_t dc_info ( void  )

Send an info message.

Containing information about position, course, buffer and all other internal variables used by the dc control.

Definition at line 166 of file dc.c.

References course, dc_autoshoot, dc_autoshoot_period, dc_circle_interval, dc_circle_last_block, dc_circle_start_angle, dc_gps_count, dc_gps_next_dist, dc_gps_x, dc_gps_y, dc_photo_nr, dc_survey_interval, DefaultChannel, DefaultDevice, mode, stateGetNedToBodyEulers_f(), and stateGetPositionLla_i().

Referenced by dc_circle(), dc_distance(), dc_stop(), and dc_survey().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dc_init()

void dc_init ( void  )

◆ dc_periodic()

◆ dc_send_command()

◆ dc_send_command_common()

void dc_send_command_common ( uint8_t  cmd)

Command sending function.

Definition at line 192 of file dc.c.

References extra_pprz_tp.

Referenced by dc_send_command().

+ Here is the caller graph for this function:

◆ dc_send_shot_position()

void dc_send_shot_position ( void  )

Send Down the coordinates of where the photo was taken.

Definition at line 106 of file dc.c.

References course, DC_IMAGE_BUFFER, dc_photo_nr, DefaultChannel, DefaultDevice, extra_pprz_tp, gps, GpsState::hmsl, stateGetHorizontalSpeedDir_f(), stateGetHorizontalSpeedNorm_f(), stateGetNedToBodyEulers_f(), stateGetPositionLla_i(), and GpsState::tow.

Referenced by atmega_i2c_cam_ctrl_send(), dc_send_command(), gpio_cam_ctrl_periodic(), and servo_cam_ctrl_periodic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dc_set_expo()

void dc_set_expo ( float  expo)

Set camera exposure.

Definition at line 202 of file dc.c.

◆ dc_stop()

uint8_t dc_stop ( void  )

Stop dc control.

Sets the dc control in inactive mode, stopping all current actions.

Definition at line 262 of file dc.c.

References dc_autoshoot, DC_AUTOSHOOT_STOP, and dc_info().

Referenced by gvf_nav_survey_polygon_run(), nav_spiral_run(), and nav_survey_polygon_run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dc_survey()

uint8_t dc_survey ( float  interval,
float  x,
float  y 
)

Sets the dc control in distance mode.

In this mode, the dc control assumes a perfect line formed course since the distance is calculated relative to the first given point of reference. So not usable for circles or other comparable shapes.

The values of 'x' and 'y' are the coordinates of the reference point used for the distance calculations. If 'y' is DC_IGNORE the value of 'x' is interpreted as index of a waypoint declared in the flight plan. If both 'x' and 'y' are DC_IGNORE the current position will be used as reference point.

Parameters
intervaldistance between shots in meters
xx coordinate of reference point (or special DC_IGNORE)
yy coordinate of reference point (or special DC_IGNORE)
Returns
zero

Definition at line 240 of file dc.c.

References dc_autoshoot, DC_AUTOSHOOT_DISTANCE_INIT, DC_AUTOSHOOT_SURVEY, dc_gps_count, dc_gps_next_dist, dc_gps_x, dc_gps_y, DC_IGNORE, dc_info(), dc_survey_interval, stateGetPositionEnu_f(), WaypointX, WaypointY, FloatVect2::x, EnuCoor_f::x, FloatVect2::y, and EnuCoor_f::y.

Referenced by gvf_nav_survey_polygon_run(), and nav_survey_polygon_run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ dc_autoshoot

dc_autoshoot_type dc_autoshoot
extern

◆ dc_autoshoot_period

float dc_autoshoot_period
extern

AutoShoot photos every X seconds.

Definition at line 86 of file dc.c.

Referenced by dc_info(), dc_init(), and dc_periodic().

◆ dc_cam_angle

float dc_cam_angle
extern

camera angle

Definition at line 70 of file dc.c.

Referenced by nav_spiral_run().

◆ dc_cam_tracing

uint8_t dc_cam_tracing
extern

Definition at line 69 of file dc.c.

Referenced by nav_spiral_run().

◆ dc_circle_interval

float dc_circle_interval
extern

angle between dc shots in degree

Definition at line 74 of file dc.c.

Referenced by dc_circle(), dc_info(), and dc_periodic().

◆ dc_circle_last_block

float dc_circle_last_block
extern

Definition at line 76 of file dc.c.

Referenced by dc_circle(), dc_info(), and dc_periodic().

◆ dc_circle_max_blocks

float dc_circle_max_blocks
extern

Definition at line 77 of file dc.c.

Referenced by dc_circle(), and dc_periodic().

◆ dc_circle_start_angle

float dc_circle_start_angle
extern

angle a where first image will be taken at a + delta

Definition at line 75 of file dc.c.

Referenced by dc_circle(), dc_info(), and dc_periodic().

◆ dc_distance_interval

float dc_distance_interval
extern

AutoShoot photos on distance to last shot in meters.

Definition at line 85 of file dc.c.

Referenced by dc_distance(), dc_init(), dc_periodic(), nav_survey_hybrid_run(), nav_survey_poly_run(), and nav_survey_rectangle_rotorcraft_run().

◆ dc_exposure

float dc_exposure
extern

camera exposure

Definition at line 72 of file dc.c.

Referenced by dc_expo_cb(), dc_init(), dc_set_expo(), and pprzlink_cam_ctrl_init().

◆ dc_gps_count

uint16_t dc_gps_count
extern

number of images taken since the last change of dc_mode

Definition at line 68 of file dc.c.

Referenced by dc_circle(), dc_distance(), dc_info(), dc_periodic(), and dc_survey().

◆ dc_gps_next_dist

float dc_gps_next_dist
extern

Definition at line 80 of file dc.c.

Referenced by dc_info(), dc_periodic(), and dc_survey().

◆ dc_gps_x

float dc_gps_x
extern

point of reference for the survey mode

Definition at line 81 of file dc.c.

Referenced by dc_info(), dc_periodic(), and dc_survey().

◆ dc_gps_y

float dc_gps_y

Definition at line 75 of file dc.h.

◆ dc_photo_nr

uint16_t dc_photo_nr
extern

export the number of the last photo

Definition at line 95 of file dc.c.

Referenced by dc_info(), dc_send_command(), and dc_send_shot_position().

◆ dc_survey_interval

float dc_survey_interval
extern

distance between dc shots in meters

Definition at line 79 of file dc.c.

Referenced by dc_info(), dc_periodic(), and dc_survey().