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:
50  using Base = Endeffectors<VectorXd>;
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:
123  int n_joints_per_leg_;
124  int n_joints_;
125 };
126 
127 } /* namespace xpp */
128 
129 #endif /* _XPP_STATES_JOINTS_H_ */
xpp::Joints::n_joints_per_leg_
int n_joints_per_leg_
Definition: joints.h:177
xpp::VectorXd
Eigen::VectorXd VectorXd
Definition: state.h:77
xpp::Joints::n_joints_
int n_joints_
Definition: joints.h:178
xpp::Joints::Joints
Joints(int n_ee, int n_joints_per_ee, double value=0.0)
Constructs joint values all set to value.
Definition: joints.cc:62
xpp::Joints::EEOrder
std::vector< EndeffectorID > EEOrder
Definition: joints.h:107
xpp::Joints::JointID
uint JointID
Definition: joints.h:108
xpp::Joints::~Joints
virtual ~Joints()=default
xpp::Joints::GetNumJointsPerEE
int GetNumJointsPerEE() const
Definition: joints.cc:85
xpp::Endeffectors< VectorXd >::GetEECount
int GetEECount() const
Definition: endeffectors.h:238
xpp::Joints::Base
Endeffectors< VectorXd > Base
Definition: joints.h:104
xpp::Joints::GetJoint
double & GetJoint(JointID joint)
Definition: joints.cc:128
xpp
Definition: cartesian_declarations.h:41
xpp::Joints::GetNumJoints
int GetNumJoints() const
Definition: joints.cc:79
xpp::Joints::ToVec
VectorXd ToVec() const
Converts joint values to Eigen vector.
Definition: joints.cc:116
xpp::Endeffectors< VectorXd >::at
VectorXd & at(EndeffectorID ee)
Read/write access to the endeffector stored at index ee.
Definition: endeffectors.h:224
xpp::Joints::SetFromVec
void SetFromVec(const VectorXd &q)
Sets joints values from Eigen vector.
Definition: joints.cc:122
endeffectors.h


xpp_states
Author(s): Alexander W. Winkler
autogenerated on Wed Mar 2 2022 01:14:14