Go to the documentation of this file.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
00034
00035
00036
00037
00038
00039 #ifndef KUKA_RSI_HW_INTERFACE_RSI_STATE_
00040 #define KUKA_RSI_HW_INTERFACE_RSI_STATE_
00041
00042 #include <string>
00043 #include <tinyxml.h>
00044
00045 namespace kuka_rsi_hw_interface
00046 {
00047
00048 class RSIState
00049 {
00050
00051 private:
00052 std::string xml_doc_;
00053
00054 public:
00055 RSIState() :
00056 positions(6, 0.0),
00057 initial_positions(6, 0.0),
00058 cart_position(6, 0.0),
00059 initial_cart_position(6, 0.0)
00060 {
00061 xml_doc_.resize(1024);
00062 }
00063
00064 RSIState(std::string xml_doc);
00065
00066 std::vector<double> positions;
00067
00068 std::vector<double> initial_positions;
00069
00070 std::vector<double> cart_position;
00071
00072 std::vector<double> initial_cart_position;
00073
00074 unsigned long long ipoc;
00075
00076 };
00077
00078 RSIState::RSIState(std::string xml_doc) :
00079 xml_doc_(xml_doc),
00080 positions(6, 0.0),
00081 initial_positions(6, 0.0),
00082 cart_position(6, 0.0),
00083 initial_cart_position(6, 0.0)
00084 {
00085
00086 TiXmlDocument bufferdoc;
00087 bufferdoc.Parse(xml_doc_.c_str());
00088
00089 TiXmlElement* rob = bufferdoc.FirstChildElement("Rob");
00090
00091 TiXmlElement* AIPos_el = rob->FirstChildElement("AIPos");
00092 AIPos_el->Attribute("A1", &positions[0]);
00093 AIPos_el->Attribute("A2", &positions[1]);
00094 AIPos_el->Attribute("A3", &positions[2]);
00095 AIPos_el->Attribute("A4", &positions[3]);
00096 AIPos_el->Attribute("A5", &positions[4]);
00097 AIPos_el->Attribute("A6", &positions[5]);
00098
00099 TiXmlElement* ASPos_el = rob->FirstChildElement("ASPos");
00100 ASPos_el->Attribute("A1", &initial_positions[0]);
00101 ASPos_el->Attribute("A2", &initial_positions[1]);
00102 ASPos_el->Attribute("A3", &initial_positions[2]);
00103 ASPos_el->Attribute("A4", &initial_positions[3]);
00104 ASPos_el->Attribute("A5", &initial_positions[4]);
00105 ASPos_el->Attribute("A6", &initial_positions[5]);
00106
00107 TiXmlElement* RIst_el = rob->FirstChildElement("RIst");
00108 RIst_el->Attribute("X", &cart_position[0]);
00109 RIst_el->Attribute("Y", &cart_position[1]);
00110 RIst_el->Attribute("Z", &cart_position[2]);
00111 RIst_el->Attribute("A", &cart_position[3]);
00112 RIst_el->Attribute("B", &cart_position[4]);
00113 RIst_el->Attribute("C", &cart_position[5]);
00114
00115 TiXmlElement* RSol_el = rob->FirstChildElement("RSol");
00116 RSol_el->Attribute("X", &initial_cart_position[0]);
00117 RSol_el->Attribute("Y", &initial_cart_position[1]);
00118 RSol_el->Attribute("Z", &initial_cart_position[2]);
00119 RSol_el->Attribute("A", &initial_cart_position[3]);
00120 RSol_el->Attribute("B", &initial_cart_position[4]);
00121 RSol_el->Attribute("C", &initial_cart_position[5]);
00122
00123 TiXmlElement* ipoc_el = rob->FirstChildElement("IPOC");
00124 ipoc = std::stoull(ipoc_el->FirstChild()->Value());
00125 }
00126
00127 }
00128
00129 #endif