9#ifndef CRangeBearingKFSLAM_H
10#define CRangeBearingKFSLAM_H
84 std::vector<mrpt::math::TPoint3D> &out_landmarksPositions,
85 std::map<unsigned int,mrpt::maps::CLandmark::TLandmarkID> &out_landmarkIDs,
100 std::vector<mrpt::math::TPoint3D> &out_landmarksPositions,
101 std::map<unsigned int,mrpt::maps::CLandmark::TLandmarkID> &out_landmarkIDs,
107 this->getCurrentState(q,out_landmarksPositions,out_landmarkIDs,out_fullState,out_fullCovariance);
127 this->getCurrentRobotPose(q);
196 predictions_IDs.clear();
197 newly_inserted_landmarks.clear();
214 return m_last_data_association;
224 parts = m_lastPartitionSet;
259 return &mapPartitioner.options;
265 const std::string &fil,
267 const std::string &styleLandmarks = std::string(
"b"),
268 const std::string &stylePath = std::string(
"r"),
269 const std::string &styleRobot = std::string(
"r") )
const;
292 bool &out_skipPrediction
337 const size_t &idx_landmark_to_predict,
386 const size_t in_obsIdx,
387 const size_t in_idxNewFeat );
Virtual base for Kalman Filter (EKF,IEKF,UKF) implementations.
mrpt::aligned_containers< KFArray_OBS >::vector_t vector_KFArray_OBS
This class stores a sequence of <Probabilistic Pose,SensoryFrame> pairs, thus a "metric map" can be t...
CArrayNumeric is an array for numeric types supporting several mathematical operations (actually,...
A numeric matrix of compile-time fixed size.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
Declares a class that represents a Probability Density function (PDF) of a 3D pose .
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
Declares a class that represents a Probability Density function (PDF) of a 3D pose using a quaternion...
This class can be used to make partitions on a map/graph build from observations taken at some poses/...
An implementation of EKF-based SLAM with range-bearing sensors, odometry, a full 6D robot pose,...
mrpt::math::TPoint3D landmark_point_t
Either mrpt::math::TPoint2D or mrpt::math::TPoint3D.
std::vector< vector_uint > m_lastPartitionSet
TDataAssocInfo m_last_data_association
Last data association.
void processActionObservation(mrpt::obs::CActionCollectionPtr &action, mrpt::obs::CSensoryFramePtr &SF)
Process one new action and observations to update the map and robot pose estimate.
void OnNewLandmarkAddedToMap(const size_t in_obsIdx, const size_t in_idxNewFeat)
If applicable to the given problem, do here any special handling of adding a new landmark to the map.
void getCurrentState(mrpt::poses::CPose3DQuatPDFGaussian &out_robotPose, std::vector< mrpt::math::TPoint3D > &out_landmarksPositions, std::map< unsigned int, mrpt::maps::CLandmark::TLandmarkID > &out_landmarkIDs, mrpt::math::CVectorDouble &out_fullState, mrpt::math::CMatrixDouble &out_fullCovariance) const
Returns the complete mean and cov.
CIncrementalMapPartitioner::TOptions * mapPartitionOptions()
Provides access to the parameters of the map partitioning algorithm.
void OnTransitionNoise(KFMatrix_VxV &out_Q) const
Implements the transition noise covariance .
mrpt::obs::CActionCollectionPtr m_action
Set up by processActionObservation.
mrpt::utils::bimap< mrpt::maps::CLandmark::TLandmarkID, unsigned int > m_IDs
The mapping between landmark IDs and indexes in the Pkk cov.
void getLastPartitionLandmarks(std::vector< vector_uint > &landmarksMembership) const
Return the partitioning of the landmarks in clusters accoring to the last partition.
mrpt::poses::CPose3DQuat getCurrentRobotPoseMean() const
Get the current robot pose mean, as a 3D+quaternion pose.
mrpt::poses::CPose3DQuat getIncrementFromOdometry() const
Return the last odometry, as a pose increment.
virtual ~CRangeBearingKFSLAM()
Destructor:
void OnGetObservationNoise(KFMatrix_OxO &out_R) const
Return the observation NOISE covariance matrix, that is, the model of the Gaussian additive noise of ...
void OnGetObservationsAndDataAssociation(vector_KFArray_OBS &out_z, vector_int &out_data_association, const vector_KFArray_OBS &in_all_predictions, const KFMatrix &in_S, const vector_size_t &in_lm_indices_in_S, const KFMatrix_OxO &in_R)
This is called between the KF prediction step and the update step, and the application must return th...
void getLastPartitionLandmarksAsIfFixedSubmaps(size_t K, std::vector< vector_uint > &landmarksMembership)
For testing only: returns the partitioning as "getLastPartitionLandmarks" but as if a fixed-size subm...
void OnPreComputingPredictions(const vector_KFArray_OBS &in_all_prediction_means, vector_size_t &out_LM_indices_to_predict) const
This will be called before OnGetObservationsAndDataAssociation to allow the application to reduce the...
void OnTransitionJacobian(KFMatrix_VxV &out_F) const
Implements the transition Jacobian .
void getCurrentRobotPose(mrpt::poses::CPose3DQuatPDFGaussian &out_robotPose) const
Returns the mean & the 7x7 covariance matrix of the robot 6D pose (with rotation as a quaternion).
CIncrementalMapPartitioner mapPartitioner
Used for map partitioning experiments.
void getLastPartition(std::vector< vector_uint > &parts)
Return the last partition of the sequence of sensoryframes (it is NOT a partition of the map!...
mrpt::maps::CSimpleMap m_SFs
The sequence of all the observations and the robot path (kept for debugging, statistics,...
void getCurrentState(mrpt::poses::CPose3DPDFGaussian &out_robotPose, std::vector< mrpt::math::TPoint3D > &out_landmarksPositions, std::map< unsigned int, mrpt::maps::CLandmark::TLandmarkID > &out_landmarkIDs, mrpt::math::CVectorDouble &out_fullState, mrpt::math::CMatrixDouble &out_fullCovariance) const
Returns the complete mean and cov.
CRangeBearingKFSLAM()
Constructor.
void OnGetAction(KFArray_ACT &out_u) const
Must return the action vector u.
void getCurrentRobotPose(mrpt::poses::CPose3DPDFGaussian &out_robotPose) const
Returns the mean & the 6x6 covariance matrix of the robot 6D pose (with rotation as 3 angles).
void getAs3DObject(mrpt::opengl::CSetOfObjectsPtr &outObj) const
Returns a 3D representation of the landmarks in the map and the robot 3D position according to the cu...
void loadOptions(const mrpt::utils::CConfigFileBase &ini)
Load options from a ini-like file/text.
void OnNormalizeStateVector()
This method is called after the prediction and after the update, to give the user an opportunity to n...
void reconsiderPartitionsNow()
The partitioning of the entire map is recomputed again.
void OnObservationJacobians(const size_t &idx_landmark_to_predict, KFMatrix_OxV &Hx, KFMatrix_OxF &Hy) const
Implements the observation Jacobians and (when applicable) .
void saveMapAndPath2DRepresentationAsMATLABFile(const std::string &fil, float stdCount=3.0f, const std::string &styleLandmarks=std::string("b"), const std::string &stylePath=std::string("r"), const std::string &styleRobot=std::string("r")) const
Save the current state of the filter (robot pose & map) to a MATLAB script which displays all the ele...
void OnObservationModel(const vector_size_t &idx_landmarks_to_predict, vector_KFArray_OBS &out_predictions) const
Implements the observation prediction .
void OnTransitionModel(const KFArray_ACT &in_u, KFArray_VEH &inout_x, bool &out_skipPrediction) const
Implements the transition model .
double computeOffDiagonalBlocksApproximationError(const std::vector< vector_uint > &landmarksMembership) const
Computes the ratio of the missing information matrix elements which are ignored under a certain parti...
const TDataAssocInfo & getLastDataAssociation() const
Returns a read-only reference to the information on the last data-association.
void OnInverseObservationModel(const KFArray_OBS &in_z, KFArray_FEAT &out_yn, KFMatrix_FxV &out_dyn_dxv, KFMatrix_FxO &out_dyn_dhn) const
If applicable to the given problem, this method implements the inverse observation model needed to ex...
void OnSubstractObservationVectors(KFArray_OBS &A, const KFArray_OBS &B) const
Computes A=A-B, which may need to be re-implemented depending on the topology of the individual scala...
mrpt::obs::CSensoryFramePtr m_SF
Set up by processActionObservation.
void reset()
Reset the state of the SLAM filter: The map is emptied and the robot put back to (0,...
This class allows loading and storing values and vectors of different types from a configuration text...
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
A bidirectional version of std::map, declared as bimap<KEY,VALUE> and which actually contains two std...
TDataAssociationMetric
Different metrics for data association, used in mrpt::slam::data_association For a comparison of both...
TDataAssociationMethod
Different algorithms for data association, used in mrpt::slam::data_association.
std::vector< int32_t > vector_int
std::vector< size_t > vector_size_t
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
@ UNINITIALIZED_QUATERNION
struct OBS_IMPEXP CActionCollectionPtr
struct OBS_IMPEXP CSensoryFramePtr
struct OPENGL_IMPEXP CSetOfObjectsPtr
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Configuration of the algorithm:
Information for data-association:
TDataAssociationResults results
std::map< size_t, size_t > newly_inserted_landmarks
Map from the 0-based index within the last observation and the landmark 0-based index in the map (the...
mrpt::math::CMatrixTemplateNumeric< kftype > Y_pred_covs
mrpt::vector_size_t predictions_IDs
The options for the algorithm.
int partitioningMethod
Applicable only if "doPartitioningExperiment=true".
bool force_ignore_odometry
Whether to ignore the input odometry and behave as if there was no odometry at all (default: false)
bool create_simplemap
Whether to fill m_SFs (default=false)
TDataAssociationMetric data_assoc_IC_metric
Whether to use mahalanobis (->chi2 criterion) vs. Matching likelihood.
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form,...
bool doPartitioningExperiment
If set to true (default=false), map will be partitioned using the method stated by partitioningMethod...
float quantiles_3D_representation
Default = 3.
TDataAssociationMetric data_assoc_metric
TOptions()
Default values.
double data_assoc_IC_ml_threshold
Only if data_assoc_IC_metric==ML, the log-ML threshold (Default=0.0)
mrpt::math::CVectorFloat stds_Q_no_odo
A 7-length vector with the std.
TDataAssociationMethod data_assoc_method
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
double data_assoc_IC_chi2_thres
Threshold in [0,1] for the chi2square test for individual compatibility between predictions and obser...
float std_odo_z_additional
Additional std.
The results from mrpt::slam::data_association.