00001 /** 00002 * @file RobotConfiguration.h 00003 * 00004 * Definition of class RobotConfiguration 00005 * 00006 * @author Thomas Röfer 00007 */ 00008 #ifndef __RobotConfiguration_h_ 00009 #define __RobotConfiguration_h_ 00010 00011 #include "Tools/MessageQueue/InMessage.h" 00012 #include "Platform/SystemCall.h" 00013 #include "Tools/Actorics/RobotDimensions.h" 00014 00015 class RobotConfiguration; 00016 00017 /** 00018 * Returns a reference to a process wide RobotConfiguration configuration. 00019 */ 00020 RobotConfiguration& getRobotConfiguration(); 00021 00022 /** 00023 * @class RobotCalibration 00024 * 00025 * A class that represents the calibration of the robot. 00026 * 00027 * @author Thomas Röfer 00028 */ 00029 class RobotCalibration 00030 { 00031 public: 00032 /** the offset between the bodyTilt as delivered by the walking engine and the 00033 * real bodyTilt of a particular robot. */ 00034 double bodyTiltOffset; 00035 00036 /** the offset between the bodyRoll as delivered by the walking engine and the 00037 * real bodyRoll of a particular robot. */ 00038 double bodyRollOffset; 00039 00040 /** the offset between the headTilt2 as delivered by the walking engine and the 00041 * real headRoll of a particular robot. */ 00042 double headTiltOffset; 00043 00044 /** the offset between the headRoll as delivered by the walking engine and the 00045 * real headRoll of a particular robot. */ 00046 double headRollOffset; 00047 00048 /** a factor the measurements of the tilt joint are scaled with. */ 00049 double tiltFactor; 00050 00051 /** a factor the measurements of the pan joint are scaled with. */ 00052 double panFactor; 00053 00054 /** a factor the measurements of the tilt2 joint are scaled with. */ 00055 double tilt2Factor; 00056 00057 RobotCalibration() 00058 { 00059 bodyTiltOffset = bodyRollOffset = headTiltOffset = headRollOffset = 0; 00060 tiltFactor = panFactor = tilt2Factor = 1; 00061 } 00062 }; 00063 00064 /** 00065 * @class RobotConfiguration 00066 * 00067 * A class that represents the configuration of the robot. 00068 * 00069 * @author Thomas Röfer 00070 */ 00071 class RobotConfiguration : public RobotDesign 00072 { 00073 public: 00074 /** 00075 * Constructor. 00076 */ 00077 RobotConfiguration(); 00078 00079 /** 00080 * Loads the data from robot.cfg 00081 */ 00082 void load(); 00083 00084 /** returns the calibration values of the robot */ 00085 const RobotCalibration& getRobotCalibration() const {return robotCalibration;} 00086 00087 /** sets the calibration values of the robot */ 00088 void setRobotCalibration(const RobotCalibration& r) {robotCalibration = r;} 00089 00090 /** returns the mac address of the robot*/ 00091 const char* getMacAddressString() const {return macAddressString;} 00092 00093 /** returns the design of the robot*/ 00094 Design getRobotDesign() const {return robotDesign;} 00095 00096 /** returns the dimensions of the robot*/ 00097 const RobotDimensions& getRobotDimensions() const {return robotDimensions;} 00098 00099 /** updates the robot configuration based on message queue data. */ 00100 bool handleMessage(InMessage& message); 00101 00102 private: 00103 RobotCalibration robotCalibration; /**< The calibration values of the robot. */ 00104 char macAddressString[13]; /**< The MAC address of the robot. */ 00105 Design robotDesign; /**< The design of the robot. */ 00106 RobotDimensions robotDimensions; /**< The dimensions of the robot. */ 00107 }; 00108 00109 /** 00110 * Streaming operator that reads a RobotConfiguration from a stream. 00111 * @param stream The stream from which is read. 00112 * @param robotConfiguration The RobotConfiguration object. 00113 * @return The stream. 00114 */ 00115 In& operator>>(In& stream,RobotConfiguration& robotConfiguration); 00116 00117 /** 00118 * Streaming operator that writes a RobotConfiguration to a stream. 00119 * @param stream The stream to write on. 00120 * @param robotConfiguration The RobotConfiguration object. 00121 * @return The stream. 00122 */ 00123 Out& operator<<(Out& stream, const RobotConfiguration& robotConfiguration); 00124 00125 00126 #endif //__RobotConfiguration_h_ 00127 00128 /* 00129 * Change Log: 00130 * 00131 * $Log: RobotConfiguration.h,v $ 00132 * Revision 1.1.1.1 2004/05/22 17:35:55 cvsadm 00133 * created new repository GT2004_WM 00134 * 00135 * Revision 1.7 2004/03/08 02:32:21 roefer 00136 * Calibration parameters changed 00137 * 00138 * Revision 1.6 2004/03/03 18:35:17 roefer 00139 * Acceleration sensors magically work again 00140 * 00141 * Revision 1.5 2004/02/29 14:56:03 roefer 00142 * Additional calibration parameters 00143 * 00144 * Revision 1.4 2004/02/24 19:01:06 roefer 00145 * Additional calibration parameters added 00146 * 00147 * Revision 1.3 2004/01/01 10:58:52 roefer 00148 * RobotDimensions are in a class now 00149 * 00150 * Revision 1.2 2003/12/31 12:21:25 roefer 00151 * getRobotDesign added 00152 * 00153 * Revision 1.1 2003/10/07 10:13:21 cvsadm 00154 * Created GT2004 (M.J.) 00155 * 00156 * Revision 1.3 2003/09/25 11:21:59 juengel 00157 * Removed BlobCollection. 00158 * 00159 * Revision 1.2 2003/07/05 09:49:05 roefer 00160 * Generic debug message for bodyOffsets improved 00161 * 00162 * Revision 1.1.1.1 2003/07/02 09:40:28 cvsadm 00163 * created new repository for the competitions in Padova from the 00164 * tamara CVS (Tuesday 2:00 pm) 00165 * 00166 * removed unused solutions 00167 * 00168 * Revision 1.3 2003/05/11 23:56:15 dueffert 00169 * doxygen bugs fixed 00170 * 00171 * Revision 1.2 2003/05/08 14:55:02 juengel 00172 * Added getMacAddressString(). 00173 * 00174 * Revision 1.1 2003/05/03 16:20:01 roefer 00175 * robot.cfg added 00176 * 00177 * 00178 */