Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures 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 "generated/flight_plan.h"
46 #include "math/pprz_algebra_int.h"
47 #include "mcu_periph/gpio.h"
48 
49 #define ROTORCRAFT_CAM_MODE_NONE 0
50 #define ROTORCRAFT_CAM_MODE_MANUAL 1
51 #define ROTORCRAFT_CAM_MODE_HEADING 2
52 #define ROTORCRAFT_CAM_MODE_WP 3
53 
55 #ifndef ROTORCRAFT_CAM_DEFAULT_MODE
56 #define ROTORCRAFT_CAM_DEFAULT_MODE ROTORCRAFT_CAM_MODE_NONE
57 #endif
58 
62 #ifdef ROTORCRAFT_CAM_TILT_SERVO
63 #define ROTORCRAFT_CAM_USE_TILT 1
64 #else
65 #define ROTORCRAFT_CAM_USE_TILT 0
66 #endif
67 
70 #if defined ROTORCRAFT_CAM_TILT_ANGLE_MIN && defined ROTORCRAFT_CAM_TILT_ANGLE_MAX && defined ROTORCRAFT_CAM_USE_TILT
71 #define CAM_TA_MIN ANGLE_BFP_OF_REAL(ROTORCRAFT_CAM_TILT_ANGLE_MIN)
72 #define CAM_TA_MAX ANGLE_BFP_OF_REAL(ROTORCRAFT_CAM_TILT_ANGLE_MAX)
73 #define ROTORCRAFT_CAM_USE_TILT_ANGLES 1
74 #endif
75 
79 #ifndef ROTORCRAFT_CAM_USE_PAN
80 #define ROTORCRAFT_CAM_USE_PAN 1
81 #endif
82 
86 #ifndef ROTORCRAFT_CAM_TRACK_WP
87 #ifdef WP_CAM
88 #define ROTORCRAFT_CAM_TRACK_WP WP_CAM
89 #endif
90 #endif
91 
93 
97 
98 extern void rotorcraft_cam_init(void);
99 extern void rotorcraft_cam_periodic(void);
100 extern void rotorcraft_cam_set_mode(uint8_t mode);
101 
105 #define rotorcraft_cam_SetCamMode(_v) { \
106  rotorcraft_cam_set_mode(_v); \
107 }
108 
113 #ifndef ROTORCRAFT_CAM_STICK_TILT_INC
114 #define ROTORCRAFT_CAM_STICK_TILT_INC RadOfDeg(10.)
115 #endif
116 #ifndef ROTORCRAFT_CAM_STICK_PAN_INC
117 #define ROTORCRAFT_CAM_STICK_PAN_INC RadOfDeg(20.)
118 #endif
119 
120 #define ROTORCRAFT_CAM_STICK_PARSE(_dl_buffer) { \
121  rotorcraft_cam_tilt += (int16_t)((ANGLE_BFP_OF_REAL(ROTORCRAFT_CAM_STICK_TILT_INC)/127.)*(float)DL_ROTORCRAFT_CAM_STICK_tilt(_dl_buffer)); \
122  rotorcraft_cam_pan += (int16_t)((ANGLE_BFP_OF_REAL(ROTORCRAFT_CAM_STICK_PAN_INC)/127.)*(float)DL_ROTORCRAFT_CAM_STICK_pan(dl_buffer)); \
123  INT32_COURSE_NORMALIZE(rotorcraft_cam_pan); \
124 }
125 
126 #endif /* ROTORCRAFT_CAM_H */
127 
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
int16_t rotorcraft_cam_tilt
uint8_t rotorcraft_cam_mode
WP control.
Paparazzi fixed point algebra.