towr_xpp_ee_map.h
Go to the documentation of this file.
1 /******************************************************************************
2 Copyright (c) 2017, Alexander W. Winkler. All rights reserved.
3 
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
6 
7 * Redistributions of source code must retain the above copyright notice, this
8  list of conditions and the following disclaimer.
9 
10 * Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 * Neither the name of the copyright holder nor the names of its
15  contributors may be used to endorse or promote products derived from
16  this software without specific prior written permission.
17 
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 ******************************************************************************/
29 
35 #ifndef TOWR_TOWR_ROS_INCLUDE_TOWR_ROS_TOWR_XPP_EE_MAP_H_
36 #define TOWR_TOWR_ROS_INCLUDE_TOWR_ROS_TOWR_XPP_EE_MAP_H_
37 
38 #include <map>
41 
42 
43 namespace towr {
44 
46 static std::map<towr::BipedIDs, xpp::biped::FootIDs> biped_to_xpp_id =
47 {
48  {L, xpp::biped::L},
49  {R, xpp::biped::R},
50 };
51 
52 static std::map<towr::QuadrupedIDs, xpp::quad::FootIDs> quad_to_xpp_id =
53 {
54  {LF, xpp::quad::LF},
55  {RF, xpp::quad::RF},
56  {LH, xpp::quad::LH},
57  {RH, xpp::quad::RH}
58 };
59 
60 
62 static std::map<towr::BipedIDs, std::string> biped_to_name =
63 {
64  {L, "Left" },
65  {R, "Right"}
66 };
67 
68 static std::map<towr::QuadrupedIDs, std::string> quad_to_name =
69 {
70  {LF, "Left-Front" },
71  {RF, "Right-Front"},
72  {LH, "Left-Hind" },
73  {RH, "Right-Hind" }
74 };
75 
76 
85 static std::pair<xpp::EndeffectorID, std::string>
86 ToXppEndeffector(int number_of_ee, int towr_ee_id)
87 {
88  std::pair<xpp::EndeffectorID, std::string> ee;
89 
90  switch (number_of_ee) {
91  case 1:
92  ee.first = towr_ee_id;
93  ee.second = "E0";
94  break;
95  case 2: {
96  auto id = static_cast<towr::BipedIDs>(towr_ee_id);
97  ee.first = biped_to_xpp_id.at(id);
98  ee.second = biped_to_name.at(id);
99  break;
100  }
101  case 4: {
102  auto id = static_cast<towr::QuadrupedIDs>(towr_ee_id);
103  ee.first = quad_to_xpp_id.at(id);
104  ee.second = quad_to_name.at(id);
105  break;
106  }
107  default:
108  assert(false); // endeffector mapping not defined
109  break;
110  }
111 
112  return ee;
113 }
114 
119 {
120  xpp::StateLinXd xpp(towr.p().rows());
121 
122  xpp.p_ = towr.p();
123  xpp.v_ = towr.v();
124  xpp.a_ = towr.a();
125 
126  return xpp;
127 }
128 
129 } // namespace towr
130 
131 #endif /* TOWR_TOWR_ROS_INCLUDE_TOWR_ROS_TOWR_XPP_EE_MAP_H_ */
static std::map< towr::BipedIDs, xpp::biped::FootIDs > biped_to_xpp_id
static std::map< towr::QuadrupedIDs, xpp::quad::FootIDs > quad_to_xpp_id
static std::map< towr::BipedIDs, std::string > biped_to_name
QuadrupedIDs
static std::pair< xpp::EndeffectorID, std::string > ToXppEndeffector(int number_of_ee, int towr_ee_id)
const VectorXd p() const
static std::map< towr::QuadrupedIDs, std::string > quad_to_name
const VectorXd v() const
static xpp::StateLinXd ToXpp(const towr::State &towr)
const VectorXd a() const


towr_ros
Author(s): Alexander W. Winkler
autogenerated on Sat Apr 13 2019 02:28:05