mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-02 13:27:32 +08:00
renamed vision to cam_control
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="vision">
|
||||
<module name="booz_cam" dir="cam_control">
|
||||
<!-- depend require="booz_pwm|led" -->
|
||||
<header>
|
||||
<file name="booz_cam.h"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="cam_point" dir="vision">
|
||||
<module name="cam_point" dir="cam_control">
|
||||
<header>
|
||||
<file name="cam.h"/>
|
||||
<file name="point.h"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="cam_roll" dir="vision">
|
||||
<module name="cam_roll" dir="cam_control">
|
||||
<header>
|
||||
<file name="cam.h"/>
|
||||
</header>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<dl_settings>
|
||||
|
||||
<dl_settings NAME="CAM">
|
||||
<dl_setting var="booz_cam_mode" MIN="0" STEP="1" MAX="3" module="vision/booz_cam" shortname="mode" values="NONE|MAN|HEADING|WP" handler="SetCamMode">
|
||||
<dl_setting var="booz_cam_mode" MIN="0" STEP="1" MAX="3" module="cam_control/booz_cam" shortname="mode" values="NONE|MAN|HEADING|WP" handler="SetCamMode">
|
||||
<strip_button name="CN" value="0"/>
|
||||
<strip_button name="CM" value="1"/>
|
||||
<strip_button name="CH" value="2"/>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<settings>
|
||||
<dl_settings NAME="control">
|
||||
<dl_settings name="cam">
|
||||
<dl_setting MAX="5" MIN="0" STEP="1" module="vision/cam" VAR="cam_mode">
|
||||
<dl_setting MAX="5" MIN="0" STEP="1" module="cam_control/cam" VAR="cam_mode">
|
||||
<strip_button name="AC_TARGET" value="5"/>
|
||||
<strip_button name="WP_TARGET" value="4"/>
|
||||
<strip_button name="XY_TARGET" value="3"/>
|
||||
@@ -14,12 +14,12 @@
|
||||
</dl_settings>
|
||||
|
||||
<dl_settings name="angles">
|
||||
<dl_setting MAX="0.5" MIN="-0.5" STEP="0.1" module="vision/cam" VAR="cam_tilt_c"/>
|
||||
<dl_setting MAX="0.5" MIN="-0.5" STEP="0.1" module="vision/cam" VAR="cam_pan_c"/>
|
||||
<dl_setting MAX="0.5" MIN="-0.5" STEP="0.1" module="cam_control/cam" VAR="cam_tilt_c"/>
|
||||
<dl_setting MAX="0.5" MIN="-0.5" STEP="0.1" module="cam_control/cam" VAR="cam_pan_c"/>
|
||||
</dl_settings>
|
||||
|
||||
<dl_settings name="target">
|
||||
<dl_setting min="1" max="27" step="1" module="vision/cam" var="cam_target_wp" shortname="wp"/>
|
||||
<dl_setting min="1" max="27" step="1" module="cam_control/cam" var="cam_target_wp" shortname="wp"/>
|
||||
</dl_settings>
|
||||
|
||||
</dl_settings>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<settings>
|
||||
<dl_settings NAME="control">
|
||||
<dl_settings name="cam">
|
||||
<dl_setting MAX="5" MIN="0" STEP="1" module="vison/cam" VAR="cam_mode">
|
||||
<dl_setting MAX="5" MIN="0" STEP="1" module="cam_control/cam" VAR="cam_mode">
|
||||
<!-- <strip_button name="TARGET" value="4"/>
|
||||
<strip_button name="NADIR" value="2"/>
|
||||
--> <strip_button name="ANGLES" value="1"/>
|
||||
@@ -11,15 +11,15 @@
|
||||
</dl_settings>
|
||||
|
||||
<dl_settings name="angles">
|
||||
<dl_setting MAX="0.5" MIN="-0.5" STEP="0.1" module="vison/cam" VAR="cam_tilt_c">
|
||||
<dl_setting MAX="0.5" MIN="-0.5" STEP="0.1" module="cam_control/cam" VAR="cam_tilt_c">
|
||||
<strip_button name="Look Foreward" icon="lookfore.png" value="-0.5"/>
|
||||
<strip_button name="Look Down" icon="lookdown.png" value="0.5"/>
|
||||
</dl_setting>
|
||||
<dl_setting MAX="0.5" MIN="-0.5" STEP="0.1" module="vison/cam" VAR="cam_pan_c"/>
|
||||
<dl_setting MAX="0.5" MIN="-0.5" STEP="0.1" module="cam_control/cam" VAR="cam_pan_c"/>
|
||||
</dl_settings>
|
||||
<!--
|
||||
<dl_settings name="target">
|
||||
<dl_setting min="1" max="10" step="1" module="vison/cam" var="cam_target_wp" shortname="wp"/>
|
||||
<dl_setting min="1" max="10" step="1" module="cam_control/cam" var="cam_target_wp" shortname="wp"/>
|
||||
</dl_settings>
|
||||
-->
|
||||
</dl_settings>
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
<settings>
|
||||
<dl_settings>
|
||||
<dl_settings NAME="Cam">
|
||||
<dl_setting MAX="45" MIN="-45" STEP="1" VAR="phi_c" module="vision/cam_roll" handler="SetPhiDeg" shortname="phi deg" auto="true">
|
||||
<dl_setting MAX="45" MIN="-45" STEP="1" VAR="phi_c" module="cam_control/cam_roll" handler="SetPhiDeg" shortname="phi deg" auto="true">
|
||||
</dl_setting>
|
||||
<dl_setting MAX="1" MIN="0" STEP="1" VAR="cam_roll_mode" module="vision/cam_roll" shortname="manual - stablzd">
|
||||
<dl_setting MAX="1" MIN="0" STEP="1" VAR="cam_roll_mode" module="cam_control/cam_roll" shortname="manual - stablzd">
|
||||
</dl_setting>
|
||||
<dl_setting MAX="1" MIN="0" STEP="1" VAR="cam_roll_switch" module="vision/cam_roll" shortname="still - mobile" handler="Switch">
|
||||
<dl_setting MAX="1" MIN="0" STEP="1" VAR="cam_roll_switch" module="cam_control/cam_roll" shortname="still - mobile" handler="Switch">
|
||||
</dl_setting>
|
||||
</dl_settings>
|
||||
</dl_settings>
|
||||
|
||||
@@ -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 <math.h>
|
||||
#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
|
||||
Reference in New Issue
Block a user