diff --git a/SimDynamics/DynamicsEngine/BulletEngine/BulletRobot.cpp b/SimDynamics/DynamicsEngine/BulletEngine/BulletRobot.cpp index 36d2d5f391dfb019588e4e48a063550729c1b6f9..00c18c8b3c323c22a4cedd8028b285e75457a5fe 100644 --- a/SimDynamics/DynamicsEngine/BulletEngine/BulletRobot.cpp +++ b/SimDynamics/DynamicsEngine/BulletEngine/BulletRobot.cpp @@ -1147,7 +1147,7 @@ Eigen::Vector3f BulletRobot::getJointForces(RobotNodePtr rn) return result; } -Eigen::Matrix4f BulletRobot::getComGlobal( VirtualRobot::RobotNodePtr rn ) +Eigen::Matrix4f BulletRobot::getComGlobal(const VirtualRobot::RobotNodePtr& rn ) { MutexLockPtr lock = getScopedLock(); BulletObjectPtr bo = boost::dynamic_pointer_cast<BulletObject>(getDynamicsRobotNode(rn)); @@ -1159,7 +1159,7 @@ Eigen::Matrix4f BulletRobot::getComGlobal( VirtualRobot::RobotNodePtr rn ) return bo->getComGlobal(); } -Eigen::Vector3f BulletRobot::getComGlobal( VirtualRobot::RobotNodeSetPtr set) +Eigen::Vector3f BulletRobot::getComGlobal(const VirtualRobot::RobotNodeSetPtr& set) { MutexLockPtr lock = getScopedLock(); Eigen::Vector3f com = Eigen::Vector3f::Zero(); @@ -1177,7 +1177,7 @@ Eigen::Vector3f BulletRobot::getComGlobal( VirtualRobot::RobotNodeSetPtr set) return com; } -Eigen::Vector3f BulletRobot::getComVelocityGlobal( VirtualRobot::RobotNodeSetPtr set) +Eigen::Vector3f BulletRobot::getComVelocityGlobal(const VirtualRobot::RobotNodeSetPtr& set) { MutexLockPtr lock = getScopedLock(); Eigen::Vector3f com = Eigen::Vector3f::Zero(); @@ -1210,7 +1210,7 @@ Eigen::Vector3f BulletRobot::getComVelocityGlobal( VirtualRobot::RobotNodeSetPtr return com; } -Eigen::Vector3f BulletRobot::getLinearMomentumGlobal( VirtualRobot::RobotNodeSetPtr set) +Eigen::Vector3f BulletRobot::getLinearMomentumGlobal(const VirtualRobot::RobotNodeSetPtr& set) { MutexLockPtr lock = getScopedLock(); Eigen::Vector3f linMomentum = Eigen::Vector3f::Zero(); @@ -1226,7 +1226,7 @@ Eigen::Vector3f BulletRobot::getLinearMomentumGlobal( VirtualRobot::RobotNodeSet return linMomentum; } -Eigen::Vector3f BulletRobot::getAngularMomentumGlobal( VirtualRobot::RobotNodeSetPtr set) +Eigen::Vector3f BulletRobot::getAngularMomentumGlobal(const VirtualRobot::RobotNodeSetPtr& set) { MutexLockPtr lock = getScopedLock(); Eigen::Vector3f angMomentum = Eigen::Vector3f::Zero(); diff --git a/SimDynamics/DynamicsEngine/BulletEngine/BulletRobot.h b/SimDynamics/DynamicsEngine/BulletEngine/BulletRobot.h index 0d69bfb6db5b1e007407ee08fdf1f0774e34a3a7..bb20b3493124dedddd39e6c8bd529d338c4fd33d 100644 --- a/SimDynamics/DynamicsEngine/BulletEngine/BulletRobot.h +++ b/SimDynamics/DynamicsEngine/BulletEngine/BulletRobot.h @@ -148,19 +148,19 @@ public: /*! Returns the CoM pose, which is reported by bullet */ - virtual Eigen::Matrix4f getComGlobal(VirtualRobot::RobotNodePtr rn); - Eigen::Vector3f getComGlobal(VirtualRobot::RobotNodeSetPtr set); - Eigen::Vector3f getComVelocityGlobal(VirtualRobot::RobotNodeSetPtr set); + virtual Eigen::Matrix4f getComGlobal(const VirtualRobot::RobotNodePtr& rn); + virtual Eigen::Vector3f getComGlobal(const VirtualRobot::RobotNodeSetPtr& set); + virtual Eigen::Vector3f getComVelocityGlobal(const VirtualRobot::RobotNodeSetPtr& set); /*! * Returns the linear momentum in Ns for the bodies in the nodeset. */ - Eigen::Vector3f getLinearMomentumGlobal(VirtualRobot::RobotNodeSetPtr set); + virtual Eigen::Vector3f getLinearMomentumGlobal(const VirtualRobot::RobotNodeSetPtr& set); /*! * Returns the angular momentum in Nms for the bodies in the nodeset */ - Eigen::Vector3f getAngularMomentumGlobal(VirtualRobot::RobotNodeSetPtr set); + virtual Eigen::Vector3f getAngularMomentumGlobal(const VirtualRobot::RobotNodeSetPtr& set); // experimental... virtual void ensureKinematicConstraints(); diff --git a/SimDynamics/DynamicsEngine/DynamicsRobot.cpp b/SimDynamics/DynamicsEngine/DynamicsRobot.cpp index 45e0a769451aedc5bbd6c9816f31d95bc62ecd7a..b969c67daf2bea765c0ff2169077668fde0ea026 100644 --- a/SimDynamics/DynamicsEngine/DynamicsRobot.cpp +++ b/SimDynamics/DynamicsEngine/DynamicsRobot.cpp @@ -286,7 +286,7 @@ double DynamicsRobot::getJointTargetSpeed( VirtualRobot::RobotNodePtr rn ) return 0.0f; } -Eigen::Matrix4f DynamicsRobot::getComGlobal( VirtualRobot::RobotNodePtr rn ) +Eigen::Matrix4f DynamicsRobot::getComGlobal(const VirtualRobot::RobotNodePtr& rn ) { MutexLockPtr lock = getScopedLock(); Eigen::Matrix4f com = Eigen::Matrix4f::Identity(); @@ -295,6 +295,26 @@ Eigen::Matrix4f DynamicsRobot::getComGlobal( VirtualRobot::RobotNodePtr rn ) return com; } +Eigen::Vector3f DynamicsRobot::getComGlobal(const VirtualRobot::RobotNodeSetPtr& bodies) +{ + return Eigen::Vector3f::Zero(); +} + +Eigen::Vector3f DynamicsRobot::getComVelocityGlobal(const VirtualRobot::RobotNodeSetPtr& bodies) +{ + return Eigen::Vector3f::Zero(); +} + +Eigen::Vector3f DynamicsRobot::getLinearMomentumGlobal(const VirtualRobot::RobotNodeSetPtr& set) +{ + return Eigen::Vector3f::Zero(); +} + +Eigen::Vector3f DynamicsRobot::getAngularMomentumGlobal(const VirtualRobot::RobotNodeSetPtr& set) +{ + return Eigen::Vector3f::Zero(); +} + void DynamicsRobot::setGlobalPose(Eigen::Matrix4f &gp) { MutexLockPtr lock = getScopedLock(); diff --git a/SimDynamics/DynamicsEngine/DynamicsRobot.h b/SimDynamics/DynamicsEngine/DynamicsRobot.h index 96ec5fe26f9cab62340ce7b6b892b3edf3acb3d4..cc8d8ab41e1a381554324334de7034bc0a9689e6 100644 --- a/SimDynamics/DynamicsEngine/DynamicsRobot.h +++ b/SimDynamics/DynamicsEngine/DynamicsRobot.h @@ -97,7 +97,13 @@ public: virtual double getJointSpeed(VirtualRobot::RobotNodePtr rn); virtual double getJointTargetSpeed(VirtualRobot::RobotNodePtr rn); - virtual Eigen::Matrix4f getComGlobal(VirtualRobot::RobotNodePtr rn); + virtual Eigen::Matrix4f getComGlobal(const VirtualRobot::RobotNodePtr& rn); + + virtual Eigen::Vector3f getComGlobal(const VirtualRobot::RobotNodeSetPtr& bodies); + virtual Eigen::Vector3f getComVelocityGlobal(const VirtualRobot::RobotNodeSetPtr& bodies); + + virtual Eigen::Vector3f getLinearMomentumGlobal(const VirtualRobot::RobotNodeSetPtr& set); + virtual Eigen::Vector3f getAngularMomentumGlobal(const VirtualRobot::RobotNodeSetPtr& set); virtual void setGlobalPose(Eigen::Matrix4f &gp);