template class mrpt::nav::TMoveTree

This class contains motions and motions tree structures for the hybrid navigation algorithm.

Usage:

: this class inheredit mrpt::graphs::CDirectedTree, please refer to inheritance for detail about generic tree methods

- initialize a motions tree using .initializeMoveTree()
- addEdge (from, to)
- add here more instructions

Changes history

  • 06/MAR/2014: Creation (MB)

  • 21/JAN/2015: Refactoring (JLBC)

#include <mrpt/nav/planners/TMoveTree.h>

template <
    class NODE_TYPE_DATA,
    class EDGE_TYPE,
    class MAPS_IMPLEMENTATION = mrpt::containers::map_traits_map_as_vector
    >
class TMoveTree: public mrpt::graphs::CDirectedTree
{
public:
    // typedefs

    typedef mrpt::graphs::CDirectedTree<EDGE_TYPE> base_t;
    typedef EDGE_TYPE edge_t;
    typedef typename MAPS_IMPLEMENTATION::template map<mrpt::graphs::TNodeID, node_t> node_map_t;
    typedef std::list<node_t> path_t;
    typedef std::list<TEdgeInfo> TListEdges;
    typedef std::map<TNodeID, TListEdges> TMapNode2ListEdges;

    // structs

    struct node_t;

    //
methods

    template <class NODE_TYPE_FOR_METRIC>
    mrpt::graphs::TNodeID getNearestNode(
        const NODE_TYPE_FOR_METRIC& query_pt,
        const PoseDistanceMetric<NODE_TYPE_FOR_METRIC>& distanceMetricEvaluator,
        double* out_distance = nullptr,
        const std::set<mrpt::graphs::TNodeID>* ignored_nodes = nullptr
        ) const;

    void insertNodeAndEdge(
        const mrpt::graphs::TNodeID parent_id,
        const mrpt::graphs::TNodeID new_child_id,
        const NODE_TYPE_DATA& new_child_node_data,
        const EDGE_TYPE& new_edge_data
        );

    void insertNode(const mrpt::graphs::TNodeID node_id, const NODE_TYPE_DATA& node_data);
    mrpt::graphs::TNodeID getNextFreeNodeID() const;
    const node_map_t& getAllNodes() const;
    void backtrackPath(const mrpt::graphs::TNodeID target_node, path_t& out_path) const;
};

Inherited Members

public:
    // structs

    struct TEdgeInfo;
    struct Visitor;

    //
fields

    TNodeID root;
    TMapNode2ListEdges edges_to_children;

    //
methods

    void clear();
    void visitDepthFirst(const TNodeID vroot, Visitor& user_visitor, const size_t root_depth_level = 0) const;
    void visitBreadthFirst(const TNodeID vroot, Visitor& user_visitor, const size_t root_depth_level = 0) const;
    std::string getAsTextDescription() const;

Typedefs

typedef typename MAPS_IMPLEMENTATION::template map<mrpt::graphs::TNodeID, node_t> node_map_t

Map: TNode_ID => Node info.

typedef std::list<node_t> path_t

A topological path up-tree.

Methods

template <class NODE_TYPE_FOR_METRIC>
mrpt::graphs::TNodeID getNearestNode(
    const NODE_TYPE_FOR_METRIC& query_pt,
    const PoseDistanceMetric<NODE_TYPE_FOR_METRIC>& distanceMetricEvaluator,
    double* out_distance = nullptr,
    const std::set<mrpt::graphs::TNodeID>* ignored_nodes = nullptr
    ) const

Finds the nearest node to a given pose, using the given metric.

void insertNode(const mrpt::graphs::TNodeID node_id, const NODE_TYPE_DATA& node_data)

Insert a node without edges (should be used only for a tree root node)

void backtrackPath(const mrpt::graphs::TNodeID target_node, path_t& out_path) const

Builds the path (sequence of nodes, with info about next edge) up-tree from a target_node towards the root Nodes are ordered in the direction ROOT -> start_node.