class mrpt::nav::ClearanceDiagram

Overview

Clearance information for one particular PTG and one set of obstacles.

For each of a decimated subset of the PTG paths, it holds the normalized clearance (distance from the robot shape to the closest obstacle, divided by the PTG reference distance) at a handful of poses sampled along that path. Both the map keys (TP-Space distances) and the values (clearances) are normalized to [0,1] w.r.t. the PTG reference distance.

Usage:

#include <mrpt/nav/holonomic/ClearanceDiagram.h>

class ClearanceDiagram
{
public:
    // typedefs

    typedef std::map<double, double> dist2clearance_t;

    // construction

    ClearanceDiagram();

    // methods

    void clear();
    void resize(size_t actual_num_paths, size_t decimated_num_paths);
    bool empty() const;
    size_t get_actual_num_paths() const;
    size_t get_decimated_num_paths() const;
    double getClearance(uint16_t k, double TPS_query_distance, ClearanceQuery mode) const;
    double getClearance(uint16_t k, double TPS_query_distance, bool integrate_over_path) const;

    void renderAs3DObject(
        mrpt::viz::CMesh& mesh,
        double min_x,
        double max_x,
        double min_y,
        double max_y,
        double cell_res,
        ClearanceQuery mode
        ) const;

    void readFromStream(mrpt::serialization::CArchive& in);
    void writeToStream(mrpt::serialization::CArchive& out) const;
    dist2clearance_t& get_path_clearance(size_t actual_k);
    const dist2clearance_t& get_path_clearance(size_t actual_k) const;
    dist2clearance_t& get_path_clearance_decimated(size_t decim_k);
    const dist2clearance_t& get_path_clearance_decimated(size_t decim_k) const;
    size_t real_k_to_decimated_k(size_t k) const;
    size_t decimated_k_to_real_k(size_t k) const;
};

Typedefs

typedef std::map<double, double> dist2clearance_t

[normalized TPS distance in [0,1]] => normalized_clearance_for_exactly_that_robot_pose

Construction

ClearanceDiagram()

default ctor

Methods

void clear()

Reset to default, empty state.

void resize(size_t actual_num_paths, size_t decimated_num_paths)

Initializes the container to allocate decimated_num_paths entries, as a decimated subset of a total of actual_num_paths paths.

double getClearance(uint16_t k, double TPS_query_distance, ClearanceQuery mode) const

Gets the normalized clearance for path k at the normalized TP-Space distance TPS_query_distance, condensed as per mode.

Only the samples up to and including the first one at or past the query distance take part in the result. Returns 0 for an empty diagram.

double getClearance(
    uint16_t k,
    double TPS_query_distance,
    bool integrate_over_path
    ) const

Deprecated Use the ClearanceQuery overload.

Note that the bool flag used to select the opposite mode to the one it is named after.