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