RobotsIO
Loading...
Searching...
No Matches
Public Member Functions | List of all members
RobotsIO::Utils::TransformYarpPort Class Reference
Inheritance diagram for RobotsIO::Utils::TransformYarpPort:
RobotsIO::Utils::Transform RobotsIO::Utils::YarpBufferedPort< yarp::sig::Vector > RobotsIO::Utils::DataStream

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW TransformYarpPort (const std::string &port_prefix, const bool &provide_rgb, const bool &provide_depth_segmentation)
 
Eigen::Transform< double, 3, Eigen::Affine > transform () override
 
Eigen::MatrixXd bounding_box () override
 
bool freeze (const bool blocking=false) override
 
int get_frames_between_iterations () const override
 
void set_rgb_image (const cv::Mat &image) override
 
void set_depth_segmentation_image (const Eigen::MatrixXf &depth, const cv::Mat &segmentation) override
 
bool transform_received () override
 
virtual Eigen::Transform< double, 3, Eigen::Affine > transform ()=0
 
virtual Eigen::MatrixXd bounding_box ()
 
virtual int get_frames_between_iterations () const
 
virtual void set_rgb_image (const cv::Mat &image)
 
virtual void set_depth_segmentation_image (const Eigen::MatrixXf &depth, const cv::Mat &segmentation)
 
virtual bool transform_received ()
 
virtual bool freeze (const bool blocking=false)=0
 
- Public Member Functions inherited from RobotsIO::Utils::YarpBufferedPort< yarp::sig::Vector >
 YarpBufferedPort (const std::string &port_name)
 
void send_data (const yarp::sig::Vector &data)
 
yarp::sig::Vector * receive_data (const bool &blocking)
 
double time_stamp ()
 
void set_time_stamp (const double &stamp)
 
std::size_t flush ()
 

Additional Inherited Members

- Protected Attributes inherited from RobotsIO::Utils::YarpBufferedPort< yarp::sig::Vector >
yarp::os::Network yarp_
 
yarp::os::BufferedPort< yarp::sig::Vector > port_
 
yarp::os::Stamp stamp_
 
const std::string log_name_
 

Detailed Description

Definition at line 26 of file TransformYarpPort.h.

Constructor & Destructor Documentation

◆ TransformYarpPort()

TransformYarpPort::TransformYarpPort ( const std::string &  port_prefix,
const bool &  provide_rgb,
const bool &  provide_depth_segmentation 
)

Initialize a Transform instance which uses YARP ports to receive transforms and (optionally) provide RGB images, or Depth + Segmentation, to the module which extract transforms.

Required port names are composed as <port_prefix>/transform:i, <port_prefix>/rgb:o and <port_prefix>/depth_segmentation:o.

Definition at line 23 of file TransformYarpPort.cpp.

◆ ~TransformYarpPort()

TransformYarpPort::~TransformYarpPort ( )
virtual

Definition at line 32 of file TransformYarpPort.cpp.

Member Function Documentation

◆ bounding_box()

Eigen::MatrixXd TransformYarpPort::bounding_box ( )
overridevirtual

FIXME: this might be moved somewhere else.

Optionally, a transform might contain information on the bounding box enclosing the object whose transform is transmitted.

It returns a 3x8 matrix containing the coordinates of the 8 vertices of the bounding box.

The points of the bounding box are to be expressed in the root frame of the transformation.

Reimplemented from RobotsIO::Utils::Transform.

Definition at line 42 of file TransformYarpPort.cpp.

◆ freeze()

bool TransformYarpPort::freeze ( const bool  blocking = false)
overridevirtual

Implements RobotsIO::Utils::DataStream.

Definition at line 48 of file TransformYarpPort.cpp.

◆ get_frames_between_iterations()

int TransformYarpPort::get_frames_between_iterations ( ) const
overridevirtual

N > 1 indicates that the transform is available every N frames N = 1 indicates that the transform is available at all frames N < 1 indicates that this information is not available

By default, this method returns N = 1. User might override this setting by re-implementing this method.

Reimplemented from RobotsIO::Utils::Transform.

Definition at line 88 of file TransformYarpPort.cpp.

◆ set_depth_segmentation_image()

void TransformYarpPort::set_depth_segmentation_image ( const Eigen::MatrixXf &  depth,
const cv::Mat &  segmentation 
)
overridevirtual

If required, the user might override this method to set the Depth / Segmentation pair on which the transform has to be evaluated.

Reimplemented from RobotsIO::Utils::Transform.

Definition at line 106 of file TransformYarpPort.cpp.

◆ set_rgb_image()

void TransformYarpPort::set_rgb_image ( const cv::Mat &  image)
overridevirtual

If required, the user might override this method to set the RGB image on which the transform has to be evaluated.

Reimplemented from RobotsIO::Utils::Transform.

Definition at line 94 of file TransformYarpPort.cpp.

◆ transform()

Eigen::Transform< double, 3, Affine > TransformYarpPort::transform ( )
overridevirtual

Implements RobotsIO::Utils::Transform.

Definition at line 36 of file TransformYarpPort.cpp.

◆ transform_received()

bool TransformYarpPort::transform_received ( )
overridevirtual

Indicate whether a new transform has been received or not. Please note that this method might return true even if DataStream::freeze() is false, e.g. if the transform is invalid.

User might override this method in order to comunicate when a network-based transform source is ready, independently from the validity of the received transform.

The default returned value is True.

Warning: this method should be called after DataStream::freeze(), as the reception status might be updated after that.

Reimplemented from RobotsIO::Utils::Transform.

Definition at line 128 of file TransformYarpPort.cpp.