1 #ifndef SLAM_CTOR_SLAM_VINY_GRID_CELL_H 2 #define SLAM_CTOR_SLAM_VINY_GRID_CELL_H 4 #include "../../core/maps/grid_cell.h" 26 _empty = (1 - prob_occ) * est_qual;
47 for (
int this_id = 0; this_id <
NM; ++this_id) {
48 for (
int that_id = 0; that_id <
NM; ++that_id) {
49 result.belief_by_id(this_id | that_id) +=
63 for (
int this_id = 0; this_id <
NM; ++this_id) {
64 for (
int that_id = 0; that_id <
NM; ++that_id) {
65 result.belief_by_id(this_id & that_id) +=
95 if (tot_weight == 0.0) {
102 _unknown /= tot_weight;
108 return const_cast<double&
>(
115 case EMPTY:
return _empty;
133 std::unique_ptr<GridCell>
clone()
const override {
134 return std::make_unique<VinyDSCell>(*this);
141 _belief.normalize_conflict();
146 auto that_belief =
BaseTBM{aoo};
147 auto total_unknown = that_belief.unknown() + _belief.unknown();
148 auto d_occ = std::abs(that_belief.occupied() - _belief.occupied());
149 auto combined_belief = that_belief;
150 combined_belief += _belief;
155 auto unknown = total_unknown / 2.0;
157 auto known_discrepancy = known * (combined_belief.conflict() + d_occ) / 2.0;
158 return unknown / 2 + known_discrepancy;
163 s << _belief.occupied() << _belief.empty()
164 << _belief.unknown() << _belief.conflict();
169 std::size_t pos = 0)
override {
172 d >> o >> e >> u >> c;
double discrepancy(const AreaOccupancyObservation &aoo) const override
static const int OCCUPIED
const double & belief_by_id(int id) const
BaseTBM & operator=(const BaseTBM &)=default
static const int CONFLICT
std::unique_ptr< GridCell > clone() const override
std::size_t deserialize(const std::vector< char > &data, std::size_t pos=0) override
void operator+=(const AreaOccupancyObservation &aoo) override
double estimation_quality
BaseTBM & operator-=(const BaseTBM &rhs)
void normalize_conflict()
BaseTBM(double occupied, double empty, double unknown, double conflict)
const BaseTBM & belief() const
double & belief_by_id(int id)
virtual size_t deserialize(const std::vector< char > &data, size_t pos=0)
BaseTBM & operator+=(const BaseTBM &rhs)
virtual std::vector< char > serialize() const
BaseTBM(const AreaOccupancyObservation &aoo)
std::vector< char > result() const
std::vector< char > serialize() const override