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
00027
00028
00029
00030
00031
00032
00033 #ifndef SFSYSTEM_H
00034 #define SFSYSTEM_H
00035
00036 #undef SFEXPORT
00037 #if defined(MS_WINDOWS) && !defined(SF_STATIC)
00038 #ifdef MAKE_LIBRARY
00039 #define _declspec( dllexport )
00040 #else
00041 #define _declspec( dllimport )
00042 #endif
00043 #else
00044 #define SFEXPORT
00045 #endif
00046
00047
00049
00059 class Sf
00060 {
00061 Sf() {};
00062
00063 public:
00064
00065
00068 static void init();
00071 static SfRobot *robot() { return ourRobot; };
00073 static SfSonarDevice *sonar() { return ourSonar; }
00075 static SfLaserDevice *laser() { return ourLaser; }
00077 static SfIrrfDevice *irrf() { return ourIrrf; }
00079 static SfArtifactList *artList;
00081
00082
00083
00084
00086 static double getX() { return ourRobot->getX(); };
00088
00090
00092
00093
00094
00095 static ArTcpConnection *tcpCon;
00096 static ArSerialConnection *serialCon;
00097 static ArLogFileConnection *logCon;
00098
00100 static SfFr *frame;
00101 static bool isExited;
00102
00103
00104 static SfLaserDevice *ourLaser;
00105
00106 static SfIrrfDevice *ourIrrf;
00107
00108 static SfRobot *ourRobot;
00109
00110 private:
00111
00112 static SfSonarDevice *ourSonar;
00113
00114
00115
00116
00117 static void parser();
00118 };
00119
00120
00121
00122
00123
00125 #define SfROBOT Sf::robot()
00126
00127 #define SfSELFTASK SfActRegister::currentTask
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 #define ADDUSERTASK(NAME,PRIORITY,CLASS,PROC) \
00138 Sf::robot()->addUserTask(NAME, PRIORITY, \
00139 new ArFunctorC<CLASS>(this, &CLASS::PROC));
00140
00141 #define ADDSENSORTASK(NAME,PRIORITY,CLASS,PROC) \
00142 Sf::robot()->addSensorInterpTask(NAME, PRIORITY, \
00143 new ArFunctorC<CLASS>(this, &CLASS::PROC));
00144
00145
00146
00147
00148
00149 void sfSetSerialBaud(int rate);
00150 void sfSetSerialPort(char *dev);
00151
00152
00153 #endif // SFSYSTEM_H
00154