Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cam.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005- Pascal Brisset, Antoine Drouin
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
27 #ifndef CAM_H
28 #define CAM_H
29 
30 #include <inttypes.h>
31 #include "inter_mcu.h"
32 
33 #define CAM_MODE_OFF 0 /* Do nothing */
34 #define CAM_MODE_ANGLES 1 /* Input: servo angles */
35 #define CAM_MODE_NADIR 2 /* Input: () */
36 #define CAM_MODE_XY_TARGET 3 /* Input: target_x, target_y */
37 #define CAM_MODE_WP_TARGET 4 /* Input: waypoint no */
38 #define CAM_MODE_AC_TARGET 5 /* Input: ac id */
39 #define CAM_MODE_STABILIZED 6 // Stabilized mode, input: camera angles from the pan and tilt radio channels, output pointing coordinates.
40 #define CAM_MODE_RC 7 // Manual mode, input: camera angles from the pan and tilt radio channels, output servo positions.
41 
42 //FIXME: use radians
43 #ifndef CAM_PAN_MAX
44 #define CAM_PAN_MAX 90
45 #endif
46 #ifndef CAM_PAN_MIN
47 #define CAM_PAN_MIN -90
48 #endif
49 #ifndef CAM_TILT_MAX
50 #define CAM_TILT_MAX 90
51 #endif
52 #ifndef CAM_TILT_MIN
53 #define CAM_TILT_MIN -90
54 #endif
55 
56 extern uint8_t cam_mode;
57 extern uint8_t cam_lock;
58 
59 extern float cam_phi_c, cam_theta_c;
60 
61 extern float cam_pan_c, cam_tilt_c;
62 /* pan (move left and right), tilt (move up and down) */
68 extern uint8_t cam_target_wp;
71 extern uint8_t cam_target_ac;
74 void cam_periodic(void);
75 void cam_init(void);
76 
78 #define cam_SetPanCommand(x) { cam_pan_command = x; imcu_set_command(COMMAND_CAM_PAN, cam_pan_command);}
80 #define cam_SetTiltCommand(x) { cam_tilt_command = x; imcu_set_command(COMMAND_CAM_TILT, cam_tilt_command);}
81 
82 #ifdef TEST_CAM
83 extern float test_cam_estimator_x;
84 extern float test_cam_estimator_y;
85 extern float test_cam_estimator_z;
86 extern float test_cam_estimator_phi;
87 extern float test_cam_estimator_theta;
88 extern float test_cam_estimator_hspeed_dir;
89 #endif // TEST_CAM
90 
91 #if defined(COMMAND_CAM_PWR_SW) || defined(VIDEO_TX_SWITCH)
92 
93 extern bool video_tx_state;
94 #define VIDEO_TX_ON() { video_tx_state = 1; 0; }
95 #define VIDEO_TX_OFF() { video_tx_state = 0; 0; }
96 
97 #endif
98 
99 #endif // CAM_H
float cam_target_alt
Definition: cam.c:83
Communication between fbw and ap processes.
void cam_init(void)
Definition: cam.c:119
uint8_t cam_target_ac
For CAM_MODE_WP_TARGET mode.
Definition: cam.c:85
float cam_tilt_c
Definition: cam.c:78
float cam_target_y
Definition: cam.c:83
uint8_t cam_target_wp
For CAM_MODE_XY_TARGET mode.
Definition: cam.c:84
float cam_theta_c
Definition: cam.c:81
uint8_t cam_lock
Definition: cam.c:91
float cam_pan_c
Definition: cam.c:72
signed short int16_t
Definition: types.h:17
uint8_t cam_mode
Definition: cam.c:90
float cam_phi_c
Definition: cam.c:80
unsigned char uint8_t
Definition: types.h:14
void cam_periodic(void)
For CAM_MODE_AC_TARGET mode.
Definition: cam.c:129
float cam_target_x
Radians, for CAM_MODE_ANGLES mode.
Definition: cam.c:83
int16_t cam_pan_command
Definition: cam.c:93
int16_t cam_tilt_command
Definition: cam.c:94