pantilt.cpp
00001 00002 /*************************************************************************** 00003 * pantilt.cpp - Abstract class defining a pan/tilt camera controller 00004 * 00005 * Created: Tue Apr 21 22:39:20 2009 00006 * Copyright 2009 Tobias Kellner 00007 * 2005-2009 Tim Niemueller [www.niemueller.de] 00008 * 00009 ****************************************************************************/ 00010 00011 /* This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. A runtime exception applies to 00015 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU Library General Public License for more details. 00021 * 00022 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00023 */ 00024 00025 #include <cams/control/pantilt.h> 00026 00027 /** @class CameraControlPanTilt <cams/control/pantilt.h> 00028 * Camera pan/tilt control interface. 00029 * Some cameras feature an actuator to allow for panning and tilting the 00030 * camera. 00031 * 00032 * This interface shall be implemented by such cameras or for other external 00033 * units for panning and tilting. 00034 * 00035 * @author Tim Niemueller 00036 * @author Tobias Kellner 00037 * 00038 * @fn void CameraControlPanTilt::process_pantilt() = 0 00039 * Process pan/tilt information. 00040 * Some operations allow for asynchronous usage (like fetching pan/tilt data). 00041 * This is because some cameras need some time to retrieve the information and 00042 * thus it is a good idea to let that run besides the image processing loop. With 00043 * process_control the incoming information is processed. 00044 * 00045 * @fn bool CameraControlPanTilt::supports_pan() = 0 00046 * Check whether this controller supports panning. 00047 * @return true if panning is supported 00048 * 00049 * @fn bool CameraControlPanTilt::supports_tilt() = 0 00050 * Check whether this controller supports tilting. 00051 * @return true if tilting is supported 00052 * 00053 * @fn void CameraControlPanTilt::set_pan(int pan) = 0 00054 * Set pan value. 00055 * The pan value is dependent on the camera control. See the implementations 00056 * documentation for details. 00057 * @param pan new pan value 00058 * 00059 * @fn void CameraControlPanTilt::set_tilt(int tilt) = 0 00060 * Set tilt value. 00061 * The tilt value is dependent on the camera control. See the implementations 00062 * documentation for details. 00063 * @param tilt new tilt value 00064 * 00065 * @fn void CameraControlPanTilt::set_pan_tilt(int pan, int tilt) = 0 00066 * Set pan and tilt in one go. 00067 * Sometimes camera controls have a command for setting pan and tilt at the 00068 * same time. If possible this should be preferred since is minimizes the 00069 * number of required operations and communication acts. See the 00070 * implementations documentation for details. 00071 * @param pan new pan value 00072 * @param tilt new tilt value 00073 * 00074 * @fn void CameraControlPanTilt::set_pan_tilt_rad(float pan, float tilt) = 0 00075 * Set pan and tilt as float value. 00076 * You give a radiant value where the camera should head relative to the basic 00077 * camera position. Implementations shall look forward (center the camera) for 00078 * if pan equals zero, look right if the pan is positive and left is the pan is 00079 * negative, they shall look forward (vertically centered) if tilt is zero, 00080 * upwards if tilt is negative and downwards if tilt is positive. 00081 * @param pan new pan value in radiant 00082 * @param tilt new tilt value in radiant 00083 * 00084 * @fn int CameraControlPanTilt::pan() = 0 00085 * Get pan value 00086 * @return camera control specific pan value 00087 * 00088 * @fn int CameraControlPanTilt::tilt() = 0 00089 * Get tilt value 00090 * @return camera control specific tilt value 00091 * 00092 * @fn void CameraControlPanTilt::start_get_pan_tilt() = 0 00093 * Start asynchronous fetch operation for pan and tilt values. 00094 * This will initiate fetching the pan and tilt values but will not wait until 00095 * the values have been received but will return immediately (non-blocking). 00096 * 00097 * @fn void CameraControlPanTilt::pan_tilt(int &pan, int &tilt) = 0 00098 * Get pan and tilt at the same time. 00099 * This will store the current pan and tilt values in the given arguments. 00100 * @param pan contains current pan after call 00101 * @param tilt contains current tilt after call 00102 * 00103 * @fn void CameraControlPanTilt::pan_tilt_rad(float &pan, float &tilt) = 0 00104 * Get pan and tilt at the same time in radiant. 00105 * This will store the current pan and tilt values in the given arguments. 00106 * @param pan contains current pan after call 00107 * @param tilt contains current tilt after call 00108 * @see set_pan_tilt_rad() 00109 * 00110 * @fn int CameraControlPanTilt::min_pan() 00111 * Get minimum pan value. 00112 * @return minimum camera-specific pan value 00113 * 00114 * @fn int CameraControlPanTilt::max_pan() 00115 * Get maximum pan value. 00116 * @return maximum camera-specific pan value 00117 * 00118 * @fn int CameraControlPanTilt::min_tilt() 00119 * Get minimum tilt value. 00120 * @return minimum camera-specific tilt value 00121 * 00122 * @fn int CameraControlPanTilt::max_tilt() 00123 * Get maximum tilt value. 00124 * @return maximum camera-specific tilt value 00125 * 00126 * @fn void CameraControlPanTilt::reset_pan_tilt() 00127 * Bring camera into home position. 00128 * After the reset the camera shall look forward (horizontally and 00129 * vertically centered "home" position). 00130 * 00131 * @fn void CameraControlPanTilt::set_pan_tilt_limit(int pan_left, int pan_right, int tilt_up, int tilt_down) = 0 00132 * Set pan/tilt limits. 00133 * Some camera controls allow for extra constraints to the min and max pan/tilt 00134 * values. 00135 * @param pan_left new minimum pan limit 00136 * @param pan_right new maximum pan limit 00137 * @param tilt_up new minimum tilt limit 00138 * @param tilt_down new maximum tilt limit 00139 * 00140 * @fn void CameraControlPanTilt::reset_pan_tilt_limit() = 0 00141 * Reset pan/tilt limits. 00142 * This removes all limits from the pan/tilt methods thus the only constraints 00143 * are hardware induced. 00144 */ 00145 00146 /** Empty virtual destructor. */ 00147 CameraControlPanTilt::~CameraControlPanTilt() 00148 { 00149 } 00150 00151

