Skip to content
Browse files

Add protected parent joint getter in Joint.

  • Loading branch information...
1 parent a39ea29 commit b89072d404c76c0bd50cb1c4ee08340e459b68fa Antonio El Khoury committed
Showing with 9 additions and 4 deletions.
  1. +3 −0 include/ard/rbdl/model/joint.hh
  2. +6 −4 src/joint.cc
View
3 include/ard/rbdl/model/joint.hh
@@ -298,6 +298,9 @@ namespace ard
virtual void setLinkedBody (CjrlBody& inBody);
protected:
+ /// \brief Get weak pointer to parent joint.
+ virtual void parentJoint (jointWkPtr_t& joint) const;
+
/// \brief Set the parent joint.
virtual void setParentJoint (jointShPtr_t joint);
View
10 src/joint.cc
@@ -114,10 +114,7 @@ namespace ard
{
name_ = joint.getName ();
- if (joint.parentJoint ())
- getPtrFromBase (parentJoint_, joint.parentJoint ());
- else
- parentJoint_.reset ();
+ joint.parentJoint (parentJoint_);
for (unsigned i = 0; i < joint.countChildJoints (); ++i)
addChildJoint (*(joint.childJoint (i)));
@@ -363,6 +360,11 @@ namespace ard
throw std::runtime_error ("Null pointer to body.");
}
+ void Joint::parentJoint (jointWkPtr_t& joint) const
+ {
+ joint = parentJoint_;
+ }
+
void Joint::setParentJoint (jointShPtr_t joint)
{
assert (!!joint && "Null pointer to joint.");

0 comments on commit b89072d

Please sign in to comment.
Something went wrong with that request. Please try again.