00001 #include <CommsManager.H> 00002 #include <RobotDrive.H> 00003 #include <Egomotion.H> 00004 #include <cmath> 00005 00006 using namespace WURDE; 00007 using namespace std; 00008 00009 CommsManager myManager("rFlexTester"); 00010 00011 void handler(int signum){ 00012 myManager.setQuit(); 00013 } 00014 00015 int main(int argc, char *argv[]){ 00016 00017 00018 Logger myLogger("rFlexTester"); 00019 RobotDrive myDrive("TomRFlexDrive"); 00020 Egomotion myEgomotion("TomRFlexMotion"); 00021 00022 myManager.registerConsumer(&myDrive); 00023 myManager.registerConsumer(&myEgomotion); 00024 00025 while(myManager.runUpdate()==STATE_RUN|| 00026 myManager.getState()==STATE_IDLE){ 00027 00028 /* myDrive.requests.trans.setValue(0.2); 00029 myDrive.requests.angular.setValue(1.0); 00030 myDrive.publishRequest();*/ 00031 00032 if(myEgomotion.newData()){ 00033 myEgomotion.getNextData(); 00034 cout << "Egomotion reports: " << myEgomotion.data.location.x() << "," 00035 << myEgomotion.data.location.y() << " at " << myEgomotion.data.location.theta() 00036 << " radians" << endl; 00037 } 00038 00039 } 00040 00041 myDrive.requests.trans.setValue(0); 00042 myDrive.requests.angular.setValue(0); 00043 myDrive.publishRequest(); 00044 00045 myManager.cleanUp(); 00046 00047 return 0; 00048 }