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 * Sets the robot configuration of this process. 00024 * @param configuration The configuration of this process. 00025 */ 00026 void setRobotConfiguration(RobotConfiguration* configuration); 00027 00028 /** 00029 * @class RobotCalibration 00030 * 00031 * A class that represents the calibration of the robot. 00032 * 00033 * @author Thomas Röfer 00034 */ 00035 class RobotCalibration 00036 { 00037 public: 00038 /** the offset between the bodyTilt as delivered by the walking engine and the 00039 * real bodyTilt of a particular robot. */ 00040 double bodyTiltOffset; 00041 00042 /** the offset between the bodyRoll as delivered by the walking engine and the 00043 * real bodyRoll of a particular robot. */ 00044 double bodyRollOffset; 00045 00046 /** the offset between the headTilt2 as delivered by the walking engine and the 00047 * real headRoll of a particular robot. */ 00048 double headTiltOffset; 00049 00050 /** the offset between the headRoll as delivered by the walking engine and the 00051 * real headRoll of a particular robot. */ 00052 double headRollOffset; 00053 00054 /** a factor the measurements of the tilt joint are scaled with. */ 00055 double tiltFactor; 00056 00057 /** a factor the measurements of the pan joint are scaled with. */ 00058 double panFactor; 00059 00060 /** a factor the measurements of the tilt2 joint are scaled with. */ 00061 double tilt2Factor; 00062 00063 RobotCalibration() 00064 { 00065 bodyTiltOffset = bodyRollOffset = headTiltOffset = headRollOffset = 0; 00066 tiltFactor = panFactor = tilt2Factor = 1; 00067 } 00068 }; 00069 00070 /** 00071 * @class RobotConfiguration 00072 * 00073 * A class that represents the configuration of the robot. 00074 * 00075 * @author Thomas Röfer 00076 */ 00077 class RobotConfiguration : public RobotDesign 00078 { 00079 public: 00080 /** 00081 * Constructor. 00082 */ 00083 RobotConfiguration(); 00084 00085 /** 00086 * Loads the data from robot.cfg 00087 */ 00088 void load(); 00089 00090 /** returns the calibration values of the robot */ 00091 const RobotCalibration& getRobotCalibration() const {return robotCalibration;} 00092 00093 /** sets the calibration values of the robot */ 00094 void setRobotCalibration(const RobotCalibration& r) {robotCalibration = r;} 00095 00096 /** returns the mac address of the robot*/ 00097 const char* getMacAddressString() const {return macAddressString;} 00098 00099 /** returns the design of the robot*/ 00100 Design getRobotDesign() const {return robotDesign;} 00101 00102 /** returns the dimensions of the robot*/ 00103 const RobotDimensions& getRobotDimensions() const {return robotDimensions;} 00104 00105 /** updates the robot configuration based on message queue data. */ 00106 bool handleMessage(InMessage& message); 00107 00108 private: 00109 RobotCalibration robotCalibration; /**< The calibration values of the robot. */ 00110 char macAddressString[13]; /**< The MAC address of the robot. */ 00111 Design robotDesign; /**< The design of the robot. */ 00112 RobotDimensions robotDimensions; /**< The dimensions of the robot. */ 00113 }; 00114 00115 /** 00116 * Streaming operator that reads a RobotConfiguration from a stream. 00117 * @param stream The stream from which is read. 00118 * @param robotConfiguration The RobotConfiguration object. 00119 * @return The stream. 00120 */ 00121 In& operator>>(In& stream,RobotConfiguration& robotConfiguration); 00122 00123 /** 00124 * Streaming operator that writes a RobotConfiguration to a stream. 00125 * @param stream The stream to write on. 00126 * @param robotConfiguration The RobotConfiguration object. 00127 * @return The stream. 00128 */ 00129 Out& operator<<(Out& stream, const RobotConfiguration& robotConfiguration); 00130 00131 00132 #endif //__RobotConfiguration_h_
1.3.6