DART  6.6.2
EulerJoint.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2018, The DART development contributors
3  * All rights reserved.
4  *
5  * The list of contributors can be found at:
6  * https://github.com/dartsim/dart/blob/master/LICENSE
7  *
8  * This file is provided under the following "BSD-style" License:
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef DART_DYNAMICS_EULERJOINT_HPP_
34 #define DART_DYNAMICS_EULERJOINT_HPP_
35 
37 
38 namespace dart {
39 namespace dynamics {
40 
43 {
44 public:
45 
46  friend class Skeleton;
51 
53 
54  EulerJoint(const EulerJoint&) = delete;
55 
57  virtual ~EulerJoint();
58 
60  void setProperties(const Properties& _properties);
61 
63  void setProperties(const UniqueProperties& _properties);
64 
67 
70 
72  void copy(const EulerJoint& _otherJoint);
73 
75  void copy(const EulerJoint* _otherJoint);
76 
78  EulerJoint& operator=(const EulerJoint& _otherJoint);
79 
80  // Documentation inherited
81  const std::string& getType() const override;
82 
84  static const std::string& getStaticType();
85 
86  // Documentation inherited
87  bool isCyclic(std::size_t _index) const override;
88 
93  void setAxisOrder(AxisOrder _order, bool _renameDofs = true);
94 
96  AxisOrder getAxisOrder() const;
97 
104  template <typename RotationType>
105  static Eigen::Vector3d convertToPositions(
106  const RotationType& _rotation, AxisOrder _ordering)
107  {
108  switch(_ordering)
109  {
110  case AxisOrder::XYZ:
111  return math::matrixToEulerXYZ(_rotation);
112  case AxisOrder::ZYX:
113  return math::matrixToEulerZYX(_rotation);
114  default:
115  dtwarn << "[EulerJoint::convertToPositions] Unsupported AxisOrder ("
116  << static_cast<int>(_ordering) << "), returning a zero vector\n";
117  return Eigen::Vector3d::Zero();
118  }
119  }
120 
124  template <typename RotationType>
125  Eigen::Vector3d convertToPositions(const RotationType& _rotation) const
126  {
127  return convertToPositions(_rotation, getAxisOrder());
128  }
129 
131  static Eigen::Isometry3d convertToTransform(const Eigen::Vector3d& _positions,
132  AxisOrder _ordering);
133 
137  Eigen::Isometry3d convertToTransform(const Eigen::Vector3d& _positions) const;
138 
140  static Eigen::Matrix3d convertToRotation(const Eigen::Vector3d& _positions,
141  AxisOrder _ordering);
142 
143  Eigen::Matrix3d convertToRotation(const Eigen::Vector3d& _positions) const;
144 
145  // Documentation inherited
146  Eigen::Matrix<double, 6, 3> getRelativeJacobianStatic(
147  const Eigen::Vector3d& _positions) const override;
148 
149 protected:
150 
153 
154  // Documentation inherited
155  Joint* clone() const override;
156 
157  using Base::getRelativeJacobianStatic;
158 
161  void updateDegreeOfFreedomNames() override;
162 
163  // Documentation inherited
164  void updateRelativeTransform() const override;
165 
166  // Documentation inherited
167  void updateRelativeJacobian(bool =true) const override;
168 
169  // Documentation inherited
170  void updateRelativeJacobianTimeDeriv() const override;
171 };
172 
173 } // namespace dynamics
174 } // namespace dart
175 
176 #endif // DART_DYNAMICS_EULERJOINT_HPP_
#define dtwarn
Output a warning message.
Definition: Console.hpp:46
BodyPropPtr properties
Definition: SdfParser.cpp:80
Terminator for the variadic template.
Definition: CompositeJoiner.hpp:45
This is an alternative to EmbedProperties which allows your class to also inherit other Composite obj...
Definition: EmbeddedAspect.hpp:248
typename Impl::Aspect Aspect
Definition: EmbeddedAspect.hpp:255
typename Impl::AspectProperties AspectProperties
Definition: EmbeddedAspect.hpp:254
class EulerJoint
Definition: EulerJoint.hpp:43
static Eigen::Vector3d convertToPositions(const RotationType &_rotation, AxisOrder _ordering)
Convert a rotation into a 3D vector that can be used to set the positions of an EulerJoint with the s...
Definition: EulerJoint.hpp:105
Eigen::Vector3d convertToPositions(const RotationType &_rotation) const
This is a version of EulerJoint::convertToPositions(const RotationType&, AxisOrder) which will use th...
Definition: EulerJoint.hpp:125
detail::EulerJointProperties Properties
Definition: EulerJoint.hpp:49
void setAxisOrder(AxisOrder _order, bool _renameDofs=true)
Set the axis order.
Definition: EulerJoint.cpp:122
void copy(const EulerJoint &_otherJoint)
Copy the Properties of another EulerJoint.
Definition: EulerJoint.cpp:78
void setAspectProperties(const AspectProperties &properties)
Set the AspectProperties of this EulerJoint.
Definition: EulerJoint.cpp:65
Properties getEulerJointProperties() const
Get the Properties of this EulerJoint.
Definition: EulerJoint.cpp:71
void setProperties(const Properties &_properties)
Set the Properties of this EulerJoint.
Definition: EulerJoint.cpp:51
bool isCyclic(std::size_t _index) const override
Definition: EulerJoint.cpp:116
void updateRelativeJacobian(bool=true) const override
Definition: EulerJoint.cpp:345
static Eigen::Isometry3d convertToTransform(const Eigen::Vector3d &_positions, AxisOrder _ordering)
Convert a set of Euler angle positions into a transform.
Definition: EulerJoint.cpp:140
void updateRelativeTransform() const override
Definition: EulerJoint.cpp:336
EulerJoint(const EulerJoint &)=delete
static Eigen::Matrix3d convertToRotation(const Eigen::Vector3d &_positions, AxisOrder _ordering)
Convert a set of Euler angle positions into a rotation matrix.
Definition: EulerJoint.cpp:154
void updateDegreeOfFreedomNames() override
Set the names of this joint's DegreesOfFreedom.
Definition: EulerJoint.cpp:305
Eigen::Matrix< double, 6, 3 > getRelativeJacobianStatic(const Eigen::Vector3d &_positions) const override
Definition: EulerJoint.cpp:180
void updateRelativeJacobianTimeDeriv() const override
Definition: EulerJoint.cpp:351
Joint * clone() const override
Definition: EulerJoint.cpp:299
detail::AxisOrder AxisOrder
Definition: EulerJoint.hpp:47
const std::string & getType() const override
Definition: EulerJoint.cpp:103
AxisOrder getAxisOrder() const
Return the axis order.
Definition: EulerJoint.cpp:134
static const std::string & getStaticType()
Get joint type for this class.
Definition: EulerJoint.cpp:109
class Joint
Definition: Joint.hpp:59
class Skeleton
Definition: Skeleton.hpp:59
#define DART_BAKE_SPECIALIZED_ASPECT_IRREGULAR(TypeName, AspectName)
Definition: Composite.hpp:164
Definition: MathTypes.hpp:47
AxisOrder
Axis order.
Definition: EulerJointAspect.hpp:50
common::EmbedPropertiesOnTopOf< EulerJoint, EulerJointUniqueProperties, GenericJoint< math::R3Space > > EulerJointBase
Definition: EulerJointAspect.hpp:86
Eigen::Vector3d matrixToEulerXYZ(const Eigen::Matrix3d &_R)
get the Euler XYZ angle from R
Definition: Geometry.cpp:105
Eigen::Vector3d matrixToEulerZYX(const Eigen::Matrix3d &_R)
get the Euler ZYX angle from R
Definition: Geometry.cpp:136
Definition: BulletCollisionDetector.cpp:63
Definition: SharedLibraryManager.hpp:43
Definition: EulerJointAspect.hpp:71
Definition: EulerJointAspect.hpp:57