DART 6.12.2
Loading...
Searching...
No Matches
Entity.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_ENTITY_HPP_
34#define DART_DYNAMICS_ENTITY_HPP_
35
36#include <string>
37#include <vector>
38
39#include <Eigen/Core>
40
46
47namespace dart {
48namespace dynamics {
49
50class Frame;
51
61class Entity : public virtual common::Subject
62{
63public:
64 friend class Frame;
65
66 using EntitySignal = common::Signal<void(const Entity*)>;
68 const Entity*, const Frame* _oldFrame, const Frame* _newFrame)>;
70 const Entity*, const std::string& _oldName, const std::string& _newName)>;
71
73 explicit Entity(Frame* _refFrame, bool _quiet);
74
76 Entity();
77
78 Entity(const Entity&) = delete;
79
81 virtual ~Entity();
82
86 virtual const std::string& setName(const std::string& _name) = 0;
87
89 virtual const std::string& getName() const = 0;
90
93
95 const Frame* getParentFrame() const;
96
103 bool descendsFrom(const Frame* _someFrame) const;
104
106 bool isFrame() const;
107
115 bool isQuiet() const;
116
119 DART_DEPRECATED(6.2)
120 virtual void notifyTransformUpdate();
121
124 virtual void dirtyTransform();
125
127 bool needsTransformUpdate() const;
128
131 DART_DEPRECATED(6.2)
132 virtual void notifyVelocityUpdate();
133
136 virtual void dirtyVelocity();
137
139 bool needsVelocityUpdate() const;
140
143 DART_DEPRECATED(6.2)
144 virtual void notifyAccelerationUpdate();
145
148 virtual void dirtyAcceleration();
149
151 bool needsAccelerationUpdate() const;
152
153protected:
160
161 explicit Entity(ConstructFrameTag);
162
169
171
173 virtual void changeParentFrame(Frame* _newParentFrame);
174
175protected:
178
181 // TODO(JS): Rename this to mIsTransformDirty in DART 7
182
185 // TODO(JS): Rename this to mIsVelocityDirty in DART 7
186
189 // TODO(JS): Rename this to mIsAccelerationDirty in DART 7
190
193
196
199
202
205
206public:
207 //----------------------------------------------------------------------------
209 //----------------------------------------------------------------------------
210
213
216
219
222
225
226private:
228 const bool mAmQuiet;
229
232};
234
238class Detachable : public virtual Entity
239{
240public:
242 explicit Detachable(Frame* _refFrame, bool _quiet);
243
245 virtual void setParentFrame(Frame* _newParentFrame);
246
247protected:
250 Detachable();
251};
253
254} // namespace dynamics
255} // namespace dart
256
257#endif // DART_DYNAMICS_ENTITY_HPP_
#define DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_END
Definition ClassWithVirtualBase.hpp:44
#define DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_BEGIN
Definition ClassWithVirtualBase.hpp:43
#define DART_DEPRECATED(version)
Definition Deprecated.hpp:51
SlotRegister can be used as a public member for connecting slots to a private Signal member.
Definition Signal.hpp:229
The Subject class is a base class for any object that wants to report when it gets destroyed.
Definition Subject.hpp:58
The Detachable class is a special case of the Entity base class.
Definition Entity.hpp:239
Detachable()
Constructor for inheriting classes, so they do not need to fill in the arguments.
Definition Entity.cpp:284
virtual void setParentFrame(Frame *_newParentFrame)
Allows the user to change the parent Frame of this Entity.
Definition Entity.cpp:278
Entity class is a base class for any objects that exist in the kinematic tree structure of DART.
Definition Entity.hpp:62
Frame * getParentFrame()
Get the parent (reference) frame of this Entity.
Definition Entity.cpp:81
virtual void dirtyVelocity()
Notify the velocity update of this Entity that its parent Frame's velocity is needed.
Definition Entity.cpp:159
EntitySignal mAccelerationChangedSignal
Acceleration changed signal.
Definition Entity.hpp:204
bool isFrame() const
True iff this Entity is also a Frame.
Definition Entity.cpp:125
bool mAmFrame
Whether or not this Entity is a Frame.
Definition Entity.hpp:231
Entity()
Default constructor, delegates to Entity(ConstructAbstract_t)
Definition Entity.cpp:69
ConstructFrameTag
Used when constructing a Frame class, because the Frame constructor will take care of setting up the ...
Definition Entity.hpp:157
@ ConstructFrame
Definition Entity.hpp:158
bool descendsFrom(const Frame *_someFrame) const
Returns true if and only if this Entity is itself (i.e.
Definition Entity.cpp:93
FrameChangedSignal mFrameChangedSignal
Frame changed signal.
Definition Entity.hpp:192
const bool mAmQuiet
Whether or not this Entity is set to be quiet.
Definition Entity.hpp:228
Frame * mParentFrame
Parent frame of this Entity.
Definition Entity.hpp:177
virtual void notifyAccelerationUpdate()
Notify the acceleration of this Entity that its parent Frame's acceleration is needed.
Definition Entity.cpp:175
virtual void changeParentFrame(Frame *_newParentFrame)
Used by derived classes to change their parent frames.
Definition Entity.cpp:233
EntitySignal mTransformUpdatedSignal
Transform changed signal.
Definition Entity.hpp:198
virtual ~Entity()
Destructor.
Definition Entity.cpp:75
bool needsAccelerationUpdate() const
Returns true iff an acceleration update is needed for this Entity.
Definition Entity.cpp:191
common::SlotRegister< EntitySignal > onVelocityChanged
Slot register for velocity updated signal.
Definition Entity.hpp:221
virtual void dirtyAcceleration()
Notify the acceleration of this Entity that its parent Frame's acceleration is needed.
Definition Entity.cpp:181
EntitySignal mVelocityChangedSignal
Velocity changed signal.
Definition Entity.hpp:201
common::SlotRegister< FrameChangedSignal > onFrameChanged
Slot register for frame changed signal.
Definition Entity.hpp:212
bool mNeedAccelerationUpdate
Does this Entity need an Acceleration update.
Definition Entity.hpp:188
virtual const std::string & setName(const std::string &_name)=0
Set name.
bool needsVelocityUpdate() const
Returns true iff a velocity update is needed for this Entity.
Definition Entity.cpp:169
NameChangedSignal mNameChangedSignal
Name changed signal.
Definition Entity.hpp:195
virtual void notifyVelocityUpdate()
Notify the velocity update of this Entity that its parent Frame's velocity is needed.
Definition Entity.cpp:153
common::SlotRegister< EntitySignal > onTransformUpdated
Slot register for transform updated signal.
Definition Entity.hpp:218
virtual void notifyTransformUpdate()
Notify the transformation update of this Entity that its parent Frame's pose is needed.
Definition Entity.cpp:131
ConstructAbstractTag
Used when constructing a pure abstract class, because calling the Entity constructor is just a formal...
Definition Entity.hpp:166
@ ConstructAbstract
Definition Entity.hpp:167
bool mNeedTransformUpdate
Does this Entity need a Transform update.
Definition Entity.hpp:180
Entity(const Entity &)=delete
bool isQuiet() const
Returns true if this Entity is set to be quiet.
Definition Entity.cpp:119
bool mNeedVelocityUpdate
Does this Entity need a Velocity update.
Definition Entity.hpp:184
common::SlotRegister< NameChangedSignal > onNameChanged
Slot register for name changed signal.
Definition Entity.hpp:215
virtual void dirtyTransform()
Notify the transformation update of this Entity that its parent Frame's pose is needed.
Definition Entity.cpp:137
common::SlotRegister< EntitySignal > onAccelerationChanged
Slot register for acceleration updated signal.
Definition Entity.hpp:224
bool needsTransformUpdate() const
Returns true iff a transform update is needed for this Entity.
Definition Entity.cpp:147
virtual const std::string & getName() const =0
Return the name of this Entity.
The Frame class serves as the backbone of DART's kinematic tree structure.
Definition Frame.hpp:58
Definition BulletCollisionDetector.cpp:60