Public Member Functions | Private Member Functions | Private Attributes
Stereodom Class Reference

Estimates 6DOF pose from stereo image pairs and IMU data. More...

#include <stereodom.hpp>

List of all members.

Public Member Functions

 Stereodom (std::string &nodeName, std::string &leftCam, std::string &rightCam, std::string &imuTopic)
 Constructor.
 ~Stereodom (void)
 Destructor.

Private Member Functions

tf::Transform baselink2camera (const tf::Transform &odom)
 Convert odometry from the robot base_link frame to camera frame.
tf::Transform camera2baselink (const tf::Transform &odomC)
 Convert odometry from camera frame to the robot base_link frame.
void cameraInfoCallback (const sensor_msgs::CameraInfoConstPtr &leftInfo, const sensor_msgs::CameraInfoConstPtr &rightInfo)
 Camera calibration info callback.
void compensateIMU (tf::Transform &odom)
 Compensate IMU roll and pitch angles in base_link frame.
double computeFeatureFlow (const std::vector< cv::DMatch > &matches, const std::vector< cv::KeyPoint > &trainKpts, const std::vector< cv::KeyPoint > &queryKpts)
 Compute feature flow between matched key-points.
bool convertRectifyImages (const sensor_msgs::ImageConstPtr &leftImg, const sensor_msgs::ImageConstPtr &rightImg, cv::Mat &imgL, cv::Mat &imgR)
 Converts images to OpenCV format and rectify both images.
void dynRecCallback (viodom::stereodomConfig &config, uint32_t level)
 Dynamic reconfigure callback.
void extractDescriptors (cv::Mat &imgL, cv::Mat &imgR, std::vector< cv::KeyPoint > &keypointsLeft, std::vector< cv::KeyPoint > &keypointsRight, cv::Mat &descriptorsLeft, cv::Mat &descriptorsRight)
 Extract feature descriptors from image key-points.
void kptsBucketing (std::vector< cv::KeyPoint > &srcKpts, std::vector< cv::KeyPoint > &dstKpts, int width, int height)
 Distribute maxFeatures_ among all buckets. We are considering 6 buckets organized in 2 rows and 3 columns.
bool leftMatching (std::vector< cv::KeyPoint > &keypointsCurr, std::vector< cv::KeyPoint > &keypointsPrev, cv::Mat &descriptorsCurr, cv::Mat &descriptorsPrev, std::vector< cv::DMatch > &stereoMatchesPrev, std::vector< cv::Point3f > &pclPrev, double &flow, std::vector< cv::Point3f > &points3d, std::vector< cv::Point2f > &projections)
 Match key-points left prev-curr descriptors and generate 3D point cloud.
bool leftPnP (std::vector< cv::Point3f > &points3d, std::vector< cv::Point2f > &projections, tf::Transform &deltaT)
 Solve PnP problem between previous and current left images.
void openCVToTf (const cv::Mat &t, const cv::Mat &R, tf::Transform &tf)
 Converts OpenCV translation and rotation into tf::Transform.
void publishPointCloud (const std::vector< cv::Point3f > pcl, const std_msgs::Header header)
 Publish 3D point cloud.
void publishTf (const tf::Transform &odom)
 Publish 6DOF pose as TF and geometry_msgs::TransformStamped.
void selectKeypoints (cv::Mat &imgLeft, cv::Mat &imgRight, std::vector< cv::KeyPoint > &keypointsLeft, std::vector< cv::KeyPoint > &keypointsRight)
 Detects key-points in the images Key-points are sorted based on their score to get the best maxFeatures_ Features are included in buckets in order to force sparseness.
void stereoCallback (const sensor_msgs::ImageConstPtr &leftImg, const sensor_msgs::ImageConstPtr &rightImg)
 Stereo callback with image rectification.
bool stereoMatching (std::vector< cv::KeyPoint > &keypointsLeft, std::vector< cv::KeyPoint > &keypointsRight, cv::Mat &descriptorsLeft, cv::Mat &descriptorsRight, std::vector< cv::DMatch > &stereoMatches, std::vector< cv::Point3f > &pcl)
 Match key-points L-R descriptors and generate 3D point cloud.
void tfToOpenCV (const tf::Transform &tf, cv::Mat &t, cv::Mat &R)
 Converts OpenCV translation and rotation into tf::Transform.
void updatePreviousStuff (const cv::Mat &imgL, const cv::Mat &imgR)
 Update previous-current keypoints, images, descriptors, matches and point clouds.

Private Attributes

bool calibInit_
message_filters::TimeSynchronizer
< sensor_msgs::CameraInfo,
sensor_msgs::CameraInfo > 
cameraInfoSync_
cv::Mat descLeftC_
cv::Mat descLeftP_
cv::Mat descRightC_
cv::Mat descRightP_
int downsampling_
dynamic_reconfigure::Server
< viodom::stereodomConfig >
::CallbackType 
dyn_rec_f_
dynamic_reconfigure::Server
< viodom::stereodomConfig > 
dyn_rec_server_
cv::FastFeatureDetector fDetector_
cv::BriefDescriptorExtractor fExtractor_
double flowThreshold_
cv::Mat imgC_
cv::Mat imgCkf_
cv::Mat imgLP_
cv::Mat imgRP_
ImuFilter imu_
image_transport::ImageTransport it_
double kfRotTh_
double kfTrTh_
cv::Mat KL_
std::vector< cv::KeyPoint > kptsLeftC_
std::vector< cv::KeyPoint > kptsLeftP_
std::vector< cv::KeyPoint > kptsRightC_
std::vector< cv::KeyPoint > kptsRightP_
cv::Mat KR_
image_transport::SubscriberFilter leftImgSubs_
message_filters::Subscriber
< sensor_msgs::CameraInfo > 
leftInfoSubs_
cv::Mat mapL1_
cv::Mat mapL2_
cv::Mat mapR1_
cv::Mat mapR2_
RobustMatcher matcher_
int maxFeatures_
int minMatches_
ros::NodeHandle nh_
tf::Transform odom_
tf::Transform odomC_
tf::Transform odomCkf_
bool odomInit_
std::vector< cv::Point3f > pclC_
std::vector< cv::Point3f > pclP_
ros::Publisher pcPub_
cv::Mat PL_
cv::Mat PR_
bool publishPc_
image_transport::SubscriberFilter rightImgSubs_
message_filters::Subscriber
< sensor_msgs::CameraInfo > 
rightInfoSubs_
cv::Mat RL_
cv::Mat RR_
std::string srcFrameId_
std::vector< cv::DMatch > stereoMatchesC_
std::vector< cv::DMatch > stereoMatchesP_
message_filters::TimeSynchronizer
< sensor_msgs::Image,
sensor_msgs::Image > 
stereoSync_
tf::Transform Tcam22imu0_
tf::TransformBroadcaster tfBr_
std::string tgtFrameId_
tf::Transform Timu02base_
ros::Publisher transformPub_

Detailed Description

Estimates 6DOF pose from stereo image pairs and IMU data.

Definition at line 78 of file stereodom.hpp.


Constructor & Destructor Documentation

Stereodom::Stereodom ( std::string &  nodeName,
std::string &  leftCam,
std::string &  rightCam,
std::string &  imuTopic 
) [inline]

Constructor.

Parameters:
nodeNameNode name for publishing topics
leftCamName of the left camera
rightCamName of the right camera
imuTopicName of the IMU data topic

Definition at line 87 of file stereodom.hpp.

Stereodom::~Stereodom ( void  ) [inline]

Destructor.

Definition at line 160 of file stereodom.hpp.


Member Function Documentation

tf::Transform Stereodom::baselink2camera ( const tf::Transform odom) [inline, private]

Convert odometry from the robot base_link frame to camera frame.

Parameters:
odomOdometry transform in base_link frame
Returns:
Odometry transform in camera frame

Definition at line 511 of file stereodom.hpp.

tf::Transform Stereodom::camera2baselink ( const tf::Transform odomC) [inline, private]

Convert odometry from camera frame to the robot base_link frame.

Parameters:
odomCOdometry transform in camera frame
Returns:
Odometry transform in the robot base_link frame

Definition at line 501 of file stereodom.hpp.

void Stereodom::cameraInfoCallback ( const sensor_msgs::CameraInfoConstPtr &  leftInfo,
const sensor_msgs::CameraInfoConstPtr &  rightInfo 
) [inline, private]

Camera calibration info callback.

Parameters:
leftInfoLeft camera calibration data
rightInfoRight camera calibration data

Definition at line 695 of file stereodom.hpp.

void Stereodom::compensateIMU ( tf::Transform odom) [inline, private]

Compensate IMU roll and pitch angles in base_link frame.

Definition at line 487 of file stereodom.hpp.

double Stereodom::computeFeatureFlow ( const std::vector< cv::DMatch > &  matches,
const std::vector< cv::KeyPoint > &  trainKpts,
const std::vector< cv::KeyPoint > &  queryKpts 
) [inline, private]

Compute feature flow between matched key-points.

Parameters:
matchesList of matches
trainKptsKey-points from 'train' image
queryKptsKey-points fraom 'query' image
Returns:
Computed feature flow

Definition at line 337 of file stereodom.hpp.

bool Stereodom::convertRectifyImages ( const sensor_msgs::ImageConstPtr &  leftImg,
const sensor_msgs::ImageConstPtr &  rightImg,
cv::Mat &  imgL,
cv::Mat &  imgR 
) [inline, private]

Converts images to OpenCV format and rectify both images.

Parameters:
[in]leftImgLeft image in ROS format
[in]rightImgRight image in ROS format
[out]imgLRectified left image in OpenCV format
[out]imgRRectified right image in OpenCV format

Definition at line 172 of file stereodom.hpp.

void Stereodom::dynRecCallback ( viodom::stereodomConfig &  config,
uint32_t  level 
) [inline, private]

Dynamic reconfigure callback.

Definition at line 747 of file stereodom.hpp.

void Stereodom::extractDescriptors ( cv::Mat &  imgL,
cv::Mat &  imgR,
std::vector< cv::KeyPoint > &  keypointsLeft,
std::vector< cv::KeyPoint > &  keypointsRight,
cv::Mat &  descriptorsLeft,
cv::Mat &  descriptorsRight 
) [inline, private]

Extract feature descriptors from image key-points.

Parameters:
[in]imgLeftLeft image
[in]imgRightRight image
[in]keypointsLeftKey-points extracted from left image
[in]keypointsRightKey-points extracted from right image
[out]descriptorsLeftFeature descriptors for key-points from left image
[out]descriptorsRightFeature descriptors for key-points from right image

Definition at line 270 of file stereodom.hpp.

void Stereodom::kptsBucketing ( std::vector< cv::KeyPoint > &  srcKpts,
std::vector< cv::KeyPoint > &  dstKpts,
int  width,
int  height 
) [inline, private]

Distribute maxFeatures_ among all buckets. We are considering 6 buckets organized in 2 rows and 3 columns.

Parameters:
[in]srcKptsSorted key-points
[out]dstKptsOutput bucketed key-points
[in]widthImage width (cols)
[in]heightImage height (rows)

Definition at line 202 of file stereodom.hpp.

bool Stereodom::leftMatching ( std::vector< cv::KeyPoint > &  keypointsCurr,
std::vector< cv::KeyPoint > &  keypointsPrev,
cv::Mat &  descriptorsCurr,
cv::Mat &  descriptorsPrev,
std::vector< cv::DMatch > &  stereoMatchesPrev,
std::vector< cv::Point3f > &  pclPrev,
double &  flow,
std::vector< cv::Point3f > &  points3d,
std::vector< cv::Point2f > &  projections 
) [inline, private]

Match key-points left prev-curr descriptors and generate 3D point cloud.

Parameters:
[in]keypointsCurrKey-points extracted from current left image
[in]keypointsPrevKey-points extracted from previous left image
[in]descriptorsCurrFeature descriptors for key-points from current left image
[in]descriptorsPrevFeature descriptors for key-points from previous left image
[in]stereoMatchesPrevMatches between features from previous left image
[in]pclPrev3D point cloud based on stereo matches from previous left image
[out]flowFeature flow between previous and current left images
[out]points3d3D points matched between previous and current left images, taken from pclPrev
[out]projections2D projections of matched 3D points in current left image

Definition at line 367 of file stereodom.hpp.

bool Stereodom::leftPnP ( std::vector< cv::Point3f > &  points3d,
std::vector< cv::Point2f > &  projections,
tf::Transform deltaT 
) [inline, private]

Solve PnP problem between previous and current left images.

Parameters:
[out]points3d3D points matched between previous and current left images, taken from previous 3D point cloud
[out]projections2D projections of matched 3D points in current left image
[out]deltaTEstimated transform between previous and current left frames

Definition at line 449 of file stereodom.hpp.

void Stereodom::openCVToTf ( const cv::Mat &  t,
const cv::Mat &  R,
tf::Transform tf 
) [inline, private]

Converts OpenCV translation and rotation into tf::Transform.

Parameters:
[in]tOpenCV translation vector
[in]ROpenCV rotation matrix
[out]transformROS tf::Transform element

Definition at line 414 of file stereodom.hpp.

void Stereodom::publishPointCloud ( const std::vector< cv::Point3f >  pcl,
const std_msgs::Header  header 
) [inline, private]

Publish 3D point cloud.

Parameters:
[in]headerHeader for the point cloud message

Definition at line 545 of file stereodom.hpp.

void Stereodom::publishTf ( const tf::Transform odom) [inline, private]

Publish 6DOF pose as TF and geometry_msgs::TransformStamped.

Parameters:
odomOdometry transform to be published

Definition at line 520 of file stereodom.hpp.

void Stereodom::selectKeypoints ( cv::Mat &  imgLeft,
cv::Mat &  imgRight,
std::vector< cv::KeyPoint > &  keypointsLeft,
std::vector< cv::KeyPoint > &  keypointsRight 
) [inline, private]

Detects key-points in the images Key-points are sorted based on their score to get the best maxFeatures_ Features are included in buckets in order to force sparseness.

Parameters:
[in]imgLeftLeft image
[in]imgRightRight image
[out]keypointsLeftKey-points extracted from left image
[out]keypointsRightKey-points extracted from right image

Definition at line 242 of file stereodom.hpp.

void Stereodom::stereoCallback ( const sensor_msgs::ImageConstPtr &  leftImg,
const sensor_msgs::ImageConstPtr &  rightImg 
) [inline, private]

Stereo callback with image rectification.

Parameters:
leftImgLeft image
rightImgRight image

Definition at line 594 of file stereodom.hpp.

bool Stereodom::stereoMatching ( std::vector< cv::KeyPoint > &  keypointsLeft,
std::vector< cv::KeyPoint > &  keypointsRight,
cv::Mat &  descriptorsLeft,
cv::Mat &  descriptorsRight,
std::vector< cv::DMatch > &  stereoMatches,
std::vector< cv::Point3f > &  pcl 
) [inline, private]

Match key-points L-R descriptors and generate 3D point cloud.

Parameters:
[in]keypointsLeftKey-points extracted from left image
[in]keypointsRightKey-points extracted from right image
[in]descriptorsLeftFeature descriptors for key-points from left image
[in]descriptorsRightFeature descriptors for key-points from right image
[out]stereoMatchesResulting matches between features
[out]pclResulting 3D point cloud based on stereo matches between features

Definition at line 287 of file stereodom.hpp.

void Stereodom::tfToOpenCV ( const tf::Transform tf,
cv::Mat &  t,
cv::Mat &  R 
) [inline, private]

Converts OpenCV translation and rotation into tf::Transform.

Parameters:
[in]tOpenCV translation vector
[in]ROpenCV rotation matrix
[out]transformROS tf::Transform element

Definition at line 432 of file stereodom.hpp.

void Stereodom::updatePreviousStuff ( const cv::Mat &  imgL,
const cv::Mat &  imgR 
) [inline, private]

Update previous-current keypoints, images, descriptors, matches and point clouds.

Parameters:
[in]imgLCurrent left image
[in]imgRCurrent right image

Definition at line 570 of file stereodom.hpp.


Member Data Documentation

bool Stereodom::calibInit_ [private]

Flag indicating if we have calibration data

Definition at line 789 of file stereodom.hpp.

message_filters::TimeSynchronizer<sensor_msgs::CameraInfo, sensor_msgs::CameraInfo> Stereodom::cameraInfoSync_ [private]

Time synchronizer filter for camera info

Definition at line 783 of file stereodom.hpp.

cv::Mat Stereodom::descLeftC_ [private]

Stored previous (P) and current (C) descriptors for left image

Definition at line 766 of file stereodom.hpp.

cv::Mat Stereodom::descLeftP_ [private]

Definition at line 766 of file stereodom.hpp.

cv::Mat Stereodom::descRightC_ [private]

Stored previous (P) and current (C) descriptors for right image

Definition at line 767 of file stereodom.hpp.

cv::Mat Stereodom::descRightP_ [private]

Definition at line 767 of file stereodom.hpp.

int Stereodom::downsampling_ [private]

Downsampling factor for the input images

Definition at line 796 of file stereodom.hpp.

dynamic_reconfigure::Server<viodom::stereodomConfig>::CallbackType Stereodom::dyn_rec_f_ [private]

Dynamic reconfigure callback

Definition at line 816 of file stereodom.hpp.

dynamic_reconfigure::Server<viodom::stereodomConfig> Stereodom::dyn_rec_server_ [private]

Dynamic reconfigure server

Definition at line 815 of file stereodom.hpp.

cv::FastFeatureDetector Stereodom::fDetector_ [private]

Feature detector (FAST)

Definition at line 769 of file stereodom.hpp.

cv::BriefDescriptorExtractor Stereodom::fExtractor_ [private]

Feature decriptor extractor (BRIEF)

Definition at line 770 of file stereodom.hpp.

double Stereodom::flowThreshold_ [private]

Minimum feature flow to determine if a new key-frame has to be created

Definition at line 794 of file stereodom.hpp.

cv::Mat Stereodom::imgC_ [private]

Definition at line 808 of file stereodom.hpp.

cv::Mat Stereodom::imgCkf_ [private]

Current and key-frame images

Definition at line 808 of file stereodom.hpp.

cv::Mat Stereodom::imgLP_ [private]

Previous right(R) and left(L) images

Definition at line 809 of file stereodom.hpp.

cv::Mat Stereodom::imgRP_ [private]

Definition at line 809 of file stereodom.hpp.

IMU processor

Definition at line 813 of file stereodom.hpp.

Image transport

Definition at line 778 of file stereodom.hpp.

double Stereodom::kfRotTh_ [private]

Thresholds to trigger key-frame creation for SBA (translation in meters, rotation in radians)

Definition at line 800 of file stereodom.hpp.

double Stereodom::kfTrTh_ [private]

Definition at line 800 of file stereodom.hpp.

cv::Mat Stereodom::KL_ [private]

Definition at line 802 of file stereodom.hpp.

std::vector<cv::KeyPoint> Stereodom::kptsLeftC_ [private]

Stored previous (P) and current (C) keypoints for left image

Definition at line 764 of file stereodom.hpp.

std::vector<cv::KeyPoint> Stereodom::kptsLeftP_ [private]

Definition at line 764 of file stereodom.hpp.

std::vector<cv::KeyPoint> Stereodom::kptsRightC_ [private]

Stored previous (P) and current (C) keypoints for right image

Definition at line 765 of file stereodom.hpp.

std::vector<cv::KeyPoint> Stereodom::kptsRightP_ [private]

Definition at line 765 of file stereodom.hpp.

cv::Mat Stereodom::KR_ [private]

Definition at line 803 of file stereodom.hpp.

Definition at line 779 of file stereodom.hpp.

message_filters::Subscriber<sensor_msgs::CameraInfo> Stereodom::leftInfoSubs_ [private]

Definition at line 780 of file stereodom.hpp.

cv::Mat Stereodom::mapL1_ [private]

Definition at line 805 of file stereodom.hpp.

cv::Mat Stereodom::mapL2_ [private]

Definition at line 805 of file stereodom.hpp.

cv::Mat Stereodom::mapR1_ [private]

Definition at line 805 of file stereodom.hpp.

cv::Mat Stereodom::mapR2_ [private]

Stereo rectification mappings

Definition at line 805 of file stereodom.hpp.

Matcher

Definition at line 772 of file stereodom.hpp.

int Stereodom::maxFeatures_ [private]

Maximum number of features to find in each bucket

Definition at line 793 of file stereodom.hpp.

int Stereodom::minMatches_ [private]

Minimum number of matches to perform odometry estimation

Definition at line 795 of file stereodom.hpp.

ROS node handler

Definition at line 777 of file stereodom.hpp.

Definition at line 807 of file stereodom.hpp.

Definition at line 807 of file stereodom.hpp.

Odometry matrices in camera and base_link frames

Definition at line 807 of file stereodom.hpp.

bool Stereodom::odomInit_ [private]

Flag to determine whether to perform odometry or not

Definition at line 788 of file stereodom.hpp.

std::vector<cv::Point3f> Stereodom::pclC_ [private]

Stored previous (P) and current(C) 3D point clouds

Definition at line 775 of file stereodom.hpp.

std::vector<cv::Point3f> Stereodom::pclP_ [private]

Definition at line 775 of file stereodom.hpp.

Publisher for 3D point cloud

Definition at line 786 of file stereodom.hpp.

cv::Mat Stereodom::PL_ [private]

Definition at line 802 of file stereodom.hpp.

cv::Mat Stereodom::PR_ [private]

Definition at line 803 of file stereodom.hpp.

bool Stereodom::publishPc_ [private]

Flag to determine whether to publish 3D point cloud

Definition at line 792 of file stereodom.hpp.

Image subscribers

Definition at line 779 of file stereodom.hpp.

message_filters::Subscriber<sensor_msgs::CameraInfo> Stereodom::rightInfoSubs_ [private]

Camera info subscribers

Definition at line 780 of file stereodom.hpp.

cv::Mat Stereodom::RL_ [private]

Stereo camera parameters for left (L) camera

Definition at line 802 of file stereodom.hpp.

cv::Mat Stereodom::RR_ [private]

Stereo camera parameters for right (R) camera

Definition at line 803 of file stereodom.hpp.

std::string Stereodom::srcFrameId_ [private]

Source frame for odometry transformation

Definition at line 797 of file stereodom.hpp.

std::vector<cv::DMatch> Stereodom::stereoMatchesC_ [private]

Matching results for previous(P) and current(C) stereo pairs

Definition at line 774 of file stereodom.hpp.

std::vector<cv::DMatch> Stereodom::stereoMatchesP_ [private]

Definition at line 774 of file stereodom.hpp.

message_filters::TimeSynchronizer<sensor_msgs::Image, sensor_msgs::Image> Stereodom::stereoSync_ [private]

Time synchronizer filter for images

Definition at line 782 of file stereodom.hpp.

Definition at line 799 of file stereodom.hpp.

Transform broadcaster

Definition at line 811 of file stereodom.hpp.

std::string Stereodom::tgtFrameId_ [private]

Target frame for odometry transformation

Definition at line 798 of file stereodom.hpp.

Auxiliary transforms between camera and base_link frames

Definition at line 799 of file stereodom.hpp.

Publisher for output odometry transform

Definition at line 785 of file stereodom.hpp.


The documentation for this class was generated from the following file:


viodom
Author(s): Fernando Caballero , Francisco J. Perez Grau
autogenerated on Thu Jun 6 2019 20:17:02