8#include <RobotsIO/Utils/SpatialVelocity.h>
11using namespace RobotsIO::Utils;
14SpatialVelocity::~SpatialVelocity()
18Eigen::Vector3d SpatialVelocity::angular_velocity()
20 return twist().segment<3>(3);
24Eigen::Vector3d SpatialVelocity::linear_velocity_origin()
26 return twist().head<3>();
30Eigen::Vector3d SpatialVelocity::linear_velocity_screw()
32 double angular_norm = twist().segment<3>(3).norm();
34 if (angular_norm > 1e-4)
35 return twist().head<3>() + twist().segment<3>(3).cross(twist().segment<3>(3).cross(twist().head<3>())) / std::pow(angular_norm, 2);
37 return twist().head<3>();
41Eigen::Vector3d SpatialVelocity::screw_position()
43 double angular_norm = twist().segment<3>(3).norm();
45 if (angular_norm > 1e-4)
46 return twist().segment<3>(3).cross(twist().head<3>()) / std::pow(angular_norm, 2);
48 return Vector3d::Zero();
52bool SpatialVelocity::is_screw_degenerate()
54 return (twist().segment<3>(3).norm() <= 1e-4);