joints.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 
30 #ifndef _XPP_STATES_JOINTS_H_
31 #define _XPP_STATES_JOINTS_H_
32 
33 #include <vector>
34 #include <Eigen/Dense>
35 
37 
38 namespace xpp {
39 
48 class Joints : public Endeffectors<VectorXd> {
49 public:
51  using Base::GetEECount;
52  using Base::at;
53  using EEOrder = std::vector<EndeffectorID>;
54  using JointID = uint;
55 
67  explicit Joints (int n_ee, int n_joints_per_ee, double value = 0.0);
68 
75  explicit Joints (const std::vector<VectorXd>& joints);
76  virtual ~Joints () = default;
77 
84  VectorXd ToVec() const;
85 
90  VectorXd ToVec(const EEOrder& ee_order) const;
91 
100  void SetFromVec(const VectorXd& q);
101 
107  void SetFromVec(const VectorXd& q, const EEOrder& ee_order);
108 
112  double& GetJoint(JointID joint);
113 
117  double GetJoint(JointID joint) const;
118 
119  int GetNumJoints() const;
120  int GetNumJointsPerEE() const;
121 
122 private:
125 };
126 
127 } /* namespace xpp */
128 
129 #endif /* _XPP_STATES_JOINTS_H_ */
std::vector< EndeffectorID > EEOrder
Definition: joints.h:53
int GetNumJointsPerEE() const
Definition: joints.cc:58
VectorXd & at(EndeffectorID ee)
Read/write access to the endeffector stored at index ee.
uint JointID
Definition: joints.h:54
int GetNumJoints() const
Definition: joints.cc:52
VectorXd ToVec() const
Converts joint values to Eigen vector.
Definition: joints.cc:89
double & GetJoint(JointID joint)
Definition: joints.cc:101
void SetFromVec(const VectorXd &q)
Sets joints values from Eigen vector.
Definition: joints.cc:95
Joints(int n_ee, int n_joints_per_ee, double value=0.0)
Constructs joint values all set to value.
Definition: joints.cc:35
Container to access joint values of each endeffectors.
Definition: joints.h:48
virtual ~Joints()=default
int n_joints_
Definition: joints.h:124
int n_joints_per_leg_
Definition: joints.h:123
Data structure to assign values to each endeffector.
Definition: endeffectors.h:59
Eigen::VectorXd VectorXd
Definition: state.h:50


xpp_states
Author(s): Alexander W. Winkler
autogenerated on Tue Dec 8 2020 03:10:29