DART  6.10.1
FreeJoint.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2021, 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_FREEJOINT_HPP_
34 #define DART_DYNAMICS_FREEJOINT_HPP_
35 
36 #include <string>
37 
38 #include <Eigen/Dense>
39 
42 
43 namespace dart {
44 namespace dynamics {
45 
47 class FreeJoint : public GenericJoint<math::SE3Space>
48 {
49 public:
50  friend class Skeleton;
51 
53 
55  {
57 
59 
60  virtual ~Properties() = default;
61  };
62 
63  FreeJoint(const FreeJoint&) = delete;
64 
66  virtual ~FreeJoint();
67 
70 
71  // Documentation inherited
72  const std::string& getType() const override;
73 
75  static const std::string& getStaticType();
76 
77  // Documentation inherited
78  bool isCyclic(std::size_t _index) const override;
79 
86  static Eigen::Vector6d convertToPositions(const Eigen::Isometry3d& _tf);
87 
89  static Eigen::Isometry3d convertToTransform(
90  const Eigen::Vector6d& _positions);
91 
97  DART_DEPRECATED(6.9)
98  static void setTransform(
99  Joint* joint,
100  const Eigen::Isometry3d& tf,
101  const Frame* withRespectTo = Frame::World());
102 
106  static void setTransformOf(
107  Joint* joint,
108  const Eigen::Isometry3d& tf,
109  const Frame* withRespectTo = Frame::World());
110 
116  DART_DEPRECATED(6.9)
117  static void setTransform(
118  BodyNode* bodyNode,
119  const Eigen::Isometry3d& tf,
120  const Frame* withRespectTo = Frame::World());
121 
125  static void setTransformOf(
126  BodyNode* bodyNode,
127  const Eigen::Isometry3d& tf,
128  const Frame* withRespectTo = Frame::World());
129 
136  DART_DEPRECATED(6.9)
137  static void setTransform(
138  Skeleton* skeleton,
139  const Eigen::Isometry3d& tf,
140  const Frame* withRespectTo = Frame::World(),
141  bool applyToAllRootBodies = true);
142 
147  static void setTransformOf(
148  Skeleton* skeleton,
149  const Eigen::Isometry3d& tf,
150  const Frame* withRespectTo = Frame::World(),
151  bool applyToAllRootBodies = true);
152 
179  void setSpatialMotion(
180  const Eigen::Isometry3d* newTransform,
181  const Frame* withRespectTo,
182  const Eigen::Vector6d* newSpatialVelocity,
183  const Frame* velRelativeTo,
184  const Frame* velInCoordinatesOf,
185  const Eigen::Vector6d* newSpatialAcceleration,
186  const Frame* accRelativeTo,
187  const Frame* accInCoordinatesOf);
188 
191  void setRelativeTransform(const Eigen::Isometry3d& newTransform);
192 
196  void setTransform(
197  const Eigen::Isometry3d& newTransform,
198  const Frame* withRespectTo = Frame::World());
199 
205  void setRelativeSpatialVelocity(const Eigen::Vector6d& newSpatialVelocity);
206 
213  const Eigen::Vector6d& newSpatialVelocity, const Frame* inCoordinatesOf);
214 
221  void setSpatialVelocity(
222  const Eigen::Vector6d& newSpatialVelocity,
223  const Frame* relativeTo,
224  const Frame* inCoordinatesOf);
225 
235  void setLinearVelocity(
236  const Eigen::Vector3d& newLinearVelocity,
237  const Frame* relativeTo = Frame::World(),
238  const Frame* inCoordinatesOf = Frame::World());
239 
249  void setAngularVelocity(
250  const Eigen::Vector3d& newAngularVelocity,
251  const Frame* relativeTo = Frame::World(),
252  const Frame* inCoordinatesOf = Frame::World());
253 
260  const Eigen::Vector6d& newSpatialAcceleration);
261 
269  const Eigen::Vector6d& newSpatialAcceleration,
270  const Frame* inCoordinatesOf);
271 
280  const Eigen::Vector6d& newSpatialAcceleration,
281  const Frame* relativeTo,
282  const Frame* inCoordinatesOf);
283 
294  const Eigen::Vector3d& newLinearAcceleration,
295  const Frame* relativeTo = Frame::World(),
296  const Frame* inCoordinatesOf = Frame::World());
297 
309  const Eigen::Vector3d& newAngularAcceleration,
310  const Frame* relativeTo = Frame::World(),
311  const Frame* inCoordinatesOf = Frame::World());
312 
313  // Documentation inherited
315  const Eigen::Vector6d& _positions) const override;
316 
317  // Documentation inherited
319  const Eigen::Vector6d& _q2, const Eigen::Vector6d& _q1) const override;
320 
321 protected:
324 
325  // Documentation inherited
326  Joint* clone() const override;
327 
329 
330  // Documentation inherited
331  void integratePositions(double _dt) override;
332 
333  // Documentation inherited
334  void updateDegreeOfFreedomNames() override;
335 
336  // Documentation inherited
337  void updateRelativeTransform() const override;
338 
339  // Documentation inherited
340  void updateRelativeJacobian(bool _mandatory = true) const override;
341 
342  // Documentation inherited
343  void updateRelativeJacobianTimeDeriv() const override;
344 
345 protected:
347  const Eigen::Isometry3d& getQ() const;
348 
352  mutable Eigen::Isometry3d mQ;
353 
354 public:
355  // To get byte-aligned Eigen vectors
356  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
357 };
358 
359 } // namespace dynamics
360 } // namespace dart
361 
362 #endif // DART_DYNAMICS_FREEJOINT_HPP_
#define DART_DEPRECATED(version)
Definition: Deprecated.hpp:51
#define DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(class_name)
Definition: Memory.hpp:155
BodyPropPtr properties
Definition: SdfParser.cpp:80
Terminator for the variadic template.
Definition: CompositeJoiner.hpp:45
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:79
The Frame class serves as the backbone of DART's kinematic tree structure.
Definition: Frame.hpp:58
class FreeJoint
Definition: FreeJoint.hpp:48
void setRelativeTransform(const Eigen::Isometry3d &newTransform)
Set the transform of the child BodyNode relative to the parent BodyNode.
Definition: FreeJoint.cpp:186
Eigen::Vector6d getPositionDifferencesStatic(const Eigen::Vector6d &_q2, const Eigen::Vector6d &_q1) const override
Definition: FreeJoint.cpp:542
FreeJoint(const FreeJoint &)=delete
void setLinearAcceleration(const Eigen::Vector3d &newLinearAcceleration, const Frame *relativeTo=Frame::World(), const Frame *inCoordinatesOf=Frame::World())
Set the linear portion of classical acceleration of the child BodyNode relative to an arbitrary Frame...
Definition: FreeJoint.cpp:455
Properties getFreeJointProperties() const
Get the Properties of this FreeJoint.
Definition: FreeJoint.cpp:58
void updateDegreeOfFreedomNames() override
Definition: FreeJoint.cpp:599
static const std::string & getStaticType()
Get joint type for this class.
Definition: FreeJoint.cpp:576
static void setTransformOf(Joint *joint, const Eigen::Isometry3d &tf, const Frame *withRespectTo=Frame::World())
If the given joint is a FreeJoint, then set the transform of the given Joint's child BodyNode so that...
Definition: FreeJoint.cpp:90
void updateRelativeJacobian(bool _mandatory=true) const override
Definition: FreeJoint.cpp:627
void updateRelativeTransform() const override
Definition: FreeJoint.cpp:616
void setRelativeSpatialVelocity(const Eigen::Vector6d &newSpatialVelocity)
Set the spatial velocity of the child BodyNode relative to the parent BodyNode.
Definition: FreeJoint.cpp:205
void setLinearVelocity(const Eigen::Vector3d &newLinearVelocity, const Frame *relativeTo=Frame::World(), const Frame *inCoordinatesOf=Frame::World())
Set the linear portion of classical velocity of the child BodyNode relative to an arbitrary Frame.
Definition: FreeJoint.cpp:283
void setRelativeSpatialAcceleration(const Eigen::Vector6d &newSpatialAcceleration)
Set the spatial acceleration of the child BodyNode relative to the parent BodyNode.
Definition: FreeJoint.cpp:357
void setSpatialMotion(const Eigen::Isometry3d *newTransform, const Frame *withRespectTo, const Eigen::Vector6d *newSpatialVelocity, const Frame *velRelativeTo, const Frame *velInCoordinatesOf, const Eigen::Vector6d *newSpatialAcceleration, const Frame *accRelativeTo, const Frame *accInCoordinatesOf)
Set the transform, spatial velocity, and spatial acceleration of the child BodyNode relative to an ar...
Definition: FreeJoint.cpp:162
void setAngularAcceleration(const Eigen::Vector3d &newAngularAcceleration, const Frame *relativeTo=Frame::World(), const Frame *inCoordinatesOf=Frame::World())
Set the angular portion of classical acceleration of the child BodyNode relative to an arbitrary Fram...
Definition: FreeJoint.cpp:496
void updateRelativeJacobianTimeDeriv() const override
Definition: FreeJoint.cpp:635
void setSpatialAcceleration(const Eigen::Vector6d &newSpatialAcceleration, const Frame *relativeTo, const Frame *inCoordinatesOf)
Set the spatial acceleration of the child BodyNode relative to an arbitrary Frame.
Definition: FreeJoint.cpp:386
void integratePositions(double _dt) override
Definition: FreeJoint.cpp:590
Joint * clone() const override
Definition: FreeJoint.cpp:564
const std::string & getType() const override
Definition: FreeJoint.cpp:570
static void setTransform(Joint *joint, const Eigen::Isometry3d &tf, const Frame *withRespectTo=Frame::World())
If the given joint is a FreeJoint, then set the transform of the given Joint's child BodyNode so that...
Definition: FreeJoint.cpp:83
void setAngularVelocity(const Eigen::Vector3d &newAngularVelocity, const Frame *relativeTo=Frame::World(), const Frame *inCoordinatesOf=Frame::World())
Set the angular portion of classical velocity of the child BodyNode relative to an arbitrary Frame.
Definition: FreeJoint.cpp:320
static Eigen::Isometry3d convertToTransform(const Eigen::Vector6d &_positions)
Convert a FreeJoint-style 6D vector into a transform.
Definition: FreeJoint.cpp:73
static Eigen::Vector6d convertToPositions(const Eigen::Isometry3d &_tf)
Convert a transform into a 6D vector that can be used to set the positions of a FreeJoint.
Definition: FreeJoint.cpp:64
const Eigen::Isometry3d & getQ() const
Access mQ, which is an auto-updating variable.
Definition: FreeJoint.cpp:641
Eigen::Isometry3d mQ
Transformation matrix dependent on generalized coordinates.
Definition: FreeJoint.hpp:352
virtual ~FreeJoint()
Destructor.
Definition: FreeJoint.cpp:52
void setSpatialVelocity(const Eigen::Vector6d &newSpatialVelocity, const Frame *relativeTo, const Frame *inCoordinatesOf)
Set the spatial velocity of the child BodyNode relative to an arbitrary Frame.
Definition: FreeJoint.cpp:230
bool isCyclic(std::size_t _index) const override
Definition: FreeJoint.cpp:583
Definition: GenericJoint.hpp:48
const GenericJoint< math::SE3Space >::JacobianMatrix & getRelativeJacobianStatic() const
Fixed-size version of getRelativeJacobian()
Definition: GenericJoint.hpp:1570
detail::GenericJointProperties< math::SE3Space > Properties
Definition: GenericJoint.hpp:62
class Joint
Definition: Joint.hpp:60
class Skeleton
Definition: Skeleton.hpp:59
Definition: Random-impl.hpp:92
Matrix< double, 6, 1 > Vector6d
Definition: MathTypes.hpp:49
Matrix< double, 6, 6 > Matrix6d
Definition: MathTypes.hpp:50
Definition: BulletCollisionDetector.cpp:65
Definition: FreeJoint.hpp:55
Properties(const Base::Properties &properties=Base::Properties())
Definition: FreeJoint.cpp:45