NavMap
Loading...
Searching...
No Matches
OccupancyLayer Class Reference

Log-odds occupancy over an int16 layer of a NavMap. More...

#include <Occupancy.hpp>

Collaboration diagram for OccupancyLayer:

Public Member Functions

void add (NavCelId cid, int16_t delta)
 Adds delta (fixed point) to cid and clamps to [p_min, p_max].
void hit (NavCelId cid)
 A measurement ended in cid (occupied evidence).
float logodds (NavCelId cid) const
void miss (NavCelId cid)
 A measurement crossed cid (free evidence).
const std::string & name () const
 OccupancyLayer (NavMap &nm, const std::string &name="occupancy_logodds", OccupancyParams p={})
 Uses (or creates, all unknown) the int16 layer name of nm.
float probability (NavCelId cid) const
void reset (NavCelId cid)
 Forgets cid (back to unknown).
OccupancyState state (NavCelId cid) const
void update (NavCelId cid, bool occupied)
const std::shared_ptr< LayerView< int16_t > > & view () const

Static Public Member Functions

static float logodds_of (float p)
static float probability_of (float logodds)
static int16_t to_fixed (float logodds)

Static Public Attributes

static constexpr float kScale = 1000.0f
 int16 units per log-odds unit

Detailed Description

Log-odds occupancy over an int16 layer of a NavMap.

Values are log-odds in units of 1/kScale; 0 (probability 0.5) is "never observed" and is declared as the layer's unknown value. Updates add the hit/miss log-odds and clamp.

Constructor & Destructor Documentation

◆ OccupancyLayer()

OccupancyLayer ( NavMap & nm,
const std::string & name = "occupancy_logodds",
OccupancyParams p = {} )
explicit

Uses (or creates, all unknown) the int16 layer name of nm.

Member Function Documentation

◆ add()

void add ( NavCelId cid,
int16_t delta )

Adds delta (fixed point) to cid and clamps to [p_min, p_max].

◆ hit()

void hit ( NavCelId cid)

A measurement ended in cid (occupied evidence).

◆ logodds()

float logodds ( NavCelId cid) const

◆ logodds_of()

float logodds_of ( float p)
static

◆ miss()

void miss ( NavCelId cid)

A measurement crossed cid (free evidence).

◆ name()

const std::string & name ( ) const

◆ probability()

float probability ( NavCelId cid) const

◆ probability_of()

float probability_of ( float logodds)
static

◆ reset()

void reset ( NavCelId cid)

Forgets cid (back to unknown).

◆ state()

OccupancyState state ( NavCelId cid) const

◆ to_fixed()

int16_t to_fixed ( float logodds)
static

◆ update()

void update ( NavCelId cid,
bool occupied )

◆ view()

const std::shared_ptr< LayerView< int16_t > > & view ( ) const

Member Data Documentation

◆ kScale

float kScale = 1000.0f
staticconstexpr

int16 units per log-odds unit


The documentation for this class was generated from the following file: