Permalink
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...
1 parent e9538e7 commit 5c495b6b912d7b5a252ef8d3009dec683dc86b7e Antonio El Khoury committed Oct 12, 2012
Showing with 21 additions and 0 deletions.
  1. +8 −0 include/ard/rbdl/model/body.hh
  2. +13 −0 src/body.cc
@@ -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
@@ -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;

0 comments on commit 5c495b6

Please sign in to comment.