Permalink
Browse files

Implement DynamicRobot copy constructor.

  • Loading branch information...
1 parent 0416789 commit 196d8c1317416349e8466f827ab8eb3bd8cef662 Antonio El Khoury committed Oct 12, 2012
Showing with 27 additions and 0 deletions.
  1. +27 −0 src/dynamic-robot.cc
View
27 src/dynamic-robot.cc
@@ -58,6 +58,33 @@ namespace ard
{
}
+ DynamicRobot::DynamicRobot (const DynamicRobot& robot) :
+ boost::enable_shared_from_this<DynamicRobot> ()
+ {
+ if (robot.rootJoint ())
+ getPtrFromBase (rootJoint_, robot.rootJoint ());
+ else
+ rootJoint_.reset ();
+
+ 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_);
+ }
+
bool DynamicRobot::initialize ()
{
throw std::runtime_error ("Method not supported.");

0 comments on commit 196d8c1

Please sign in to comment.