Paparazzi UAS  v5.15_devel-110-g5cf27ee
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
rotorcraft_cam.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009-2012 Gautier Hattenberger <gautier.hattenberger@laas.fr>,
3  * Antoine Drouin <poinix@gmail.com>
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22 
40 #ifndef ROTORCRAFT_CAM_H
41 #define ROTORCRAFT_CAM_H
42 
43 #include "std.h"
44 #include "generated/airframe.h"
45 #include "math/pprz_algebra_int.h"
46 #include "mcu_periph/gpio.h"
47 
48 #define ROTORCRAFT_CAM_MODE_NONE 0
49 #define ROTORCRAFT_CAM_MODE_MANUAL 1
50 #define ROTORCRAFT_CAM_MODE_HEADING 2
51 #define ROTORCRAFT_CAM_MODE_WP 3
52 
54 #ifndef ROTORCRAFT_CAM_DEFAULT_MODE
55 #define ROTORCRAFT_CAM_DEFAULT_MODE ROTORCRAFT_CAM_MODE_NONE
56 #endif
57 
61 #ifdef ROTORCRAFT_CAM_TILT_SERVO
62 #define ROTORCRAFT_CAM_USE_TILT 1
63 #else
64 #define ROTORCRAFT_CAM_USE_TILT 0
65 #endif
66 
69 #if defined ROTORCRAFT_CAM_TILT_ANGLE_MIN && defined ROTORCRAFT_CAM_TILT_ANGLE_MAX && defined ROTORCRAFT_CAM_USE_TILT
70 #define CAM_TA_MIN ANGLE_BFP_OF_REAL(ROTORCRAFT_CAM_TILT_ANGLE_MIN)
71 #define CAM_TA_MAX ANGLE_BFP_OF_REAL(ROTORCRAFT_CAM_TILT_ANGLE_MAX)
72 #define ROTORCRAFT_CAM_USE_TILT_ANGLES 1
73 #endif
74 
78 #ifndef ROTORCRAFT_CAM_USE_PAN
79 #define ROTORCRAFT_CAM_USE_PAN 1
80 #endif
81 
85 #ifndef ROTORCRAFT_CAM_TRACK_WP
86 #ifdef WP_CAM
87 #define ROTORCRAFT_CAM_TRACK_WP WP_CAM
88 #endif
89 #endif
90 
92 
96 
97 extern void rotorcraft_cam_init(void);
98 extern void rotorcraft_cam_periodic(void);
100 
104 #define rotorcraft_cam_SetCamMode(_v) { \
105  rotorcraft_cam_set_mode(_v); \
106  }
107 
112 #ifndef ROTORCRAFT_CAM_STICK_TILT_INC
113 #define ROTORCRAFT_CAM_STICK_TILT_INC RadOfDeg(10.)
114 #endif
115 #ifndef ROTORCRAFT_CAM_STICK_PAN_INC
116 #define ROTORCRAFT_CAM_STICK_PAN_INC RadOfDeg(20.)
117 #endif
118 
119 #define ROTORCRAFT_CAM_STICK_PARSE(_dl_buffer) { \
120  rotorcraft_cam_tilt += (int16_t)((ANGLE_BFP_OF_REAL(ROTORCRAFT_CAM_STICK_TILT_INC)/127.)*(float)DL_ROTORCRAFT_CAM_STICK_tilt(_dl_buffer)); \
121  rotorcraft_cam_pan += (int16_t)((ANGLE_BFP_OF_REAL(ROTORCRAFT_CAM_STICK_PAN_INC)/127.)*(float)DL_ROTORCRAFT_CAM_STICK_pan(dl_buffer)); \
122  INT32_COURSE_NORMALIZE(rotorcraft_cam_pan); \
123  }
124 
125 #endif /* ROTORCRAFT_CAM_H */
126 
int16_t rotorcraft_cam_tilt_pwm
Some architecture independent helper functions for GPIOs.
void rotorcraft_cam_periodic(void)
void rotorcraft_cam_set_mode(uint8_t mode)
signed short int16_t
Definition: types.h:17
void rotorcraft_cam_init(void)
int16_t rotorcraft_cam_pan
unsigned char uint8_t
Definition: types.h:14
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
Definition: sonar_bebop.c:69
int16_t rotorcraft_cam_tilt
uint8_t rotorcraft_cam_mode
WP control.
Paparazzi fixed point algebra.