8#include <RobotsIO/Utils/TransformWithVelocityYarpPort.h>
10#include <yarp/eigen/Eigen.h>
11#include <yarp/sig/Vector.h>
14using namespace RobotsIO::Utils;
15using namespace yarp::eigen;
16using namespace yarp::sig;
19TransformWithVelocityYarpPort::TransformWithVelocityYarpPort(
const std::string& port_name) :
24TransformWithVelocityYarpPort:: ~TransformWithVelocityYarpPort()
28Eigen::Transform<double, 3, Affine> TransformWithVelocityYarpPort::transform()
34Eigen::Vector3d TransformWithVelocityYarpPort::linear_velocity()
36 return linear_velocity_;
40Eigen::Vector3d TransformWithVelocityYarpPort::angular_velocity()
42 return angular_velocity_;
46bool TransformWithVelocityYarpPort::freeze(
const bool blocking)
48 yarp::sig::Vector* transform_yarp = receive_data(blocking);
50 if (transform_yarp ==
nullptr)
53 transform_ = Translation<double, 3>(toEigen(*transform_yarp).head<3>());
54 AngleAxisd rotation((*transform_yarp)(6), toEigen(*transform_yarp).segment<3>(3));
55 transform_.rotate(rotation);
57 linear_velocity_ = toEigen(*transform_yarp).segment<3>(7);
58 angular_velocity_ = toEigen(*transform_yarp).tail<3>();