template class mrpt::poses::FrameTransformer

Overview

See docs in FrameTransformerInterface.

This class is an implementation for standalone (non ROS) applications. lookupTransform() follows chains of transforms, in either direction (inverting the published ones as needed). Only the latest transform of each pair of frames is kept, and timestamps are not used.

See also:

FrameTransformerInterface

#include <mrpt/poses/FrameTransformer.h>

template <size_t DIM>
class FrameTransformer: public mrpt::poses::FrameTransformerInterface
{
public:
    // typedefs

    typedef FrameTransformerInterface<DIM> base_t;

    // structs

    struct TF_TreeEdge;

    // construction

    FrameTransformer();
    FrameTransformer(const FrameTransformer&);
    FrameTransformer(FrameTransformer&&);

    // methods

    FrameTransformer& operator = (const FrameTransformer&);
    FrameTransformer& operator = (FrameTransformer&&);

    void sendTransform(
        const std::string& parent_frame,
        const std::string& child_frame,
        const typename base_t::pose_t& child_wrt_parent,
        const mrpt::system::TTimeStamp& timestamp = mrpt::Clock::now()
        );

    virtual FrameLookUpStatus lookupTransform(
        const std::string& target_frame,
        const std::string& source_frame,
        typename base_t::light_type& child_wrt_parent,
        const mrpt::system::TTimeStamp query_time = INVALID_TIMESTAMP,
        const double timeout_secs = .0
        );

    FrameLookUpStatus lookupTransform(
        const std::string& target_frame,
        const std::string& source_frame,
        typename base_t::pose_t& child_wrt_parent,
        const mrpt::system::TTimeStamp query_time = INVALID_TIMESTAMP,
        const double timeout_secs = .0
        );
};

Inherited Members

public:
    // typedefs

    typedef typename Lie::SE<DIM>::type pose_t;
    typedef typename Lie::SE<DIM>::light_type light_type;

    // methods

    FrameTransformerInterface& operator = (const FrameTransformerInterface&);
    FrameTransformerInterface& operator = (FrameTransformerInterface&&);

    virtual void sendTransform(
        const std::string& parent_frame,
        const std::string& child_frame,
        const pose_t& child_wrt_parent,
        const mrpt::system::TTimeStamp& timestamp = mrpt::Clock::now()
        ) = 0;

    virtual FrameLookUpStatus lookupTransform(
        const std::string& target_frame,
        const std::string& source_frame,
        light_type& child_wrt_parent,
        const mrpt::system::TTimeStamp query_time = INVALID_TIMESTAMP,
        const double timeout_secs = .0
        ) = 0;

Methods

virtual FrameLookUpStatus lookupTransform(
    const std::string& target_frame,
    const std::string& source_frame,
    typename base_t::light_type& child_wrt_parent,
    const mrpt::system::TTimeStamp query_time = INVALID_TIMESTAMP,
    const double timeout_secs = .0
    )

Queries the current pose of target_frame wrt (“as seen from”) source_frame.

It tries to return the pose at the given timepoint, unless it is INVALID_TIMESTAMP (default), which means returning the latest know transformation. This is the inverse of what ROS tf2 lookupTransform(target_frame, source_frame) returns (the pose of source_frame in target_frame, i.e. the transform of points from source_frame into target_frame).

FrameLookUpStatus lookupTransform(
    const std::string& target_frame,
    const std::string& source_frame,
    typename base_t::pose_t& child_wrt_parent,
    const mrpt::system::TTimeStamp query_time = INVALID_TIMESTAMP,
    const double timeout_secs = .0
    )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.