00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef ARTCM2_H
00027 #define ARTCM2_H
00028
00029 #include "ariaUtil.h"
00030 #include "ArFunctor.h"
00031 #include "ArRobot.h"
00032
00034
00040 class ArTCM2
00041 {
00042 public:
00043
00045 AREXPORT ArTCM2(ArRobot *robot);
00047 AREXPORT virtual ~ArTCM2();
00049 double getCompass(void) const { return myCompass; }
00051 double getPitch(void) const { return myPitch; }
00053 double getRoll(void) const { return myRoll; }
00055 double getXMagnetic(void) const { return myXMag; }
00057 double getYMagnetic(void) const { return myYMag; }
00059 double getZMagnetic(void) const { return myZMag; }
00061 double getTemperature(void) const { return myTemperature; }
00062
00063 int getError(void) const { return myError; }
00065 double getCalibrationH(void) const { return myCalibrationH; }
00067 double getCalibrationV(void) const { return myCalibrationV; }
00069 double getCalibrationM(void) const { return myCalibrationM; }
00071 void commandOff(void) { myRobot->comInt(ArCommands::TCM2, 0); }
00073 void commandJustCompass(void) { myRobot->comInt(ArCommands::TCM2, 1); }
00075 void commandOnePacket(void) { myRobot->comInt(ArCommands::TCM2, 2); }
00077 void commandContinuousPackets(void) { myRobot->comInt(ArCommands::TCM2, 3); }
00079 void commandUserCalibration(void) { myRobot->comInt(ArCommands::TCM2, 4); }
00081 void commandAutoCalibration(void) { myRobot->comInt(ArCommands::TCM2, 5); }
00083 void commandStopCalibration(void) { myRobot->comInt(ArCommands::TCM2, 6); }
00085 void commandSoftReset(void) { myRobot->comInt(ArCommands::TCM2, 7); }
00087 AREXPORT int getPacCount(void);
00089 AREXPORT bool packetHandler(ArRobotPacket *packet);
00090 protected:
00091 ArRobot *myRobot;
00092
00093 double myCompass;
00094 double myPitch;
00095 double myRoll;
00096 double myXMag;
00097 double myYMag;
00098 double myZMag;
00099 double myTemperature;
00100 int myError;
00101 double myCalibrationH;
00102 double myCalibrationV;
00103 double myCalibrationM;
00104
00105
00106 time_t myTimeLastPacket;
00107 int myPacCurrentCount;
00108 int myPacCount;
00109 ArRetFunctor1C<bool, ArTCM2, ArRobotPacket *> myPacketHandlerCB;
00110
00111 };
00112
00113 #endif // ARTCM2_H