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
00035 #ifndef TOWR_TOWR_ROS_INCLUDE_TOWR_ROS_TOWR_XPP_EE_MAP_H_
00036 #define TOWR_TOWR_ROS_INCLUDE_TOWR_ROS_TOWR_XPP_EE_MAP_H_
00037
00038 #include <map>
00039 #include <towr/models/endeffector_mappings.h>
00040 #include <xpp_states/endeffector_mappings.h>
00041
00042
00043 namespace towr {
00044
00046 static std::map<towr::BipedIDs, xpp::biped::FootIDs> biped_to_xpp_id =
00047 {
00048 {L, xpp::biped::L},
00049 {R, xpp::biped::R},
00050 };
00051
00052 static std::map<towr::QuadrupedIDs, xpp::quad::FootIDs> quad_to_xpp_id =
00053 {
00054 {LF, xpp::quad::LF},
00055 {RF, xpp::quad::RF},
00056 {LH, xpp::quad::LH},
00057 {RH, xpp::quad::RH}
00058 };
00059
00060
00062 static std::map<towr::BipedIDs, std::string> biped_to_name =
00063 {
00064 {L, "Left" },
00065 {R, "Right"}
00066 };
00067
00068 static std::map<towr::QuadrupedIDs, std::string> quad_to_name =
00069 {
00070 {LF, "Left-Front" },
00071 {RF, "Right-Front"},
00072 {LH, "Left-Hind" },
00073 {RH, "Right-Hind" }
00074 };
00075
00076
00085 static std::pair<xpp::EndeffectorID, std::string>
00086 ToXppEndeffector(int number_of_ee, int towr_ee_id)
00087 {
00088 std::pair<xpp::EndeffectorID, std::string> ee;
00089
00090 switch (number_of_ee) {
00091 case 1:
00092 ee.first = towr_ee_id;
00093 ee.second = "E0";
00094 break;
00095 case 2: {
00096 auto id = static_cast<towr::BipedIDs>(towr_ee_id);
00097 ee.first = biped_to_xpp_id.at(id);
00098 ee.second = biped_to_name.at(id);
00099 break;
00100 }
00101 case 4: {
00102 auto id = static_cast<towr::QuadrupedIDs>(towr_ee_id);
00103 ee.first = quad_to_xpp_id.at(id);
00104 ee.second = quad_to_name.at(id);
00105 break;
00106 }
00107 default:
00108 assert(false);
00109 break;
00110 }
00111
00112 return ee;
00113 }
00114
00118 static xpp::StateLinXd ToXpp(const towr::State& towr)
00119 {
00120 xpp::StateLinXd xpp(towr.p().rows());
00121
00122 xpp.p_ = towr.p();
00123 xpp.v_ = towr.v();
00124 xpp.a_ = towr.a();
00125
00126 return xpp;
00127 }
00128
00129 }
00130
00131 #endif