Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename notifyXUpdate() relevantly #833

Merged
merged 4 commits into from
Jan 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

* Misc

* Modified the member function names pertain to lazy evaluation to be more relevant to their functionalities: [#833](https://github.com/dartsim/dart/pull/833)
* Added Skeleton::getRootJoint(): [#832](https://github.com/dartsim/dart/pull/832)
* Added CMake targets for code formatting using clang-format: [#811](https://github.com/dartsim/dart/pull/811), [#817](https://github.com/dartsim/dart/pull/817)

Expand Down
2 changes: 1 addition & 1 deletion dart/common/Aspect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class CompositeTrackingAspect : public Aspect

//==============================================================================
#define DART_COMMON_SET_ASPECT_PROPERTY( Type, Name )\
DART_COMMON_SET_ASPECT_PROPERTY_CUSTOM( Type, Name, notifyPropertiesUpdate )
DART_COMMON_SET_ASPECT_PROPERTY_CUSTOM( Type, Name, notifyPropertiesUpdated )

//==============================================================================
#define DART_COMMON_GET_ASPECT_PROPERTY( Type, Name )\
Expand Down
17 changes: 16 additions & 1 deletion dart/common/detail/AspectWithVersion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define DART_COMMON_DETAIL_ASPECTWITHVERSION_HPP_

#include "dart/common/Aspect.hpp"
#include "dart/common/Deprecated.hpp"
#include "dart/common/StlHelpers.hpp"

namespace dart {
Expand Down Expand Up @@ -151,8 +152,12 @@ class AspectWithVersionedProperties : public BaseT
std::size_t incrementVersion();

/// Call UpdateProperties(this) and incrementVersion()
DART_DEPRECATED(6.2)
void notifyPropertiesUpdate();

/// Call UpdateProperties(this) and incrementVersion()
void notifyPropertiesUpdated();

protected:

/// Properties of this Aspect
Expand Down Expand Up @@ -286,7 +291,7 @@ void AspectWithVersionedProperties<BaseT, DerivedT, PropertiesData,
setProperties(const PropertiesData& properties)
{
static_cast<PropertiesData&>(mProperties) = properties;
this->notifyPropertiesUpdate();
this->notifyPropertiesUpdated();
}

//==============================================================================
Expand Down Expand Up @@ -328,6 +333,16 @@ template <class BaseT, class DerivedT, typename PropertiesData,
void AspectWithVersionedProperties<
BaseT, DerivedT, PropertiesData,
CompositeT, updateProperties>::notifyPropertiesUpdate()
{
notifyPropertiesUpdated();
}

//==============================================================================
template <class BaseT, class DerivedT, typename PropertiesData,
class CompositeT, void (*updateProperties)(DerivedT*)>
void AspectWithVersionedProperties<
BaseT, DerivedT, PropertiesData,
CompositeT, updateProperties>::notifyPropertiesUpdated()
{
UpdateProperties(static_cast<Derived*>(this));
this->incrementVersion();
Expand Down
4 changes: 2 additions & 2 deletions dart/dynamics/ArrowShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ArrowShape::ArrowShape(const Eigen::Vector3d& _tail,
instantiate(_resolution);
configureArrow(mTail, mHead, mProperties);
setColorMode(MeshShape::COLOR_INDEX);
notifyColorUpdate(_color);
notifyColorUpdated(_color);
}

//==============================================================================
Expand Down Expand Up @@ -92,7 +92,7 @@ void ArrowShape::setProperties(const Properties& _properties)
}

//==============================================================================
void ArrowShape::notifyColorUpdate(const Eigen::Vector4d& _color)
void ArrowShape::notifyColorUpdated(const Eigen::Vector4d& _color)
{
for(std::size_t i=0; i<mMesh->mNumMeshes; ++i)
{
Expand Down
2 changes: 1 addition & 1 deletion dart/dynamics/ArrowShape.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ArrowShape : public MeshShape
void setProperties(const Properties& _properties);

/// Set the color of this arrow
void notifyColorUpdate(const Eigen::Vector4d& _color) override;
void notifyColorUpdated(const Eigen::Vector4d& _color) override;

/// Get the properties of this arrow
const Properties& getProperties() const;
Expand Down
52 changes: 35 additions & 17 deletions dart/dynamics/BodyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ void BodyNode::setMass(double _mass)

mAspectProperties.mInertia.setMass(_mass);

notifyArticulatedInertiaUpdate();
dirtyArticulatedInertia();
const SkeletonPtr& skel = getSkeleton();
if(skel)
skel->updateTotalMass();
Expand All @@ -487,7 +487,7 @@ void BodyNode::setMomentOfInertia(double _Ixx, double _Iyy, double _Izz,
_Ixx, _Iyy, _Izz,
_Ixy, _Ixz, _Iyz);

notifyArticulatedInertiaUpdate();
dirtyArticulatedInertia();
}

//==============================================================================
Expand Down Expand Up @@ -518,7 +518,7 @@ void BodyNode::setInertia(const Inertia& _inertia)

mAspectProperties.mInertia = _inertia;

notifyArticulatedInertiaUpdate();
dirtyArticulatedInertia();
const SkeletonPtr& skel = getSkeleton();
if(skel)
skel->updateTotalMass();
Expand Down Expand Up @@ -557,7 +557,7 @@ void BodyNode::setLocalCOM(const Eigen::Vector3d& _com)
{
mAspectProperties.mInertia.setLocalCOM(_com);

notifyArticulatedInertiaUpdate();
dirtyArticulatedInertia();
}

//==============================================================================
Expand Down Expand Up @@ -1375,7 +1375,7 @@ void BodyNode::init(const SkeletonPtr& _skeleton)
mWorldJacobian.setZero(6, numDepGenCoords);
mBodyJacobianSpatialDeriv.setZero(6, numDepGenCoords);
mWorldJacobianClassicDeriv.setZero(6, numDepGenCoords);
notifyTransformUpdate();
dirtyTransform();
}

//==============================================================================
Expand Down Expand Up @@ -1441,9 +1441,9 @@ void BodyNode::processRemovedEntity(Entity* _oldChildEntity)
}

//==============================================================================
void BodyNode::notifyTransformUpdate()
void BodyNode::dirtyTransform()
{
notifyVelocityUpdate(); // Global Velocity depends on the Global Transform
dirtyVelocity(); // Global Velocity depends on the Global Transform

if(mNeedTransformUpdate)
return;
Expand All @@ -1466,16 +1466,16 @@ void BodyNode::notifyTransformUpdate()
// Child BodyNodes and other generic Entities are notified separately to allow
// some optimizations
for(std::size_t i=0; i<mChildBodyNodes.size(); ++i)
mChildBodyNodes[i]->notifyTransformUpdate();
mChildBodyNodes[i]->dirtyTransform();

for(Entity* entity : mNonBodyNodeEntities)
entity->notifyTransformUpdate();
entity->dirtyTransform();
}

//==============================================================================
void BodyNode::notifyVelocityUpdate()
void BodyNode::dirtyVelocity()
{
notifyAccelerationUpdate(); // Global Acceleration depends on Global Velocity
dirtyAcceleration(); // Global Acceleration depends on Global Velocity

if(mNeedVelocityUpdate)
return;
Expand All @@ -1493,14 +1493,14 @@ void BodyNode::notifyVelocityUpdate()
// Child BodyNodes and other generic Entities are notified separately to allow
// some optimizations
for(std::size_t i=0; i<mChildBodyNodes.size(); ++i)
mChildBodyNodes[i]->notifyVelocityUpdate();
mChildBodyNodes[i]->dirtyVelocity();

for(Entity* entity : mNonBodyNodeEntities)
entity->notifyVelocityUpdate();
entity->dirtyVelocity();
}

//==============================================================================
void BodyNode::notifyAccelerationUpdate()
void BodyNode::dirtyAcceleration()
{
// If we already know we need to update, just quit
if(mNeedAccelerationUpdate)
Expand All @@ -1509,28 +1509,46 @@ void BodyNode::notifyAccelerationUpdate()
mNeedAccelerationUpdate = true;

for(std::size_t i=0; i<mChildBodyNodes.size(); ++i)
mChildBodyNodes[i]->notifyAccelerationUpdate();
mChildBodyNodes[i]->dirtyAcceleration();

for(Entity* entity : mNonBodyNodeEntities)
entity->notifyAccelerationUpdate();
entity->dirtyAcceleration();
}

//==============================================================================
void BodyNode::notifyArticulatedInertiaUpdate()
{
dirtyArticulatedInertia();
}

//==============================================================================
void BodyNode::dirtyArticulatedInertia()
{
const SkeletonPtr& skel = getSkeleton();
if(skel)
skel->notifyArticulatedInertiaUpdate(mTreeIndex);
skel->dirtyArticulatedInertia(mTreeIndex);
}

//==============================================================================
void BodyNode::notifyExternalForcesUpdate()
{
dirtyExternalForces();
}

//==============================================================================
void BodyNode::dirtyExternalForces()
{
SKEL_SET_FLAGS(mExternalForces);
}

//==============================================================================
void BodyNode::notifyCoriolisUpdate()
{
dirtyCoriolisForces();
}

//==============================================================================
void BodyNode::dirtyCoriolisForces()
{
SKEL_SET_FLAGS(mCoriolisForces);
SKEL_SET_FLAGS(mCoriolisAndGravityForces);
Expand Down
19 changes: 16 additions & 3 deletions dart/dynamics/BodyNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,24 +832,37 @@ class BodyNode :
//----------------------------------------------------------------------------

// Documentation inherited
void notifyTransformUpdate() override;
void dirtyTransform() override;

// Documentation inherited
void notifyVelocityUpdate() override;
void dirtyVelocity() override;

// Documentation inherited
void notifyAccelerationUpdate() override;
void dirtyAcceleration() override;

/// Notify the Skeleton that the tree of this BodyNode needs an articulated
/// inertia update
DART_DEPRECATED(6.2)
void notifyArticulatedInertiaUpdate();

/// Notify the Skeleton that the tree of this BodyNode needs an articulated
/// inertia update
void dirtyArticulatedInertia();

/// Tell the Skeleton that the external forces need to be updated
DART_DEPRECATED(6.2)
void notifyExternalForcesUpdate();

/// Tell the Skeleton that the external forces need to be updated
void dirtyExternalForces();

/// Tell the Skeleton that the coriolis forces need to be update
DART_DEPRECATED(6.2)
void notifyCoriolisUpdate();

/// Tell the Skeleton that the coriolis forces need to be update
void dirtyCoriolisForces();

//----------------------------------------------------------------------------
// Friendship
//----------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions dart/dynamics/EndEffector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ EndEffectorProperties::EndEffectorProperties(const Eigen::Isometry3d& defaultTf)
void SupportUpdate(Support* support)
{
if(EndEffector* ee = support->getComposite())
ee->getSkeleton()->notifySupportUpdate(ee->getTreeIndex());
ee->getSkeleton()->dirtySupportPolygon(ee->getTreeIndex());
}

} // namespace detail
Expand Down Expand Up @@ -138,16 +138,16 @@ void EndEffector::resetRelativeTransform()
}

//==============================================================================
void EndEffector::notifyTransformUpdate()
void EndEffector::dirtyTransform()
{
if(!mNeedTransformUpdate)
{
const SkeletonPtr& skel = getSkeleton();
if(skel)
skel->notifySupportUpdate(getTreeIndex());
skel->dirtySupportPolygon(getTreeIndex());
}

Frame::notifyTransformUpdate();
Frame::dirtyTransform();
}

//==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion dart/dynamics/EndEffector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class EndEffector final :
//----------------------------------------------------------------------------

// Documentation inherited
void notifyTransformUpdate() override;
void dirtyTransform() override;

/// \}

Expand Down
20 changes: 19 additions & 1 deletion dart/dynamics/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ bool Entity::isFrame() const

//==============================================================================
void Entity::notifyTransformUpdate()
{
dirtyTransform();
}

//==============================================================================
void Entity::dirtyTransform()
{
mNeedTransformUpdate = true;

Expand All @@ -145,6 +151,12 @@ bool Entity::needsTransformUpdate() const

//==============================================================================
void Entity::notifyVelocityUpdate()
{
dirtyVelocity();
}

//==============================================================================
void Entity::dirtyVelocity()
{
mNeedVelocityUpdate = true;

Expand All @@ -161,6 +173,12 @@ bool Entity::needsVelocityUpdate() const

//==============================================================================
void Entity::notifyAccelerationUpdate()
{
dirtyAcceleration();
}

//==============================================================================
void Entity::dirtyAcceleration()
{
mNeedAccelerationUpdate = true;

Expand Down Expand Up @@ -242,7 +260,7 @@ void Entity::changeParentFrame(Frame* _newParentFrame)
mParentFrame->mChildEntities.insert(this);
mParentFrame->processNewEntity(this);
}
notifyTransformUpdate();
dirtyTransform();
}

if(mParentFrame)
Expand Down
Loading