diff --git a/conf/modules/booz_cam.xml b/conf/modules/booz_cam.xml index 219200c01e..72d3b371f6 100644 --- a/conf/modules/booz_cam.xml +++ b/conf/modules/booz_cam.xml @@ -1,6 +1,6 @@ - +
diff --git a/conf/modules/cam_point.xml b/conf/modules/cam_point.xml index 8baaa25452..1391379a27 100644 --- a/conf/modules/cam_point.xml +++ b/conf/modules/cam_point.xml @@ -1,6 +1,6 @@ - +
diff --git a/conf/modules/cam_roll.xml b/conf/modules/cam_roll.xml index 4b7903baf3..7bb14e1b35 100644 --- a/conf/modules/cam_roll.xml +++ b/conf/modules/cam_roll.xml @@ -1,6 +1,6 @@ - +
diff --git a/conf/settings/booz_cam.xml b/conf/settings/booz_cam.xml index 176b16317b..c177bc7f3e 100644 --- a/conf/settings/booz_cam.xml +++ b/conf/settings/booz_cam.xml @@ -2,7 +2,7 @@ - + diff --git a/conf/settings/cam.xml b/conf/settings/cam.xml index 39fb39892a..2511de50b1 100644 --- a/conf/settings/cam.xml +++ b/conf/settings/cam.xml @@ -3,7 +3,7 @@ - + @@ -14,12 +14,12 @@ - - + + - + diff --git a/conf/settings/cam_pitch.xml b/conf/settings/cam_pitch.xml index c1d509e783..fcc99c2ff5 100644 --- a/conf/settings/cam_pitch.xml +++ b/conf/settings/cam_pitch.xml @@ -3,7 +3,7 @@ - + @@ -11,15 +11,15 @@ - + - + diff --git a/conf/settings/cam_roll.xml b/conf/settings/cam_roll.xml index 314a83b02b..4a73f03755 100644 --- a/conf/settings/cam_roll.xml +++ b/conf/settings/cam_roll.xml @@ -3,11 +3,11 @@ - + - + - + diff --git a/sw/airborne/modules/vision/booz_cam.c b/sw/airborne/modules/cam_control/booz_cam.c similarity index 100% rename from sw/airborne/modules/vision/booz_cam.c rename to sw/airborne/modules/cam_control/booz_cam.c diff --git a/sw/airborne/modules/vision/booz_cam.h b/sw/airborne/modules/cam_control/booz_cam.h similarity index 100% rename from sw/airborne/modules/vision/booz_cam.h rename to sw/airborne/modules/cam_control/booz_cam.h diff --git a/sw/airborne/modules/vision/cam.c b/sw/airborne/modules/cam_control/cam.c similarity index 100% rename from sw/airborne/modules/vision/cam.c rename to sw/airborne/modules/cam_control/cam.c diff --git a/sw/airborne/modules/vision/cam.h b/sw/airborne/modules/cam_control/cam.h similarity index 100% rename from sw/airborne/modules/vision/cam.h rename to sw/airborne/modules/cam_control/cam.h diff --git a/sw/airborne/modules/cam_control/cam_roll.c b/sw/airborne/modules/cam_control/cam_roll.c new file mode 100644 index 0000000000..feab0bf050 --- /dev/null +++ b/sw/airborne/modules/cam_control/cam_roll.c @@ -0,0 +1,79 @@ +/* + * $Id$ + * + * Copyright (C) 2003 Pascal Brisset, Antoine Drouin + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ +/** \file cam.c + * \brief Pan/Tilt camera library + * + */ + +#include +#include "cam.h" +#include "nav.h" +#include "autopilot.h" +#include "flight_plan.h" +#include "estimator.h" +#include "inter_mcu.h" +#include "nav.h" + +#define MIN_PPRZ_CAM ((int16_t)(MAX_PPRZ * 0.05)) +#define DELTA_ALPHA 0.2 + +#define MAX_CAM_ROLL M_PI/2 + +float cam_roll_phi; /* radian */ +float phi_c; /* radian */ +float theta_c; /* have to be defined for telemetry message */ + +float target_x, target_y, target_alt; + +#ifdef MOBILE_CAM + +#define MODE_MANUAL 0 +#define MODE_STABILIZED 1 + +uint8_t cam_roll_mode; +bool_t cam_roll_switch; + +void cam_init( void ) { + cam_roll_switch = 0; +#if defined VIDEO_SWITCH_PIN && !(defined SITL) + IO0DIR |= _BV(VIDEO_SWITCH_PIN); + IO0CLR = _BV(VIDEO_SWITCH_PIN); +#endif +} + +void cam_periodic( void ) { + switch (cam_roll_mode) { + case MODE_STABILIZED: + phi_c = cam_roll_phi + estimator_phi; + break; + case MODE_MANUAL: + phi_c = cam_roll_phi; + break; + default: + phi_c = 0; + } + ap_state->commands[COMMAND_CAM_ROLL] = TRIM_PPRZ(phi_c * MAX_PPRZ / RadOfDeg(CAM_PHI_MAX_DEG)); +} + +#endif // MOBILE_CAM diff --git a/sw/airborne/modules/vision/cam_track.c b/sw/airborne/modules/cam_control/cam_track.c similarity index 100% rename from sw/airborne/modules/vision/cam_track.c rename to sw/airborne/modules/cam_control/cam_track.c diff --git a/sw/airborne/modules/vision/cam_track.h b/sw/airborne/modules/cam_control/cam_track.h similarity index 100% rename from sw/airborne/modules/vision/cam_track.h rename to sw/airborne/modules/cam_control/cam_track.h diff --git a/sw/airborne/modules/vision/point.c b/sw/airborne/modules/cam_control/point.c similarity index 100% rename from sw/airborne/modules/vision/point.c rename to sw/airborne/modules/cam_control/point.c diff --git a/sw/airborne/modules/vision/point.h b/sw/airborne/modules/cam_control/point.h similarity index 100% rename from sw/airborne/modules/vision/point.h rename to sw/airborne/modules/cam_control/point.h