1#ifndef BITSIM_ESTIMATION_EKF_SLAM_H
2#define BITSIM_ESTIMATION_EKF_SLAM_H
35 real_t get(
const std::string &name)
const;
231 uint_t update(
const std::vector<Observation> &sightings);
262 const std::vector<uint_t> &
landmark_ids() const noexcept {
return order_; }
288 void add_landmark_(
const Observation &sighting);
293 std::map<uint_t, index_t> index_;
294 std::vector<uint_t> order_;
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
EKFSlam & operator=(const EKFSlam &)=delete
uint_t update(const std::vector< Observation > &sightings)
Correct with sightings taken at the same time. Returns how many were used: added as new landmarks,...
Definition ekf_slam.cpp:176
void predict(real_t distance, real_t turn)
Move the robot with the odometry of one step: it drove distance [m] and turned by turn [rad].
Definition ekf_slam.cpp:166
AssociationResult update_unknown(const std::vector< Sighting > &sightings)
Correct with sightings taken at the same time whose landmarks are not known: work out which landmark ...
Definition ekf_slam.cpp:226
const Parameters & parameters() const noexcept
Definition ekf_slam.h:284
bool has_landmark(uint_t id) const
Definition ekf_slam.h:257
std::array< real_t, 2 > landmark(uint_t id) const
Where landmark id is [m].
Definition ekf_slam.cpp:373
Pose pose() const
Definition ekf_slam.cpp:365
uint_t n_landmarks() const noexcept
Definition ekf_slam.h:256
const std::vector< uint_t > & landmark_ids() const noexcept
The ids of the landmarks, in the order they were mapped.
Definition ekf_slam.h:262
const DynMat< real_t > & covariance() const
The covariance of the whole state.
Definition ekf_slam.h:277
uint_t n_rejected() const noexcept
How many re-sightings the gate turned away.
Definition ekf_slam.h:282
EKFSlam(const Pose &start, const Parameters ¶meters)
Definition ekf_slam.cpp:152
EKFSlam(const EKFSlam &)=delete
real_t mahalanobis(uint_t id, const Sighting &sighting) const
The squared Mahalanobis distance of a sighting from landmark id: how many variances of the innovation...
Definition ekf_slam.cpp:209
DynMat< real_t > landmark_covariance(uint_t id) const
The 2 x 2 covariance of landmark id.
Definition ekf_slam.cpp:380
DynMat< real_t > pose_covariance() const
The 3 x 3 covariance of (x, y, yaw).
Definition ekf_slam.cpp:371
The extended Kalman filter: it predicts the state with a non-linear motion model and corrects it with...
Definition extended_kalman_filter.h:68
The motion model of EKFSlam: odometry moves the robot and leaves the landmarks where they are.
Definition ekf_slam.h:71
DynMat< real_t > matrix_type
Definition ekf_slam.h:74
state_type & get_state()
Definition ekf_slam.h:88
SlamState state_type
Definition ekf_slam.h:73
const state_type & get_state() const
Definition ekf_slam.h:89
Input input_type
Definition ekf_slam.h:81
const matrix_type & get_matrix(const std::string &name) const
Definition ekf_slam.cpp:76
state_type & evaluate(const Input &input)
Move the robot by one step, and work out F and L at the state before it.
Definition ekf_slam.cpp:50
real_t get_state_property(const std::string &name) const
Definition ekf_slam.h:90
The state of EKFSlam: the robot's pose (x, y, yaw) followed by the position (x, y) of every landmark ...
Definition ekf_slam.h:23
index_t size() const noexcept
Definition ekf_slam.h:28
real_t operator[](index_t i) const
Definition ekf_slam.h:30
real_t get(const std::string &name) const
The pose by name: "x", "y" or "yaw".
Definition ekf_slam.cpp:21
DynVec< real_t > as_vector() const
Definition ekf_slam.h:27
SlamState & operator+=(const Eigen::MatrixBase< Derived > &dx)
Add a correction, as ExtendedKalmanFilter::update does.
Definition ekf_slam.h:40
void append(real_t x, real_t y)
Add a landmark at (x, y) at the end of the state.
Definition ekf_slam.cpp:38
real_t & operator[](index_t i)
Definition ekf_slam.h:29
SlamState()
Definition ekf_slam.h:25
Definition diff_drive_ekf.cpp:12
Definition dc_motor_backend_base.h:9
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
Eigen::Index index_t
The type Eigen indexes and sizes matrices and vectors with.
Definition bitsim_types.h:45
Eigen::MatrixX< T > DynMat
Dynamically sized matrix to use around the library.
Definition bitsim_types.h:51
double real_t
real_t
Definition bitsim_types.h:20
Eigen::RowVectorX< T > DynVec
Dynamically sized row vector.
Definition bitsim_types.h:101
What update_unknown() did with each sighting of a scan.
Definition ekf_slam.h:198
uint_t n_matched
Definition ekf_slam.h:207
uint_t n_discarded
Definition ekf_slam.h:209
std::vector< Kind > kinds
one for each sighting, in the order given
Definition ekf_slam.h:205
std::vector< uint_t > ids
the landmark of each; for a discarded one, unspecified
Definition ekf_slam.h:206
uint_t n_added
Definition ekf_slam.h:208
Kind
Definition ekf_slam.h:200
@ matched
of a mapped landmark, and used to correct the state
Definition ekf_slam.h:201
@ discarded
too far to be a mapped landmark, too close to be sure it is a new one
Definition ekf_slam.h:203
@ added
of a new landmark, added to the map
Definition ekf_slam.h:202
How update_unknown() associates, on the squared Mahalanobis distance. The defaults are the 99 % point...
Definition ekf_slam.h:189
real_t new_gate
beyond this from every landmark, a sighting is a new one
Definition ekf_slam.h:191
real_t match_gate
within this, a sighting can be of the landmark
Definition ekf_slam.h:190
A sighting of a landmark: which one, and where it is from the robot.
Definition ekf_slam.h:168
real_t bearing
from straight ahead, positive to the left [rad]
Definition ekf_slam.h:171
real_t range
[m]
Definition ekf_slam.h:170
Definition ekf_slam.h:148
real_t range_noise
of a sighting's range [m]
Definition ekf_slam.h:152
real_t distance_noise
of the odometry's distance [m per square root of m]
Definition ekf_slam.h:149
real_t bearing_noise
of its bearing [rad]
Definition ekf_slam.h:153
real_t gate
on the squared Mahalanobis distance of a re-sighting
Definition ekf_slam.h:154
real_t turn_drift
of its turn while driving [rad per square root of m]
Definition ekf_slam.h:151
real_t turn_noise
of its turn [rad per square root of rad turned]
Definition ekf_slam.h:150
Definition ekf_slam.h:158
real_t y
Definition ekf_slam.h:160
real_t x
Definition ekf_slam.h:159
real_t yaw
Definition ekf_slam.h:161
A sighting with no id: where something is from the robot, but not which landmark.
Definition ekf_slam.h:178
real_t range
[m]
Definition ekf_slam.h:179
real_t bearing
from straight ahead, positive to the left [rad]
Definition ekf_slam.h:180