00001 /** 00002 * @file HeadControl.h 00003 * 00004 * This file contains a generic class for HeadControl. 00005 */ 00006 00007 #ifndef __HeadControl_h_ 00008 #define __HeadControl_h_ 00009 00010 #ifdef _WIN32 00011 #pragma warning(disable:4786) 00012 // the constructor with all it's long parameter type names results in a too 00013 // long debug identifier 00014 #endif 00015 00016 00017 #include "Tools/Module/Module.h" 00018 00019 #include "Representations/Perception/SensorDataBuffer.h" 00020 #include "Representations/Perception/BodyPosture.h" 00021 #include "Representations/Perception/CameraMatrix.h" 00022 00023 #include "Representations/Cognition/LandmarksState.h" 00024 #include "Representations/Cognition/RobotPose.h" 00025 #include "Representations/Cognition/RobotState.h" 00026 #include "Representations/Cognition/BallModel.h" 00027 00028 #include "Representations/Motion/OdometryData.h" 00029 #include "Representations/Motion/HeadControlMode.h" 00030 #include "Representations/Motion/HeadMotionRequest.h" 00031 #include "Representations/Motion/PIDData.h" 00032 #include "Representations/Motion/MotionInfo.h" 00033 00034 #include "Tools/Debugging/DebugDrawings.h" 00035 #include "Tools/RobotConfiguration.h" 00036 #include "Tools/RingBuffer.h" 00037 00038 #ifdef _WIN32 00039 #pragma warning(disable:4786) 00040 // the constructor with all it's long parameter type names results in a too 00041 // long debug identifier 00042 #endif 00043 00044 /** 00045 * @class HeadControlInterfaces 00046 * 00047 * The interfaces of the HeadControl module. 00048 */ 00049 class HeadControlInterfaces 00050 { 00051 public: 00052 /** Constructor. */ 00053 HeadControlInterfaces( 00054 const unsigned long& frameNumber, 00055 const SensorDataBuffer& sensorDataBuffer, 00056 const CameraMatrix& cameraMatrix, 00057 const OdometryData& currentOdometryData, 00058 const BodyPosture& bodyPosture, 00059 const BallModel& ballModel, 00060 const RobotPose& robotPose, 00061 const LandmarksState& landmarksState, 00062 const RobotState& robotState, 00063 const MotionInfo& motionInfo, 00064 const HeadControlMode& headControlMode, 00065 const bool headIsBlockedBySpecialActionOrWalk, 00066 HeadMotionRequest& headMotionRequest, 00067 PIDData& pidData) 00068 : 00069 frameNumber(frameNumber), 00070 headControlMode(headControlMode), 00071 robotPose(robotPose), 00072 cameraMatrix(cameraMatrix), 00073 currentOdometryData(currentOdometryData), 00074 ballModel(ballModel), 00075 robotState(robotState), 00076 sensorDataBuffer(sensorDataBuffer), 00077 bodyPosture(bodyPosture), 00078 motionRequest(motionRequest), 00079 motionInfo(motionInfo), 00080 landmarksState(landmarksState), 00081 headIsBlockedBySpecialActionOrWalk(headIsBlockedBySpecialActionOrWalk), 00082 headMotionRequest(headMotionRequest), 00083 pidData(pidData) 00084 {} 00085 00086 protected: 00087 /** A reference to the frame number */ 00088 const unsigned long& frameNumber; 00089 00090 /** A modus from the behavior how to move the head */ 00091 const HeadControlMode& headControlMode; 00092 00093 /** The robots current position and orientation */ 00094 const RobotPose& robotPose; 00095 00096 /** The position and rotation of the camera relative to the robot */ 00097 const CameraMatrix& cameraMatrix; 00098 00099 /** The odometry of the last Motion frame */ 00100 const OdometryData& currentOdometryData; 00101 00102 /** The position and the speed of the ball */ 00103 const BallModel& ballModel; 00104 00105 /** The current body sensor data */ 00106 const SensorDataBuffer& sensorDataBuffer; 00107 00108 /** The neck height and body tilt */ 00109 const BodyPosture& bodyPosture; 00110 00111 /** motionRequest that is currently executed */ 00112 const MotionRequest& motionRequest; 00113 00114 /** information about the executed motions */ 00115 const MotionInfo& motionInfo; 00116 00117 /** the currently seen landmarks */ 00118 const LandmarksState& landmarksState; 00119 00120 /** The current state of the robot*/ 00121 const RobotState& robotState; 00122 00123 /** Specifies if the head is blocked by a special action or walk.*/ 00124 const bool headIsBlockedBySpecialActionOrWalk; 00125 00126 /** Head joint angles that have to be set. */ 00127 HeadMotionRequest& headMotionRequest; 00128 00129 /** PID servo gains */ 00130 PIDData& pidData; 00131 }; 00132 00133 /** 00134 * A generic class for HeadControl modules. 00135 * 00136 * The modul calculates a new head motion which has to be set by the motion module 00137 * based on the desired head mode and the current 00138 * collection of percepts stored in the world state as well as the current 00139 * sensor informations . 00140 */ 00141 class HeadControl : public Module, public HeadControlInterfaces, public RobotDimensions 00142 { 00143 public: 00144 /* 00145 * Constructor. 00146 * @param interfaces The paramters of the HeadControl module. 00147 */ 00148 HeadControl(const HeadControlInterfaces& interfaces) 00149 : HeadControlInterfaces(interfaces), 00150 RobotDimensions(getRobotConfiguration().getRobotDimensions()) 00151 {} 00152 00153 /** Destructor */ 00154 virtual ~HeadControl() {} 00155 }; 00156 00157 #endif //__HeadControl_h_ 00158 00159 /* 00160 * Change log : 00161 * 00162 * $Log: HeadControl.h,v $ 00163 * Revision 1.8 2004/05/29 18:18:56 dueffert 00164 * walk parameter evolution, measurement and calibration stuff ported to GT2004_WM 00165 * 00166 * Revision 1.7 2004/05/27 18:42:24 loetzsch 00167 * removed warnings 00168 * 00169 * Revision 1.6 2004/05/26 18:36:03 loetzsch 00170 * cleanup in the head control interfaces 00171 * 00172 * Revision 1.5 2004/05/26 17:21:47 dueffert 00173 * better data types used 00174 * 00175 * Revision 1.4 2004/05/25 12:49:07 tim 00176 * added RobotState to HeadControl 00177 * 00178 * Revision 1.3 2004/05/23 18:56:33 spranger 00179 * added framenumber to HeadControl interface 00180 * 00181 * Revision 1.2 2004/05/22 22:52:03 juengel 00182 * Renamed ballP_osition to ballModel. 00183 * 00184 * Revision 1.1.1.1 2004/05/22 17:19:21 cvsadm 00185 * created new repository GT2004_WM 00186 * 00187 * Revision 1.13 2004/05/18 11:38:16 loetzsch 00188 * the Motion process now also executes a SensorDataProcessor for the calculation of the cameraMatrix 00189 * 00190 * Revision 1.12 2004/05/17 19:21:51 loetzsch 00191 * renamed all Variables "cameraMatrix" to "cameraMatrix2" 00192 * 00193 * Revision 1.11 2004/05/10 10:30:15 juengel 00194 * Added executedMotionRequest to HeadControlInterfaces. 00195 * 00196 * Revision 1.10 2004/04/07 14:42:56 risler 00197 * moved LandsmarksState to Cognition directory, generated by SelfLocator 00198 * 00199 * Revision 1.9 2004/04/07 12:28:57 risler 00200 * ddd checkin after go04 - first part 00201 * 00202 * Revision 1.2 2004/04/01 19:52:45 Charlie 00203 * added LandmarkState 00204 * 00205 * Revision 1.1.1.1 2004/03/29 08:28:48 Administrator 00206 * initial transfer from tamara 00207 * 00208 * Revision 1.8 2004/03/20 09:55:24 roefer 00209 * Preparation for improved odometry 00210 * 00211 * Revision 1.7 2004/03/08 01:38:54 roefer 00212 * Interfaces should be const 00213 * 00214 * Revision 1.6 2004/03/04 16:00:19 fritsche 00215 * added pidData to HeadControlInterfaces 00216 * 00217 * Revision 1.5 2004/03/04 10:05:20 jhoffman 00218 * - motion process now uses odometry to propagate the robot pose while no new robot pose is being sent (this makes headcontrol a little better) 00219 * - removed headcontrol member variable "propagatedPose" from headcontrol and cognition->motion-sender 00220 * 00221 * Revision 1.4 2004/02/03 13:19:49 spranger 00222 * renamed all references to class BallP_osition to BallModel 00223 * 00224 * Revision 1.3 2004/01/01 10:58:50 roefer 00225 * RobotDimensions are in a class now 00226 * 00227 * Revision 1.2 2003/11/24 16:11:10 dueffert 00228 * SpecialPercept removed from PackageCognition 00229 * 00230 * Revision 1.1 2003/10/06 14:10:15 cvsadm 00231 * Created GT2004 (M.J.) 00232 * 00233 * Revision 1.2 2003/09/26 15:27:49 juengel 00234 * Renamed DataTypes to representations. 00235 * 00236 * Revision 1.1.1.1 2003/07/02 09:40:23 cvsadm 00237 * created new repository for the competitions in Padova from the 00238 * tamara CVS (Tuesday 2:00 pm) 00239 * 00240 * removed unused solutions 00241 * 00242 * Revision 1.27 2003/06/16 20:01:43 loetzsch 00243 * bug fix 00244 * 00245 * Revision 1.26 2003/06/15 22:42:22 loetzsch 00246 * no message 00247 * 00248 * Revision 1.25 2003/06/15 16:44:24 jhoffman 00249 * no message 00250 * 00251 * Revision 1.24 2003/05/28 15:34:27 dueffert 00252 * new GT2003HeadControl 00253 * 00254 * Revision 1.23 2003/05/27 16:16:30 juengel 00255 * Added headIsBlockedBySpecialActionOrWalk. 00256 * 00257 * Revision 1.22 2003/05/02 18:26:18 risler 00258 * SensorDataBuffer added 00259 * replaced SensorData with SensorDataBuffer 00260 * full SensorData resolution now accessible 00261 * 00262 * Revision 1.21 2003/04/16 07:00:15 roefer 00263 * Bremen GO checkin 00264 * 00265 * Revision 1.21 2003/04/08 16:26:15 timrie 00266 * added current MotionRequest 00267 * 00268 * Revision 1.20 2003/04/07 16:50:37 jhoffman 00269 * parameter tuning and cleaning up 00270 * 00271 * Revision 1.19 2003/04/06 21:02:19 roefer 00272 * Mouth added to setJoints 00273 * 00274 * Revision 1.18 2003/04/02 15:35:13 jhoffman 00275 * another round of bug fixes 00276 * 00277 * Revision 1.17 2003/04/02 12:28:00 roefer 00278 * HeadControl additions from yesterday restored 00279 * 00280 * Revision 1.16 2003/04/02 09:25:58 jhoffman 00281 * everything back to how it was before; but there's the additional 00282 * gt2003 with all the old functions dublicated. 00283 * 00284 * Revision 1.9 2003/03/06 11:58:29 dueffert 00285 * re-order warning removed 00286 * 00287 * Revision 1.8 2002/11/28 14:46:30 jhoffman 00288 * moved "setjoints" in in the class HeadControl 00289 * 00290 * Revision 1.7 2002/11/05 19:22:28 loetzsch 00291 * made the reference to the HeadState const and changed the comment 00292 * 00293 * Revision 1.6 2002/09/17 23:55:21 loetzsch 00294 * - unraveled several datatypes 00295 * - changed the WATCH macro 00296 * - completed the process restructuring 00297 * 00298 * Revision 1.5 2002/09/12 13:17:27 loetzsch 00299 * made member variables of module interfaces protected 00300 * 00301 * Revision 1.4 2002/09/11 20:06:19 loetzsch 00302 * continued experiments with modules/solutions 00303 * 00304 * Revision 1.3 2002/09/11 17:26:31 loetzsch 00305 * continued change of module/solution mechanisms 00306 * 00307 * Revision 1.2 2002/09/10 21:07:30 loetzsch 00308 * continued change of module/solution mechanisms 00309 * 00310 * Revision 1.1 2002/09/10 15:36:14 cvsadm 00311 * Created new project GT2003 (M.L.) 00312 * - Cleaned up the /Src/DataTypes directory 00313 * - Removed challenge related source code 00314 * - Removed processing of incoming audio data 00315 * - Renamed AcousticMessage to SoundRequest 00316 * 00317 * Revision 1.2 2002/08/22 14:41:03 risler 00318 * added some doxygen comments 00319 * 00320 * Revision 1.1.1.1 2002/05/10 12:40:14 cvsadm 00321 * Moved GT2002 Project from ute to tamara. 00322 * 00323 * Revision 1.7 2002/04/24 18:16:05 risler 00324 * HeadState not const in HeadControl 00325 * 00326 * Revision 1.6 2002/04/23 10:38:28 risler 00327 * renamed headOdometry to headState 00328 * 00329 * Revision 1.5 2002/04/02 13:10:19 dueffert 00330 * big change: odometryData and cameraMatrix in image now, old logfiles may be obsolete 00331 * 00332 * Revision 1.4 2001/12/21 14:09:39 roefer 00333 * Added several destructors 00334 * 00335 * Revision 1.3 2001/12/11 13:39:11 kosen 00336 * parameter SensorData added 00337 * 00338 * Revision 1.2 2001/12/10 17:47:06 risler 00339 * change log added 00340 * 00341 */