Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add name attribute and associated setter and getter to Body class.

  * This will have to be backported to the abstract interface.
  • Loading branch information...
commit 5c495b6b912d7b5a252ef8d3009dec683dc86b7e 1 parent e9538e7
Antonio El Khoury authored
Showing with 21 additions and 0 deletions.
  1. +8 −0 include/ard/rbdl/model/body.hh
  2. +13 −0 src/body.cc
View
8 include/ard/rbdl/model/body.hh
@@ -59,6 +59,12 @@ namespace ard
/// \brief Destructor.
virtual ~Body ();
+ /// \brief Get body name.
+ virtual std::string getName () const;
+
+ /// \brief Set body name.
+ virtual void setName (const std::string& name);
+
/// \brief Get underlying rbdl body.
virtual rbdlBody_t rbdlBody () const;
@@ -91,6 +97,8 @@ namespace ard
virtual to_pointer<const CjrlJoint>::type joint () const;
private:
+ /// \brief Name attribute.
+ std::string name_;
/// \brief rbdl body attribute.
rbdlBody_t rbdlBody_;
/// \brief Weak pointer to parent joint attribute.
View
13 src/body.cc
@@ -31,6 +31,7 @@ namespace ard
{
Body::Body () :
boost::enable_shared_from_this<Body> (),
+ name_ (),
rbdlBody_ (),
joint_ ()
{
@@ -41,6 +42,7 @@ namespace ard
const matrix3d& inertia,
joint_t& joint) :
boost::enable_shared_from_this<Body> (),
+ name_ (),
rbdlBody_ (mass, com, inertia),
joint_ ()
{
@@ -51,6 +53,7 @@ namespace ard
Body::Body (const Body& body) :
boost::enable_shared_from_this<Body> ()
{
+ name_ = body.getName ();
rbdlBody_ = body.rbdlBody ();
if (body.joint ())
@@ -68,6 +71,16 @@ namespace ard
return rbdlBody_;
}
+ std::string Body::getName () const
+ {
+ return name_;
+ }
+
+ void Body::setName (const std::string& name)
+ {
+ name_ = name;
+ }
+
const vector3d& Body::localCenterOfMass () const
{
return rbdlBody_.mCenterOfMass;
Please sign in to comment.
Something went wrong with that request. Please try again.