DART  6.7.3
ShapeNode.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_SHAPENODE_HPP_
34 #define DART_DYNAMICS_SHAPENODE_HPP_
35 
36 #include <Eigen/Dense>
37 
38 #include "dart/common/Signal.hpp"
40 
41 namespace dart {
42 namespace dynamics {
43 
44 class VisualAspect;
45 class CollisionAspect;
46 class DynamicsAspect;
47 
49 {
50 public:
51 
52  friend class BodyNode;
53 
55  = common::Signal<void(const ShapeNode* thisShapeNode,
56  const ShapePtr& oldShape,
57  const ShapePtr& newShape)>;
58 
60  = common::Signal<void(const ShapeNode* thisShapeNode,
61  const Eigen::Isometry3d& oldTransform,
62  const Eigen::Isometry3d& newTransform)>;
63 
65  NameAspect,
66  FixedFrame,
67  ShapeFrame>;
68 
70 
71 
73  virtual ~ShapeNode() = default;
74 
76  void setProperties(const Properties& properties);
77 
79  const Properties getShapeNodeProperties() const;
80 
82  void copy(const ShapeNode& other);
83 
85  void copy(const ShapeNode* other);
86 
88  ShapeNode& operator=(const ShapeNode& other);
89 
91  void setRelativeTransform(const Eigen::Isometry3d& transform) override;
92 
94  void setRelativeRotation(const Eigen::Matrix3d& rotation);
95 
97  Eigen::Matrix3d getRelativeRotation() const;
98 
100  void setRelativeTranslation(const Eigen::Vector3d& translation);
101 
103  void setOffset(const Eigen::Vector3d& offset);
104 
106  Eigen::Vector3d getRelativeTranslation() const;
107 
109  Eigen::Vector3d getOffset() const;
110 
111  // Documentation inherited
112  ShapeNode* asShapeNode() override;
113 
114  // Documentation inherited
115  const ShapeNode* asShapeNode() const override;
116 
117  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
118 
119 protected:
120 
122  ShapeNode(BodyNode* bodyNode, const BasicProperties& properties);
123 
125  ShapeNode(BodyNode* bodyNode, const ShapePtr& shape,
126  const std::string& name = "ShapeNode");
127 
130  Node* cloneNode(BodyNode* parent) const override;
131 
132 };
133 
134 } // namespace dynamics
135 } // namespace dart
136 
137 #endif // DART_DYNAMICS_SHAPENODE_HPP_
BodyPropPtr properties
Definition: SdfParser.cpp:80
std::string * name
Definition: SkelParser.cpp:1642
detail::CompositeProperties Properties
Definition: Composite.hpp:56
Definition: Signal.hpp:106
Definition: CompositeData.hpp:180
Definition: CompositeData.hpp:104
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:78
Definition: CompositeNode.hpp:100
The FixedFrame class represents a Frame with zero relative velocity and zero relative acceleration.
Definition: FixedFrame.hpp:52
The Node class is a base class for BodyNode and any object that attaches to a BodyNode.
Definition: Node.hpp:84
Definition: ShapeFrame.hpp:164
Definition: ShapeNode.hpp:49
Eigen::Vector3d getRelativeTranslation() const
Get translation of this shape node relative to the parent frame.
Definition: ShapeNode.cpp:123
Eigen::Matrix3d getRelativeRotation() const
Get rotation of this shape node relative to the parent frame.
Definition: ShapeNode.cpp:102
void setRelativeTranslation(const Eigen::Vector3d &translation)
Set translation of this shape node relative to the parent frame.
Definition: ShapeNode.cpp:108
const Properties getShapeNodeProperties() const
Get the Properties of this ShapeNode.
Definition: ShapeNode.cpp:46
Node * cloneNode(BodyNode *parent) const override
Create a clone of this ShapeNode.
Definition: ShapeNode.cpp:176
Eigen::Vector3d getOffset() const
Same as getRelativeTranslation()
Definition: ShapeNode.cpp:129
void setRelativeTransform(const Eigen::Isometry3d &transform) override
Set transformation of this shape node relative to the parent frame.
Definition: ShapeNode.cpp:77
void setProperties(const Properties &properties)
Set the Properties of this ShapeNode.
Definition: ShapeNode.cpp:40
void setOffset(const Eigen::Vector3d &offset)
Same as setRelativeTranslation(offset)
Definition: ShapeNode.cpp:117
ShapeNode * asShapeNode() override
Definition: ShapeNode.cpp:135
void setRelativeRotation(const Eigen::Matrix3d &rotation)
Set rotation of this shape node relative to the parent frame.
Definition: ShapeNode.cpp:93
void copy(const ShapeNode &other)
Copy the properties of another ShapeNode.
Definition: ShapeNode.cpp:52
ShapeNode & operator=(const ShapeNode &other)
Same as copy(const ShapeNode&)
Definition: ShapeNode.cpp:70
ShapeNode(BodyNode *bodyNode, const BasicProperties &properties)
Constructor used by the Skeleton class.
Definition: ShapeNode.cpp:147
virtual ~ShapeNode()=default
Destructor.
dart::collision::fcl::Vector3 transform(const dart::collision::fcl::Transform3 &t, const dart::collision::fcl::Vector3 &v)
Transforms a 3-dim vector by a transform and returns the result.
Definition: BackwardCompatibility.cpp:131
std::shared_ptr< Shape > ShapePtr
Definition: SmartPointer.hpp:81
Definition: BulletCollisionDetector.cpp:63