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

Camera control module for rotorcraft. More...

#include "std.h"
#include "generated/airframe.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/gpio.h"
+ Include dependency graph for rotorcraft_cam.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ROTORCRAFT_CAM_MODE_NONE   0
 
#define ROTORCRAFT_CAM_MODE_MANUAL   1
 
#define ROTORCRAFT_CAM_MODE_HEADING   2
 
#define ROTORCRAFT_CAM_MODE_WP   3
 
#define ROTORCRAFT_CAM_DEFAULT_MODE   ROTORCRAFT_CAM_MODE_NONE
 Default mode is NONE. More...
 
#define ROTORCRAFT_CAM_USE_TILT   0
 Cam tilt control. More...
 
#define ROTORCRAFT_CAM_USE_PAN   1
 Use angles for tilt in HEADING and WP modes. More...
 
#define rotorcraft_cam_SetCamMode(_v)
 Set camera mode. More...
 
#define ROTORCRAFT_CAM_STICK_TILT_INC   RadOfDeg(10.)
 Cam control from datalink message. More...
 
#define ROTORCRAFT_CAM_STICK_PAN_INC   RadOfDeg(20.)
 
#define ROTORCRAFT_CAM_STICK_PARSE(buf)
 

Functions

void rotorcraft_cam_init (void)
 
void rotorcraft_cam_periodic (void)
 
void rotorcraft_cam_set_mode (uint8_t mode)
 

Variables

uint8_t rotorcraft_cam_mode
 WP control. More...
 
int16_t rotorcraft_cam_tilt
 
int16_t rotorcraft_cam_pan
 
int16_t rotorcraft_cam_tilt_pprz
 

Detailed Description

Camera control module 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)

The CAM_SWITCH can be used to power the camera in normal modes and disable it when in NONE mode

Definition in file rotorcraft_cam.h.

Macro Definition Documentation

◆ ROTORCRAFT_CAM_DEFAULT_MODE

#define ROTORCRAFT_CAM_DEFAULT_MODE   ROTORCRAFT_CAM_MODE_NONE

Default mode is NONE.

Definition at line 55 of file rotorcraft_cam.h.

◆ ROTORCRAFT_CAM_MODE_HEADING

#define ROTORCRAFT_CAM_MODE_HEADING   2

Definition at line 50 of file rotorcraft_cam.h.

◆ ROTORCRAFT_CAM_MODE_MANUAL

#define ROTORCRAFT_CAM_MODE_MANUAL   1

Definition at line 49 of file rotorcraft_cam.h.

◆ ROTORCRAFT_CAM_MODE_NONE

#define ROTORCRAFT_CAM_MODE_NONE   0

Definition at line 48 of file rotorcraft_cam.h.

◆ ROTORCRAFT_CAM_MODE_WP

#define ROTORCRAFT_CAM_MODE_WP   3

Definition at line 51 of file rotorcraft_cam.h.

◆ rotorcraft_cam_SetCamMode

#define rotorcraft_cam_SetCamMode (   _v)
Value:
{ \
rotorcraft_cam_set_mode(_v); \
}

Set camera mode.

Camera is powered down in NONE mode if CAM_{ON|OFF} are defined

Definition at line 104 of file rotorcraft_cam.h.

◆ ROTORCRAFT_CAM_STICK_PAN_INC

#define ROTORCRAFT_CAM_STICK_PAN_INC   RadOfDeg(20.)

Definition at line 116 of file rotorcraft_cam.h.

◆ ROTORCRAFT_CAM_STICK_PARSE

#define ROTORCRAFT_CAM_STICK_PARSE (   buf)
Value:
{ \
rotorcraft_cam_tilt += (int16_t)((ANGLE_BFP_OF_REAL(ROTORCRAFT_CAM_STICK_TILT_INC)/127.)*(float)DL_ROTORCRAFT_CAM_STICK_tilt(buf)); \
rotorcraft_cam_pan += (int16_t)((ANGLE_BFP_OF_REAL(ROTORCRAFT_CAM_STICK_PAN_INC)/127.)*(float)DL_ROTORCRAFT_CAM_STICK_pan(buf)); \
INT32_COURSE_NORMALIZE(rotorcraft_cam_pan); \
}
#define ANGLE_BFP_OF_REAL(_af)
int16_t rotorcraft_cam_pan
#define ROTORCRAFT_CAM_STICK_TILT_INC
Cam control from datalink message.
#define ROTORCRAFT_CAM_STICK_PAN_INC
short int16_t
Typedef defining 16 bit short type.
Definition: vl53l1_types.h:93

Definition at line 119 of file rotorcraft_cam.h.

◆ ROTORCRAFT_CAM_STICK_TILT_INC

#define ROTORCRAFT_CAM_STICK_TILT_INC   RadOfDeg(10.)

Cam control from datalink message.

camera tilt and pan are incremented by STICK_TILT_INC and STICK_PAN_INC when maximum command is received from the stick

Definition at line 113 of file rotorcraft_cam.h.

◆ ROTORCRAFT_CAM_USE_PAN

#define ROTORCRAFT_CAM_USE_PAN   1

Use angles for tilt in HEADING and WP modes.

Cam pan control. By default use pan control (heading)

Definition at line 79 of file rotorcraft_cam.h.

◆ ROTORCRAFT_CAM_USE_TILT

#define ROTORCRAFT_CAM_USE_TILT   0

Cam tilt control.

By default use tilt control if a servo is assigned

Definition at line 64 of file rotorcraft_cam.h.

Function Documentation

◆ rotorcraft_cam_init()

void rotorcraft_cam_init ( void  )

◆ rotorcraft_cam_periodic()

◆ rotorcraft_cam_set_mode()

void rotorcraft_cam_set_mode ( uint8_t  mode)

Definition at line 93 of file rotorcraft_cam.c.

References mode, rotorcraft_cam_mode, ROTORCRAFT_CAM_MODE_NONE, ROTORCRAFT_CAM_OFF, and ROTORCRAFT_CAM_ON.

Referenced by rotorcraft_cam_init().

+ Here is the caller graph for this function:

Variable Documentation

◆ rotorcraft_cam_mode

uint8_t rotorcraft_cam_mode
extern

WP control.

By default use WP_CAM waypoint if defined

Definition at line 69 of file rotorcraft_cam.c.

Referenced by rotorcraft_cam_periodic(), and rotorcraft_cam_set_mode().

◆ rotorcraft_cam_pan

int16_t rotorcraft_cam_pan
extern

Definition at line 83 of file rotorcraft_cam.c.

Referenced by rotorcraft_cam_init(), rotorcraft_cam_periodic(), and send_cam().

◆ rotorcraft_cam_tilt

int16_t rotorcraft_cam_tilt
extern

Definition at line 75 of file rotorcraft_cam.c.

Referenced by rotorcraft_cam_init(), rotorcraft_cam_periodic(), and send_cam().

◆ rotorcraft_cam_tilt_pprz

int16_t rotorcraft_cam_tilt_pprz
extern

Definition at line 76 of file rotorcraft_cam.c.

Referenced by rotorcraft_cam_init(), and rotorcraft_cam_periodic().