8#include <RobotsIO/Utils/TransformYarpTransformClient.h>
10#include <yarp/eigen/Eigen.h>
11#include <yarp/os/Property.h>
14using namespace RobotsIO::Utils;
15using namespace yarp::eigen;
18TransformYarpTransformClient::TransformYarpTransformClient(
const std::string& port_prefix,
const std::string& source_name,
const std::string& target_name) :
19 source_name_(source_name),
20 target_name_(target_name)
23 yarp::os::Property tf_properties;
24 tf_properties.put(
"device",
"transformClient");
25 tf_properties.put(
"local",
"/" + port_prefix +
"/transform_client");
26 tf_properties.put(
"remote",
"/transformServer");
28 bool ok = drv_transform_client_.open(tf_properties);
29 ok &= (drv_transform_client_.view(transform_client_) && (transform_client_ !=
nullptr));
32 throw(std::runtime_error(log_name_ +
"::ctor. Error: cannot initialize the FrameTransformClient."));
37TransformYarpTransformClient:: ~TransformYarpTransformClient()
41Eigen::Transform<double, 3, Affine> TransformYarpTransformClient::transform()
47bool TransformYarpTransformClient::freeze(
const bool blocking)
49 yarp::sig::Matrix transform(4, 4);
50 if (!transform_client_->getTransform(target_name_, source_name_, transform))
53 transform_.matrix() = toEigen(transform);