00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <iostream>
00013 #include "Base/Whorl.h"
00014 #include "dsacssinterface.h"
00015 #include "rotation/Rotation.h"
00016
00017 using namespace std;
00018 using namespace O_SESSAME;
00019
00020 int main()
00021 {
00022
00023 TiXmlDocument config("DSACSSConfig.xml");
00024
00025 bool loadOk = config.LoadFile();
00026 checkLoadFile(loadOk, "DSACSSConfig.xml", config);
00027
00028 TiXmlHandle handle(&config);
00029
00030
00031 Whorl whorl;
00032
00033
00034 whorl.Initialize(handle);
00035
00036
00037 Vector accel(3);
00038 Vector rates(3);
00039 Vector mag(3);
00040
00041
00042
00043 while(1)
00044 {
00045 sleep(2);
00046
00047
00048 accel(1) = whorl.GetAccelerometer("ACC_X") -> GetMeasurement().GetAsDouble();
00049 accel(2) = whorl.GetAccelerometer("ACC_Y") -> GetMeasurement().GetAsDouble();
00050 accel(3) = whorl.GetAccelerometer("ACC_Z") -> GetMeasurement().GetAsDouble();
00051
00052
00053 rates(1) = whorl.GetRateGyro("RATE_GYRO_X") -> GetMeasurement().GetAsDouble();
00054 rates(2) = whorl.GetRateGyro("RATE_GYRO_Y") -> GetMeasurement().GetAsDouble();
00055 rates(3) = whorl.GetRateGyro("RATE_GYRO_Z") -> GetMeasurement().GetAsDouble();
00056
00057
00058 mag = whorl.GetMagnetometer() -> GetVectorMeasurement();
00059
00060
00061 cerr << "Acceleration: " << ~accel << endl;
00062 cerr << "Angular Rates: " << ~rates << endl;
00063 cerr << "Magnetometer reading: " << ~mag << endl;
00064
00065
00066 rates(1) = whorl.GetRateGyro("RATE_GYRO_X") -> GetMeasurement().GetAsDouble();
00067 rates(2) = whorl.GetRateGyro("RATE_GYRO_Y") -> GetMeasurement().GetAsDouble();
00068 rates(3) = whorl.GetRateGyro("RATE_GYRO_Z") -> GetMeasurement().GetAsDouble();
00069 cerr << "Angular Rates: " << ~rates << endl;
00070
00071
00072 usleep(100000);
00073 }
00074 return( 0 );
00075 }
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088