00001 /* 00002 00003 Copyright (c) 2011, Ascending Technologies GmbH 00004 All rights reserved. 00005 00006 Redistribution and use in source and binary forms, with or without 00007 modification, are permitted provided that the following conditions are met: 00008 00009 * Redistributions of source code must retain the above copyright notice, 00010 this list of conditions and the following disclaimer. 00011 * Redistributions in binary form must reproduce the above copyright 00012 notice, this list of conditions and the following disclaimer in the 00013 documentation and/or other materials provided with the distribution. 00014 00015 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 00016 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00017 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00018 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY 00019 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00020 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00021 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00022 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00023 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00024 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00025 DAMAGE. 00026 00027 */ 00028 00029 #ifndef PELICAN_PTU_H_ 00030 #define PELICAN_PTU_H_ 00031 00032 00033 #define HUMMINGBIRD_ROLL_SERVO //generate roll servo output and use HL serial 0 TX for PWM 1 00034 #define HUMMINGBIRD_ROLL_SERVO_ON_SSEL0 //SSEL0 is used for Roll servo, serial 0 TX stays TX pin! 00035 #define CAMMOUNT_XCONFIG // turn roll/pitch commands for camera compensation by 45° 00036 #define PELICAN_PTU //roll/nick servo offset and scales for standard Pelican camera mount, pitch dir -1, roll dir 1 00037 #define CAM_FACING_FRONT_RIGHT //define if camera is facing to the front right, for front left leave undefined 00038 00039 //Servo angle offsets in degrees*1000 => change this value if camera mount is not leveled 00040 #define CAMERA_OFFSET_HUMMINGBIRD_PITCH 0 00041 #define CAMERA_OFFSET_HUMMINGBIRD_ROLL 0 00042 00043 #define HUMMINGBIRD_SERVO_DIRECTION_PITCH 1 //1: servo mounted on right hand side of camera, -1: left 00044 #define HUMMINGBIRD_SERVO_DIRECTION_ROLL -1 00045 00046 void PTU_init(void); 00047 void PTU_update(void); 00048 void SERVO_pitch_move(int); 00049 void SERVO_roll_move(int); 00050 00051 00052 struct CAMERA_PTU { //Pan Tilt Unit Data 00053 00054 int servo_roll_offset; 00055 int servo_pitch_offset; 00056 00057 int servo_roll_scale; 00058 int servo_pitch_scale; 00059 00060 int servo_pitch_min; 00061 int servo_pitch_max; 00062 00063 int servo_roll_min; 00064 int servo_roll_max; 00065 }; 00066 00067 extern struct CAMERA_PTU CAMERA_ptu; 00068 00069 struct CAMERA_COMMANDS { 00070 00071 unsigned short status; //0x01 => camera power on; 0x00 => camera power off 00072 short chksum; //status + desired_angle_pitch + desired_angle_roll; 00073 int desired_angle_pitch; //desired angles in 1/1000th degree 00074 int desired_angle_roll; 00075 }; 00076 00077 extern struct CAMERA_COMMANDS CAMERA_Commands; 00078 00079 #endif /*PELICAN_PTU_H_*/ 00080