template struct mrpt::graphs::detail::THypothesis

An edge hypothesis between two nodeIDs.

Struct practically provides a wrapper around the GRAPH_T::constraint_t instance. Represents a hypothesis for a potential, perhaps loop closing, edge (i.e. a graph constraint/edge), between two nodeIDs of the graph.

See also:


#include <mrpt/graphs/THypothesis.h>

template <class GRAPH_T>
struct THypothesis
    // typedefs

    typedef typename GRAPH_T::constraint_t constraint_t;
    typedef typename constraint_t::type_value pose_t;
    typedef THypothesis<GRAPH_T> self_t;


    size_t id;
    mrpt::graphs::TNodeID from;
    mrpt::graphs::TNodeID to;
    bool is_valid {true};
    double goodness {0};

    // construction



    std::string getAsString(bool oneline = true) const;

    void getAsString(
        std::string* str,
        bool oneline = true
        ) const;

    void getEdge(constraint_t* edge) const;
    constraint_t getEdge() const;
    void getInverseEdge(constraint_t* edge) const;
    constraint_t getInverseEdge() const;
    void setEdge(const constraint_t& edge);
    void inverseHypothesis();
    bool sameEndsWith(const self_t& other) const;
    bool hasEnds(const mrpt::graphs::TNodeID from, const mrpt::graphs::TNodeID to) const;
    bool operator < (const self_t& other) const;


typedef typename GRAPH_T::constraint_t constraint_t

Handy typedefs.

type of graph constraints

typedef typename constraint_t::type_value pose_t

type of underlying poses (2D/3D).


size_t id

ID of the current hypothesis.

mrpt::graphs::TNodeID from

Starting node of the hypothesis.

mrpt::graphs::TNodeID to

Ending node of the hypothesis.

bool is_valid {true}

Field that specifies if the hypothesis is to be considered.

double goodness {0}

Goodness value corresponding to the hypothesis edge.

For ICP edges this resolves to the CICP goodness measure for the alignment operation.

See also:

edge, mrpt::slam::CICP::goodness





std::string getAsString(bool oneline = true) const

Return a string representation of the object at hand.

void getEdge(constraint_t* edge) const

Getter methods for the underlying edge.

See also:


void getInverseEdge(constraint_t* edge) const

Getter methods for the inverse of the underlying edge.

void setEdge(const constraint_t& edge)

Setter method for the underlying edge.

See also:


void inverseHypothesis()

Reverse the hypothesis.

Reversing implies, at least, changing order of from/to nodes and reversing the underlying edge

bool sameEndsWith(const self_t& other) const

Compare the start and end nodes of two hypothesis.


True if ends match.

bool hasEnds(const mrpt::graphs::TNodeID from, const mrpt::graphs::TNodeID to) const

Check if the start, end nodes are the ones given.


True if ends are the given ones

bool operator < (const self_t& other) const

Handy operator for using THypothesis in std::set.