DART 6.10.1
Loading...
Searching...
No Matches
ShapeFrame.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_SHAPEFRAME_HPP_
34#define DART_DYNAMICS_SHAPEFRAME_HPP_
35
36#include <Eigen/Dense>
37
45
46namespace dart {
47namespace dynamics {
48
49//==============================================================================
51 VisualAspect,
52 detail::VisualAspectProperties,
53 ShapeFrame>
54{
55public:
60
63
64 VisualAspect(const VisualAspect&) = delete;
65
67 void setRGBA(const Eigen::Vector4d& color);
68
69 DART_COMMON_GET_ASPECT_PROPERTY(Eigen::Vector4d, RGBA)
70 // const Eigen::Vector4d& getRGBA() const;
71
73 // void setHidden(const bool& value);
74 // const bool& getHidden() const;
75
77 // void setShadowed(const bool& value);
78 // const bool& getShadowed() const;
79
81 void setColor(const Eigen::Vector3d& color);
82
84 void setColor(const Eigen::Vector4d& color);
85
87 void setRGB(const Eigen::Vector3d& rgb);
88
90 void setAlpha(const double alpha);
91
93 Eigen::Vector3d getColor() const;
94
96 Eigen::Vector3d getRGB() const;
97
99 double getAlpha() const;
100
102 void hide();
103
105 void show();
106
109 bool isHidden() const;
110};
111
112//==============================================================================
115 detail::CollisionAspectProperties,
117{
118public:
121
123 // void setCollidable(const bool& value);
124 // const bool& getCollidable() const;
125
126
127 bool isCollidable() const;
128};
129
130//==============================================================================
132 DynamicsAspect,
133 detail::DynamicsAspectProperties,
134 ShapeFrame>
135{
136public:
140 ShapeFrame>;
141
143
145
147 void setFrictionCoeff(const double& value);
149 double getFrictionCoeff() const;
150
151 // DART_COMMON_SET_GET_ASPECT_PROPERTY(double, PrimaryFrictionCoeff)
152 void setPrimaryFrictionCoeff(const double& value);
153 const double& getPrimaryFrictionCoeff() const;
154
155 DART_COMMON_SET_GET_ASPECT_PROPERTY(double, SecondaryFrictionCoeff)
156 // void setSecondaryFrictionCoeff(const double& value);
157 // const double& getSecondaryFrictionCoeff() const;
158 DART_COMMON_SET_GET_ASPECT_PROPERTY(double, RestitutionCoeff)
159 // void setRestitutionCoeff(const double& value);
160 // const double& getRestitutionCoeff() const;
161
167 DART_COMMON_SET_GET_ASPECT_PROPERTY(double, PrimarySlipCompliance)
168 // void sePrimarytSlipCompliance(const double& value);
169 // const double& getPrimarySlipCompliance() const;
170 DART_COMMON_SET_GET_ASPECT_PROPERTY(double, SecondarySlipCompliance)
171 // void setSecondarySlipCompliance(const double& value);
172 // const double& getSecondarySlipCompliance() const;
173
177 void setFirstFrictionDirectionFrame(const Frame* value);
178
180 const Frame* getFirstFrictionDirectionFrame() const;
181
182 DART_COMMON_SET_GET_ASPECT_PROPERTY(Eigen::Vector3d, FirstFrictionDirection)
183 // void setFirstFrictionDirection(const Eigen::Vector3d& value);
184 // const Eigen::Vector3d& getFirstFrictionDirection() const;
185};
186
187//==============================================================================
189class ShapeFrame : public virtual common::VersionCounter,
190 public detail::ShapeFrameCompositeBase,
191 public virtual Frame
192{
193public:
194 friend class BodyNode;
195
197 const ShapeFrame* thisShapeFrame,
198 const ShapePtr& oldShape,
199 const ShapePtr& newShape)>;
200
202 const ShapeFrame* thisShapeFrame,
203 const Eigen::Isometry3d& oldTransform,
204 const Eigen::Isometry3d& newTransform)>;
205
208
210 virtual ~ShapeFrame() override;
211
213 void setProperties(const UniqueProperties& properties);
214
216 void setAspectProperties(const AspectProperties& properties);
217
218 const AspectProperties& getAspectProperties() const;
219
221 void setShape(const ShapePtr& shape);
222
224 ShapePtr getShape();
225
227 ConstShapePtr getShape() const;
228
230
232
234
235 // Documentation inherited
236 ShapeFrame* asShapeFrame() override;
237
238 // Documentation inherited
239 const ShapeFrame* asShapeFrame() const override;
240
242 bool isShapeNode() const;
243
246 virtual ShapeNode* asShapeNode();
247
253 virtual const ShapeNode* asShapeNode() const;
254
255protected:
257 ShapeFrame(Frame* parent, const Properties& properties);
258
260 ShapeFrame(Frame* parent, const ShapePtr& shape = nullptr);
261
263 ShapeFrame(const std::tuple<Frame*, Properties>& args);
264
266 bool mAmShapeNode;
267
269 ShapeUpdatedSignal mShapeUpdatedSignal;
270
272 RelativeTransformUpdatedSignal mRelativeTransformUpdatedSignal;
273
275 common::Connection mConnectionForShapeVersionChange;
276
277public:
279 common::SlotRegister<ShapeUpdatedSignal> onShapeUpdated;
280
282 common::SlotRegister<RelativeTransformUpdatedSignal>
283 onRelativeTransformUpdated;
284};
286
287} // namespace dynamics
288} // namespace dart
289
290#endif // DART_DYNAMICS_SHAPEFRAME_HPP_
#define DART_COMMON_SET_GET_ASPECT_PROPERTY(Type, Name)
Definition Aspect.hpp:209
#define DART_COMMON_GET_ASPECT_PROPERTY(Type, Name)
Definition Aspect.hpp:202
#define DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_END
Definition ClassWithVirtualBase.hpp:44
#define DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_BEGIN
Definition ClassWithVirtualBase.hpp:43
BodyPropPtr properties
Definition SdfParser.cpp:80
typename Impl::AspectProperties AspectProperties
Definition EmbeddedAspect.hpp:245
AspectWithProtectedProperties generates implementations of the Property managing functions for an Asp...
Definition AspectWithVersion.hpp:109
PropertiesDataT PropertiesData
Definition AspectWithVersion.hpp:113
AspectWithVersionedProperties(const AspectWithVersionedProperties &)=delete
BodyNode class represents a single node of the skeleton.
Definition BodyNode.hpp:79
Definition ShapeFrame.hpp:117
CollisionAspect(const CollisionAspect &)=delete
Definition ShapeFrame.hpp:135
DynamicsAspect(const DynamicsAspect &)=delete
The Frame class serves as the backbone of DART's kinematic tree structure.
Definition Frame.hpp:58
Definition ShapeFrame.hpp:192
AspectProperties UniqueProperties
Definition ShapeFrame.hpp:206
UniqueProperties Properties
Definition ShapeFrame.hpp:207
Definition ShapeNode.hpp:49
Definition ShapeFrame.hpp:54
void setColor(const Eigen::Vector3d &color)
Identical to setRGB(const Eigen::Vector3d&)
Definition ShapeFrame.cpp:116
void setRGB(const Eigen::Vector3d &rgb)
Set RGB color components (leave alpha alone)
Definition ShapeFrame.cpp:128
VisualAspect(const VisualAspect &)=delete
void hide()
Hide the ShapeNode.
Definition ShapeFrame.cpp:165
double getAlpha() const
Get the transparency of the Shape.
Definition ShapeFrame.cpp:159
Eigen::Vector3d getRGB() const
Get RGB color components.
Definition ShapeFrame.cpp:153
Eigen::Vector3d getColor() const
Get color.
Definition ShapeFrame.cpp:147
void setRGBA(const Eigen::Vector4d &color)
Set RGBA color.
Definition ShapeFrame.cpp:106
void show()
Show the ShapeNode.
Definition ShapeFrame.cpp:171
void setAlpha(const double alpha)
Set the transparency of the Shape.
Definition ShapeFrame.cpp:137
bool isHidden() const
True iff the ShapeNode is set to be hidden.
Definition ShapeFrame.cpp:177
#define DART_BAKE_SPECIALIZED_ASPECT(AspectName)
Definition Composite.hpp:226
Definition Random-impl.hpp:92
std::shared_ptr< Shape > ShapePtr
Definition SmartPointer.hpp:81
std::shared_ptr< const Shape > ConstShapePtr
Definition SmartPointer.hpp:81
Definition BulletCollisionDetector.cpp:65
Definition SharedLibraryManager.hpp:46
Definition ShapeFrameAspect.hpp:90
Definition ShapeFrameAspect.hpp:52