00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <dsacssinterface.h>
00013
00014 using namespace std;
00015 using namespace O_SESSAME;
00016
00017
00018 int main()
00019 {
00020
00021 cout << "Testing xml parser functions" << endl;
00022 cout << "Parsing XML File..." << endl;
00023
00024
00025 const char *fileName = "DSACSSConfig.xml";
00026
00027
00028 TiXmlDocument config( fileName );
00029
00030
00031 bool loadOkay = config.LoadFile();
00032 checkLoadFile(loadOkay, fileName, config);
00033
00034
00035 cout << "Printing XML FILE to Screen" << endl;
00036 config.Print();
00037
00038
00039 TiXmlHandle docHandle( &config );
00040
00041
00042 const char *whorl_I = "WHORL-I";
00043 const char *physicalProperties = "PHYSICAL_PROPERTIES";
00044 const char *hardwareProperties = "HARDWARE_PROPERTIES";
00045 const char *magnetometer = "MAGNETOMETER";
00046 const char *attribute = "value";
00047
00048 int response;
00049
00050
00051 double mass;
00052 response = docHandle.FirstChild( whorl_I ).FirstChild( physicalProperties ).
00053 Child( "MASS", 0 ).Element() -> QueryDoubleAttribute(attribute, &mass);
00054 checkResponse(response);
00055 cout << "mass: \n" << mass << endl;
00056
00057
00058 Matrix inertia = simulatorInertia(docHandle, whorl_I);
00059 cout << "inerteria matrix: \n" << inertia << endl;
00060
00061
00062 Vector magnetometerInertial(3);
00063 response = docHandle.FirstChild( whorl_I ).FirstChild( hardwareProperties ).FirstChild( magnetometer ).
00064 Child( "INERTIAL_VECTOR", 0 ).Element() -> QueryDoubleAttribute("valueX", &magnetometerInertial(1));
00065 checkResponse(response);
00066 response = docHandle.FirstChild( whorl_I ).FirstChild( hardwareProperties ).FirstChild( magnetometer ).
00067 Child( "INERTIAL_VECTOR", 0 ).Element() -> QueryDoubleAttribute("valueY", &magnetometerInertial(2));
00068 checkResponse(response);
00069 response = docHandle.FirstChild( whorl_I ).FirstChild( hardwareProperties ).FirstChild( magnetometer ).
00070 Child( "INERTIAL_VECTOR", 0 ).Element() -> QueryDoubleAttribute("valueZ", &magnetometerInertial(3));
00071 checkResponse(response);
00072 cout << "magnetometer inertial vector:\n" << magnetometerInertial << endl;
00073 cout << "Finish test xml functions" << endl;
00074
00075 return(0);
00076 }
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091