Permalink
Browse files

Add assignment operators.

  • Loading branch information...
Antonio El Khoury
Antonio El Khoury committed Oct 16, 2012
1 parent 3e657c1 commit 5b4927da9e90578d3c52b4d8d8d2fb82325058db
@@ -56,6 +56,9 @@ namespace ard
/// \brief Copy constructor.
Body (const Body& body);
+ /// \brief Assignment operator.
+ Body operator= (const Body& body);
+
/// \brief Destructor.
virtual ~Body ();
@@ -48,6 +48,9 @@ namespace ard
/// \brief Copy constructor.
DynamicRobot (const DynamicRobot& robot);
+ /// \brief Assignment operator.
+ DynamicRobot operator= (const DynamicRobot& robot);
+
/// \brief Destructor
virtual ~DynamicRobot ();
@@ -54,6 +54,9 @@ namespace ard
/// \brief Copy constructor.
Foot (const Foot& foot);
+ /// \brief Assignment operator.
+ Foot operator= (const Foot& foot);
+
/// \brief Destructor
virtual ~Foot ();
@@ -54,6 +54,9 @@ namespace ard
/// \brief Copy constructor.
Hand (const Hand& hand);
+ /// \brief Assignment operator.
+ Hand operator= (const Hand& hand);
+
/// \brief Destructor.
virtual ~Hand ();
@@ -49,6 +49,9 @@ namespace ard
/// \brief Copy constructor.
HumanoidDynamicRobot (const HumanoidDynamicRobot& robot);
+ /// \brief Assignment operator.
+ HumanoidDynamicRobot operator= (const HumanoidDynamicRobot& robot);
+
/// \brief Destructor.
virtual ~HumanoidDynamicRobot();
View
@@ -52,11 +52,19 @@ namespace ard
Body::Body (const Body& body) :
boost::enable_shared_from_this<Body> ()
+ {
+ name_ = body.getName ();
+ rbdlBody_ = body.rbdlBody ();
+ body.joint (joint_);
+ }
+
+ Body Body::operator= (const Body& body)
{
name_ = body.getName ();
rbdlBody_ = body.rbdlBody ();
body.joint (joint_);
+ return *this;
}
Body::~Body ()
View
@@ -77,8 +77,30 @@ namespace ard
derivativeAngularMomentum_ = robot.derivativeAngularMomentum ();
mass_ = robot.mass ();
inertiaMatrix_ = robot.inertiaMatrix ();
+ robot.actuatedJoints (actuatedJoints_);
+ }
+ DynamicRobot DynamicRobot::operator= (const DynamicRobot& robot)
+ {
+ robot.rootJoint (rootJoint_);
+ robot.jointVector (jointVector_);
+ rbdlModel_ = robot.rbdlModel ();
+ configuration_ = robot.currentConfiguration ();
+ velocity_ = robot.currentVelocity ();
+ acceleration_ = robot.currentAcceleration ();
+ forces_ = robot.currentForces ();
+ torques_ = robot.currentTorques ();
+ jointTorques_ = matrixNxP (robot.currentJointTorques ());
+ positionCenterOfMass_ = robot.positionCenterOfMass ();
+ velocityCenterOfMass_ = robot.velocityCenterOfMass ();
+ accelerationCenterOfMass_ = robot.accelerationCenterOfMass ();
+ linearMomentumRobot_ = robot.linearMomentumRobot ();
+ derivativeAngularMomentum_ = robot.derivativeAngularMomentum ();
+ mass_ = robot.mass ();
+ inertiaMatrix_ = robot.inertiaMatrix ();
robot.actuatedJoints (actuatedJoints_);
+
+ return *this;
}
bool DynamicRobot::initialize ()
View
@@ -65,6 +65,15 @@ namespace ard
foot.getAnklePositionInLocalFrame (ankleInLocalFrame_);
}
+ Foot Foot::operator= (const Foot& foot)
+ {
+ foot.associatedAnkle (ankleJoint_);
+ foot.getSoleSize (soleLength_, soleWidth_);
+ foot.getAnklePositionInLocalFrame (ankleInLocalFrame_);
+
+ return *this;
+ }
+
Foot::~Foot ()
{
}
View
@@ -69,6 +69,17 @@ namespace ard
hand.getPalmNormal (palmNormal_);
}
+ Hand Hand::operator= (const Hand& hand)
+ {
+ hand.associatedWrist (wristJoint_);
+ hand.getCenter (center_);
+ hand.getThumbAxis (thumbAxis_);
+ hand.getForeFingerAxis (foreFingerAxis_);
+ hand.getPalmNormal (palmNormal_);
+
+ return *this;
+ }
+
Hand::~Hand ()
{
}
@@ -76,6 +76,30 @@ namespace ard
zeroMomentPoint_ = robot.zeroMomentumPoint ();
}
+ HumanoidDynamicRobot
+ HumanoidDynamicRobot::operator= (const HumanoidDynamicRobot& robot)
+ {
+ dynamicRobot_ = robot.dynamicRobot ();
+ robot.waist (waist_);
+ robot.chest (chest_);
+ robot.leftWrist (leftWrist_);
+ robot.rightWrist (rightWrist_);
+ robot.leftHand (leftHand_);
+ robot.rightHand (rightHand_);
+ leftHandClench_ = robot.getHandClench (robot.leftHand ());
+ rightHandClench_ = robot.getHandClench (robot.rightHand ());
+ robot.leftAnkle (leftAnkle_);
+ robot.rightAnkle (rightAnkle_);
+ robot.leftFoot (leftFoot_);
+ robot.rightFoot (rightFoot_);
+ robot.gazeJoint (gazeJoint_);
+ gazeOrigin_ = robot.gazeOrigin ();
+ gazeDirection_ = robot.gazeDirection ();
+ zeroMomentPoint_ = robot.zeroMomentumPoint ();
+
+ return *this;
+ }
+
HumanoidDynamicRobot::~HumanoidDynamicRobot ()
{
}

0 comments on commit 5b4927d

Please sign in to comment.