class mola::WallUpReader¶
Overview¶
Reads the up direction of a trajectory frame from the structure seen around the trajectory: walls are plumb and floors and ceilings level, so the direction that makes them so, in the trajectory frame, is that frame’s view of the true vertical. Meant as the input of GravityLeveler::add_up_reading().
Feed it the scans as they are registered (add_cloud() : the de-skewed points in the vehicle frame and the vehicle pose in the trajectory frame). add_cloud() only keeps the pointer, so it is cheap where the scans come from (e.g. the odometry’s worker); the scans are transformed, cut to max_range and voxel-decimated in read(). Every period seconds, read() estimates the up direction from the scans of the last window seconds with mp2p_icp_filters::estimate_planar_normals() and estimate_up_from_normals(), with the covariance of that estimate.
No reading comes from a window from which up is not observable (too few planar points, a single wall direction and no floor), whose covariance rests on too few groups of normals to be trusted, or that holds no scan newer than the previous reading (e.g. standing still). Consecutive windows overlap by about window/period scans, so each reading’s covariance is inflated by that factor: a filter fed with all of them does not count the shared scans several times.
Memory is bounded by the window: scans older than it are dropped. It never changes the scans it is given.
Not thread-safe: add_cloud() and read() must not run concurrently.
#include <WallUpReader.h> class WallUpReader { public: // structs struct Batch; struct Parameters; struct Reading; struct Stats; // construction WallUpReader(); WallUpReader(const Parameters& p); // methods const Parameters& parameters() const; const Stats& stats() const; void add_cloud( double t, const mrpt::poses::CPose3D& vehicle_pose, const mrpt::maps::CPointsMap::ConstPtr& cloud ); std::optional<Reading> read(double t); };
Construction¶
WallUpReader()
With the default parameters, checked like any others (and like them,
Parameters:
std::exception |
without the up covariance API of mp2p_icp) |
WallUpReader(const Parameters& p)
Parameters:
std::exception |
on invalid parameters |
Methods¶
void add_cloud( double t, const mrpt::poses::CPose3D& vehicle_pose, const mrpt::maps::CPointsMap::ConstPtr& cloud )
Adds a scan at time t : its points in the vehicle frame, and the vehicle pose in the trajectory frame. Only the pointer is kept: the cloud must not change afterwards.
std::optional<Reading> read(double t)
A reading at time t, if period has passed since the previous one and the window allows one