Motion estimation based on aligning sparse features against a persistent, dynamic model. More...
#include <motion_estimation_icp_prob_model.h>
Public Member Functions | |
int | getModelSize () const |
Returns the number of points in the model built from the feature buffer. | |
bool | getMotionEstimationImpl (RGBDFrame &frame, const tf::Transform &prediction, tf::Transform &motion) |
Main method for estimating the motion given an RGBD frame. | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW | MotionEstimationICPProbModel (const ros::NodeHandle &nh, const ros::NodeHandle &nh_private) |
Constructor from ROS noehandles. | |
bool | saveSrvCallback (ccny_rgbd::Save::Request &request, ccny_rgbd::Save::Response &response) |
ROS service to save model to a file. | |
virtual | ~MotionEstimationICPProbModel () |
Default destructor. | |
Private Member Functions | |
void | addToModel (const Vector3f &data_mean, const Matrix3f &data_cov) |
Adds a new point to the model. | |
bool | alignICPEuclidean (const Vector3fVector &data_means, tf::Transform &correction) |
Performs ICP alignment using the Euclidean distance for corresopndences. | |
void | getCorrespEuclidean (const PointCloudFeature &data_cloud, IntVector &data_indices, IntVector &model_indices) |
Performs ICP alignment using the Euclidean distance for corresopndences. | |
bool | getNNEuclidean (const PointFeature &data_point, int &eucl_nn_idx, double &eucl_dist_sq) |
Finds the nearest Euclidean neighbor. | |
bool | getNNMahalanobis (const Vector3f &data_mean, const Matrix3f &data_cov, int &mah_nn_idx, double &mah_dist_sq, IntVector &indices, FloatVector &dists_sq) |
Finds the nearest Mahalanobis neighbor. | |
void | initializeModelFromData (const Vector3fVector &data_means, const Matrix3fVector &data_covariances) |
Initializes the (empty) model from a set of data means and covariances. | |
void | publishCovariances () |
Publish covariance markers of the mdoel for visualization. | |
bool | saveModel (const std::string &filename) |
ROS service to save model to a file. | |
void | updateModelFromData (const Vector3fVector &data_means, const Matrix3fVector &data_covariances) |
Updates the (non-empty) model from a set of data means and covariances. | |
Private Attributes | |
std::string | base_frame_ |
The moving frame (usually camera_link or base_link) | |
Matrix3fVector | covariances_ |
Vector of model feature covariances. | |
ros::Publisher | covariances_publisher_ |
The publisher for the covariance markers. | |
tf::Transform | f2b_ |
Transform from fixed to moving frame. | |
std::string | fixed_frame_ |
The fixed frame (usually odom) | |
Matrix3f | I_ |
3x3 Identity matrix | |
double | max_assoc_dist_mah_ |
Maximum Mahalanobis distance for associating points between the data and the model. | |
double | max_assoc_dist_mah_sq_ |
Maximum squared Mahalanobis distance for associating points between the data and the model, derived. | |
double | max_corresp_dist_eucl_ |
Maximum Euclidean correspondce distance for ICP. | |
double | max_corresp_dist_eucl_sq_ |
Maximum Euclidean correspondce distance for ICP, derived. | |
int | max_iterations_ |
Maximum number of ICP iterations. | |
int | max_model_size_ |
Upper bound for how many features to store in the model. | |
Vector3fVector | means_ |
Vector of model feature mean. | |
int | min_correspondences_ |
Minimum number of correspondences for ICP to contuinue. | |
int | model_idx_ |
Current intex in the ring buffer. | |
PointCloudFeature::Ptr | model_ptr_ |
The model point cloud. | |
ros::Publisher | model_publisher_ |
The publisher for the model point cloud. | |
int | model_size_ |
Current model size. | |
KdTree | model_tree_ |
Kdtree of model_ptr_. | |
int | n_nearest_neighbors_ |
How many euclidean neighbors to go through, in a brute force search of the closest Mahalanobis neighbor. | |
bool | publish_model_ |
If true, model point cloud will be published for visualization. | |
bool | publish_model_cov_ |
If true, covariance markers will be published for visualization. | |
ros::ServiceServer | save_service_ |
Service to save the model to file. | |
double | tf_epsilon_angular_ |
Angular convergence criteria for ICP. | |
double | tf_epsilon_linear_ |
Linear convergence criteria for ICP. |
Motion estimation based on aligning sparse features against a persistent, dynamic model.
The model is build from incoming features through a Kalman Filter update step.
Definition at line 48 of file motion_estimation_icp_prob_model.h.
ccny_rgbd::MotionEstimationICPProbModel::MotionEstimationICPProbModel | ( | const ros::NodeHandle & | nh, |
const ros::NodeHandle & | nh_private | ||
) |
Constructor from ROS noehandles.
nh | the public nodehandle |
nh_private | the private notehandle |
Definition at line 28 of file motion_estimation_icp_prob_model.cpp.
Default destructor.
Definition at line 96 of file motion_estimation_icp_prob_model.cpp.
void ccny_rgbd::MotionEstimationICPProbModel::addToModel | ( | const Vector3f & | data_mean, |
const Matrix3f & | data_cov | ||
) | [private] |
Adds a new point to the model.
The model is implemented using a rign buffer. If the number of points in the model has reached the maximum, the new point will overwrite the oldest model point
data_mean | 3x1 data point means |
data_cov | 3x3 data point covariances |
Definition at line 101 of file motion_estimation_icp_prob_model.cpp.
bool ccny_rgbd::MotionEstimationICPProbModel::alignICPEuclidean | ( | const Vector3fVector & | data_means, |
tf::Transform & | correction | ||
) | [private] |
Performs ICP alignment using the Euclidean distance for corresopndences.
data_means | a vector of 3x1 matrices, repesenting the 3D positions of the features |
correction | reference to the resulting transformation |
true | the motion estimation was successful |
false | the motion estimation failed |
Definition at line 194 of file motion_estimation_icp_prob_model.cpp.
void ccny_rgbd::MotionEstimationICPProbModel::getCorrespEuclidean | ( | const PointCloudFeature & | data_cloud, |
IntVector & | data_indices, | ||
IntVector & | model_indices | ||
) | [private] |
Performs ICP alignment using the Euclidean distance for corresopndences.
data_cloud | a pointcloud of the 3D positions of the features |
data_indices | reference to a vector containting the resulting data indices |
model_indices | reference to a vector containting the resulting model indices |
Definition at line 250 of file motion_estimation_icp_prob_model.cpp.
int ccny_rgbd::MotionEstimationICPProbModel::getModelSize | ( | ) | const [inline, virtual] |
Returns the number of points in the model built from the feature buffer.
Reimplemented from ccny_rgbd::MotionEstimation.
Definition at line 81 of file motion_estimation_icp_prob_model.h.
bool ccny_rgbd::MotionEstimationICPProbModel::getMotionEstimationImpl | ( | RGBDFrame & | frame, |
const tf::Transform & | prediction, | ||
tf::Transform & | motion | ||
) | [virtual] |
Main method for estimating the motion given an RGBD frame.
frame | the current RGBD frame |
prediction | the predicted motion (currently ignored) |
motion | the (output) incremental motion, wrt the fixed frame |
true | the motion estimation was successful |
false | the motion estimation failed |
Implements ccny_rgbd::MotionEstimation.
Definition at line 133 of file motion_estimation_icp_prob_model.cpp.
bool ccny_rgbd::MotionEstimationICPProbModel::getNNEuclidean | ( | const PointFeature & | data_point, |
int & | eucl_nn_idx, | ||
double & | eucl_dist_sq | ||
) | [private] |
Finds the nearest Euclidean neighbor.
data_point | the query 3D data point |
eucl_nn_idx | reference to the resulting nearest neigbor index in the model |
eucl_dist_sq | reference to the resulting squared distance |
true | a neighbor was found |
false | a neighbor was not found |
Definition at line 272 of file motion_estimation_icp_prob_model.cpp.
bool ccny_rgbd::MotionEstimationICPProbModel::getNNMahalanobis | ( | const Vector3f & | data_mean, |
const Matrix3f & | data_cov, | ||
int & | mah_nn_idx, | ||
double & | mah_dist_sq, | ||
IntVector & | indices, | ||
FloatVector & | dists_sq | ||
) | [private] |
Finds the nearest Mahalanobis neighbor.
Requests the K nearest Euclidean neighbors (K = n_nearest_neighbors_) using a kdtree, and performs a brute force search for the closest Mahalanobis nighbor. Reasonable values for K are 4 or 8.
data_mean | 3x1 matrix of the query 3D data point mean |
data_cov | 3x3 matrix of the query 3D data point covariance |
mah_nn_idx | reference to the resulting nearest neigbor index in the model |
mah_dist_sq | reference to the resulting squared Mahalanobis distance |
indices | cache vector, pre-allocated with n_nearest_neighbors_ size |
dists_sq | cache vector, pre-allocated with n_nearest_neighbors_ size |
true | a neighbor was found |
false | a neighbor was not found |
Definition at line 294 of file motion_estimation_icp_prob_model.cpp.
void ccny_rgbd::MotionEstimationICPProbModel::initializeModelFromData | ( | const Vector3fVector & | data_means, |
const Matrix3fVector & | data_covariances | ||
) | [private] |
Initializes the (empty) model from a set of data means and covariances.
data_means | vector of 3x1 data point means |
data_covariances | vector of 3x3 data point covariances |
Definition at line 343 of file motion_estimation_icp_prob_model.cpp.
void ccny_rgbd::MotionEstimationICPProbModel::publishCovariances | ( | ) | [private] |
Publish covariance markers of the mdoel for visualization.
Definition at line 413 of file motion_estimation_icp_prob_model.cpp.
bool ccny_rgbd::MotionEstimationICPProbModel::saveModel | ( | const std::string & | filename | ) | [private] |
ROS service to save model to a file.
filename | filename to save mdoel to |
true | saved succesfully |
false | saving failed |
Definition at line 493 of file motion_estimation_icp_prob_model.cpp.
bool ccny_rgbd::MotionEstimationICPProbModel::saveSrvCallback | ( | ccny_rgbd::Save::Request & | request, |
ccny_rgbd::Save::Response & | response | ||
) |
ROS service to save model to a file.
request | ROS service request |
response | ROS service response |
true | saved succesfully |
false | saving failed |
Definition at line 477 of file motion_estimation_icp_prob_model.cpp.
void ccny_rgbd::MotionEstimationICPProbModel::updateModelFromData | ( | const Vector3fVector & | data_means, |
const Matrix3fVector & | data_covariances | ||
) | [private] |
Updates the (non-empty) model from a set of data means and covariances.
Any data points which have a Mahalanobis neighbor in the model under a certain threshold distance get updated using a Kalman filter.
Any data points without a Mahalanobis neighbor get insterted as new model points.
data_means | vector of 3x1 data point means |
data_covariances | vector of 3x3 data point covariances |
Definition at line 355 of file motion_estimation_icp_prob_model.cpp.
std::string ccny_rgbd::MotionEstimationICPProbModel::base_frame_ [private] |
The moving frame (usually camera_link or base_link)
Definition at line 103 of file motion_estimation_icp_prob_model.h.
Vector of model feature covariances.
Definition at line 158 of file motion_estimation_icp_prob_model.h.
The publisher for the covariance markers.
Definition at line 97 of file motion_estimation_icp_prob_model.h.
Transform from fixed to moving frame.
Definition at line 164 of file motion_estimation_icp_prob_model.h.
std::string ccny_rgbd::MotionEstimationICPProbModel::fixed_frame_ [private] |
The fixed frame (usually odom)
Definition at line 102 of file motion_estimation_icp_prob_model.h.
3x3 Identity matrix
Definition at line 162 of file motion_estimation_icp_prob_model.h.
double ccny_rgbd::MotionEstimationICPProbModel::max_assoc_dist_mah_ [private] |
Maximum Mahalanobis distance for associating points between the data and the model.
Definition at line 125 of file motion_estimation_icp_prob_model.h.
double ccny_rgbd::MotionEstimationICPProbModel::max_assoc_dist_mah_sq_ [private] |
Maximum squared Mahalanobis distance for associating points between the data and the model, derived.
Definition at line 146 of file motion_estimation_icp_prob_model.h.
double ccny_rgbd::MotionEstimationICPProbModel::max_corresp_dist_eucl_ [private] |
Maximum Euclidean correspondce distance for ICP.
Definition at line 129 of file motion_estimation_icp_prob_model.h.
double ccny_rgbd::MotionEstimationICPProbModel::max_corresp_dist_eucl_sq_ [private] |
Maximum Euclidean correspondce distance for ICP, derived.
Definition at line 150 of file motion_estimation_icp_prob_model.h.
int ccny_rgbd::MotionEstimationICPProbModel::max_iterations_ [private] |
Maximum number of ICP iterations.
Definition at line 105 of file motion_estimation_icp_prob_model.h.
int ccny_rgbd::MotionEstimationICPProbModel::max_model_size_ [private] |
Upper bound for how many features to store in the model.
New features added beyond thi spoint will overwrite old features
Definition at line 117 of file motion_estimation_icp_prob_model.h.
Vector of model feature mean.
Definition at line 157 of file motion_estimation_icp_prob_model.h.
Minimum number of correspondences for ICP to contuinue.
Definition at line 106 of file motion_estimation_icp_prob_model.h.
int ccny_rgbd::MotionEstimationICPProbModel::model_idx_ [private] |
Current intex in the ring buffer.
Definition at line 155 of file motion_estimation_icp_prob_model.h.
The model point cloud.
Definition at line 154 of file motion_estimation_icp_prob_model.h.
The publisher for the model point cloud.
Definition at line 96 of file motion_estimation_icp_prob_model.h.
int ccny_rgbd::MotionEstimationICPProbModel::model_size_ [private] |
Current model size.
Definition at line 156 of file motion_estimation_icp_prob_model.h.
Kdtree of model_ptr_.
Definition at line 160 of file motion_estimation_icp_prob_model.h.
How many euclidean neighbors to go through, in a brute force search of the closest Mahalanobis neighbor.
Definition at line 111 of file motion_estimation_icp_prob_model.h.
bool ccny_rgbd::MotionEstimationICPProbModel::publish_model_ [private] |
If true, model point cloud will be published for visualization.
Note that this might slow down performance
Definition at line 135 of file motion_estimation_icp_prob_model.h.
bool ccny_rgbd::MotionEstimationICPProbModel::publish_model_cov_ [private] |
If true, covariance markers will be published for visualization.
Note that this might slow down performance
Definition at line 141 of file motion_estimation_icp_prob_model.h.
Service to save the model to file.
Definition at line 98 of file motion_estimation_icp_prob_model.h.
double ccny_rgbd::MotionEstimationICPProbModel::tf_epsilon_angular_ [private] |
Angular convergence criteria for ICP.
Definition at line 120 of file motion_estimation_icp_prob_model.h.
double ccny_rgbd::MotionEstimationICPProbModel::tf_epsilon_linear_ [private] |
Linear convergence criteria for ICP.
Definition at line 119 of file motion_estimation_icp_prob_model.h.