DART  6.7.3
SimpleFrame.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2019, 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_SIMPLEFRAME_HPP_
34 #define DART_DYNAMICS_SIMPLEFRAME_HPP_
35 
37 
38 namespace dart {
39 namespace dynamics {
40 
51 class SimpleFrame : public Detachable, public ShapeFrame
52 {
53 public:
54 
56 
57 
58  explicit SimpleFrame(Frame* _refFrame,
59  const std::string& _name = "simple_frame",
60  const Eigen::Isometry3d& _relativeTransform = Eigen::Isometry3d::Identity());
61 
64  SimpleFrame(const SimpleFrame& _otherFrame, Frame* _refFrame = Frame::World());
65 
67  virtual ~SimpleFrame();
68 
69  // Documentation inherited
70  const std::string& setName(const std::string& _name) override;
71 
72  // Documentation inherited
73  const std::string& getName() const override;
74 
78  std::shared_ptr<SimpleFrame> clone(Frame* _refFrame = Frame::World()) const;
79 
84  void copy(const Frame& _otherFrame, Frame* _refFrame = Frame::World(),
85  bool _copyProperties=true);
86 
88  void copy(const Frame* _otherFrame, Frame* _refFrame = Frame::World(),
89  bool _copyProperties=true);
90 
93  SimpleFrame& operator=(const SimpleFrame& _otherFrame);
94 
99  std::shared_ptr<SimpleFrame> spawnChildSimpleFrame(
100  const std::string& name = "SimpleFrame",
101  const Eigen::Isometry3d& relativeTransform
102  = Eigen::Isometry3d::Identity());
103 
104  //--------------------------------------------------------------------------
105  // Transform
106  //--------------------------------------------------------------------------
107 
109  void setRelativeTransform(const Eigen::Isometry3d& _newRelTransform);
110 
112  void setRelativeTranslation(const Eigen::Vector3d& _newTranslation);
113 
115  void setRelativeRotation(const Eigen::Matrix3d& _newRotation);
116 
120  void setTransform(const Eigen::Isometry3d& _newTransform,
121  const Frame* _withRespectTo = Frame::World());
122 
126  void setTranslation(const Eigen::Vector3d& _newTranslation,
127  const Frame* _withRespectTo = Frame::World());
128 
132  void setRotation(const Eigen::Matrix3d& _newRotation,
133  const Frame* _withRespectTo = Frame::World());
134 
135  // Documentation inherited
136  const Eigen::Isometry3d& getRelativeTransform() const override;
137 
138  //--------------------------------------------------------------------------
139  // Velocity
140  //--------------------------------------------------------------------------
141 
150  void setRelativeSpatialVelocity(const Eigen::Vector6d& _newSpatialVelocity);
151 
157  void setRelativeSpatialVelocity(const Eigen::Vector6d& _newSpatialVelocity,
158  const Frame* _inCoordinatesOf);
159 
160  // Documentation inherited
161  const Eigen::Vector6d& getRelativeSpatialVelocity() const override;
162 
163  //--------------------------------------------------------------------------
164  // Acceleration
165  //--------------------------------------------------------------------------
166 
173  const Eigen::Vector6d& _newSpatialAcceleration);
174 
178  const Eigen::Vector6d& _newSpatialAcceleration,
179  const Frame* _inCoordinatesOf);
180 
181  // Documentation inherited
182  const Eigen::Vector6d& getRelativeSpatialAcceleration() const override;
183 
184  // Documentation inherited
185  const Eigen::Vector6d& getPrimaryRelativeAcceleration() const override;
186 
187  // Documentation inherited
188  const Eigen::Vector6d& getPartialAcceleration() const override;
189 
190  //--------------------------------------------------------------------------
191  // Classic Method
192  //--------------------------------------------------------------------------
193 
208  const Eigen::Vector3d& _linearVelocity = Eigen::Vector3d::Zero(),
209  const Eigen::Vector3d& _angularVelocity = Eigen::Vector3d::Zero(),
210  const Eigen::Vector3d& _linearAcceleration = Eigen::Vector3d::Zero(),
211  const Eigen::Vector3d& _angularAcceleration = Eigen::Vector3d::Zero());
212 
213 protected:
214 
216  std::string mName;
217 
219  Eigen::Isometry3d mRelativeTf;
220 
223 
226 
229 
230 public:
231  // To get byte-aligned Eigen vectors
232  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
233 
234 };
235 
236 } // namespace dart
237 } // namespace dynamics
238 
239 #endif // DART_DYNAMICS_SIMPLEFRAME_HPP_
#define DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(class_name)
Definition: Memory.hpp:148
std::string * name
Definition: SkelParser.cpp:1642
The Detachable class is a special case of the Entity base class.
Definition: Entity.hpp:233
The Frame class serves as the backbone of DART's kinematic tree structure.
Definition: Frame.hpp:57
static Frame * World()
Definition: Frame.cpp:72
Definition: ShapeFrame.hpp:164
The SimpleFrame class offers a user-friendly way of creating arbitrary Frames within the kinematic tr...
Definition: SimpleFrame.hpp:52
std::shared_ptr< SimpleFrame > clone(Frame *_refFrame=Frame::World()) const
Create a new SimpleFrame with the same world transform, velocity, and acceleration as this one.
Definition: SimpleFrame.cpp:99
void setRelativeRotation(const Eigen::Matrix3d &_newRotation)
Set the relative rotation of this SimpleFrame.
Definition: SimpleFrame.cpp:174
std::string mName
Name of this SimpleFrame.
Definition: SimpleFrame.hpp:216
void copy(const Frame &_otherFrame, Frame *_refFrame=Frame::World(), bool _copyProperties=true)
Make the world transform, world velocity, and world acceleration of this SimpleFrame match another Fr...
Definition: SimpleFrame.cpp:105
const Eigen::Vector6d & getRelativeSpatialAcceleration() const override
Get the spatial acceleration of this Frame relative to its parent Frame, in the coordinates of this F...
Definition: SimpleFrame.cpp:258
Eigen::Isometry3d mRelativeTf
Relative transform of the SimpleFrame.
Definition: SimpleFrame.hpp:219
void setRelativeSpatialVelocity(const Eigen::Vector6d &_newSpatialVelocity)
Set the spatial velocity of this SimpleFrame relative to its parent Frame.
Definition: SimpleFrame.cpp:212
void setClassicDerivatives(const Eigen::Vector3d &_linearVelocity=Eigen::Vector3d::Zero(), const Eigen::Vector3d &_angularVelocity=Eigen::Vector3d::Zero(), const Eigen::Vector3d &_linearAcceleration=Eigen::Vector3d::Zero(), const Eigen::Vector3d &_angularAcceleration=Eigen::Vector3d::Zero())
Set the relative velocity and acceleration of this Frame according to classical (non-spatial) relativ...
Definition: SimpleFrame.cpp:278
Eigen::Vector6d mRelativeAcceleration
Relative spatial acceleration of the SimpleFrame.
Definition: SimpleFrame.hpp:225
void setRelativeTransform(const Eigen::Isometry3d &_newRelTransform)
Set the relative transform of this SimpleFrame.
Definition: SimpleFrame.cpp:159
const Eigen::Vector6d & getPrimaryRelativeAcceleration() const override
The Featherstone ABI algorithm exploits a component of the spatial acceleration which we refer to as ...
Definition: SimpleFrame.cpp:264
Eigen::Vector6d mPartialAcceleration
Partial Acceleration of this Frame.
Definition: SimpleFrame.hpp:228
virtual ~SimpleFrame()
Destructor.
Definition: SimpleFrame.cpp:72
const std::string & getName() const override
Return the name of this Entity.
Definition: SimpleFrame.cpp:93
void setTransform(const Eigen::Isometry3d &_newTransform, const Frame *_withRespectTo=Frame::World())
Set the transform of this SimpleFrame so that its transform with respect to Frame _withRespectTo is e...
Definition: SimpleFrame.cpp:181
std::shared_ptr< SimpleFrame > spawnChildSimpleFrame(const std::string &name="SimpleFrame", const Eigen::Isometry3d &relativeTransform=Eigen::Isometry3d::Identity())
Spawn a child SimpleFrame to this SimpleFrame.
Definition: SimpleFrame.cpp:152
const Eigen::Vector6d & getRelativeSpatialVelocity() const override
Get the spatial velocity of this Frame relative to its parent Frame, in its own coordinates.
Definition: SimpleFrame.cpp:231
const Eigen::Isometry3d & getRelativeTransform() const override
Get the transform of this Frame with respect to its parent Frame.
Definition: SimpleFrame.cpp:206
void setRelativeSpatialAcceleration(const Eigen::Vector6d &_newSpatialAcceleration)
Set the spatial acceleration of this SimpleFrame relative to its parent Frame.
Definition: SimpleFrame.cpp:237
SimpleFrame(Frame *_refFrame, const std::string &_name="simple_frame", const Eigen::Isometry3d &_relativeTransform=Eigen::Isometry3d::Identity())
Constructor.
Definition: SimpleFrame.cpp:41
void setRotation(const Eigen::Matrix3d &_newRotation, const Frame *_withRespectTo=Frame::World())
Set the rotation of this SimpleFrame so that its rotation with respect to Frame _withRespectTo is equ...
Definition: SimpleFrame.cpp:197
const std::string & setName(const std::string &_name) override
Set name.
Definition: SimpleFrame.cpp:78
void setTranslation(const Eigen::Vector3d &_newTranslation, const Frame *_withRespectTo=Frame::World())
Set the translation of this SimpleFrame so that its translation with respect to Frame _withRespectTo ...
Definition: SimpleFrame.cpp:189
const Eigen::Vector6d & getPartialAcceleration() const override
The Featherstone ABI algorithm exploits a component of the spatial acceleration which we refer to as ...
Definition: SimpleFrame.cpp:270
SimpleFrame & operator=(const SimpleFrame &_otherFrame)
Same as copy(const Frame&) except the parent frame of this SimpleFrame is left the same,...
Definition: SimpleFrame.cpp:145
void setRelativeTranslation(const Eigen::Vector3d &_newTranslation)
Set the relative translation of this SimpleFrame.
Definition: SimpleFrame.cpp:167
Eigen::Vector6d mRelativeVelocity
Relative spatial velocity of the SimpleFrame.
Definition: SimpleFrame.hpp:222
Matrix< double, 6, 1 > Vector6d
Definition: MathTypes.hpp:49
Definition: BulletCollisionDetector.cpp:63