3 #ifndef VISO2_STEREOODOMETER_TASK_HPP 4 #define VISO2_STEREOODOMETER_TASK_HPP 6 #include "viso2/StereoOdometerBase.hpp" 10 #include <opencv2/core/core.hpp> 11 #include <opencv2/core/eigen.hpp> 12 #include <opencv/highgui.h> 15 #include "frame_helper/FrameHelper.h" 16 #include "frame_helper/FrameHelperTypes.h" 17 #include "frame_helper/Calibration.h" 18 #include "frame_helper/CalibrationCv.h" 21 #include <base/samples/RigidBodyState.hpp> 22 #include <base/samples/DistanceImage.hpp> 29 #include <boost/shared_ptr.hpp> 30 #include <boost/circular_buffer.hpp> 31 #include <boost/unordered_map.hpp> 34 #include <viso2/matrix.h> 35 #include <viso2/viso_stereo.h> 39 #include<Eigen/StdVector> 70 friend class StereoOdometerBase;
73 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
76 static const int DEFAULT_CIRCULAR_BUFFER_SIZE = 2;
96 boost::shared_ptr<VisualOdometryStereo>
viso;
97 boost::circular_buffer<base::samples::frame::FramePair>
imagePair;
102 boost::unordered_map< int32_t, int32_t >
hashIdx;
103 boost::circular_buffer< std::map < int32_t, HashPoint, std::less<int32_t>,
104 Eigen::aligned_allocator< std::pair < const int32_t, HashPoint > > > >
hashPointcloud;
111 RTT::extras::ReadOnlyPointer<base::samples::frame::Frame>
frame_out;
115 virtual void left_frameTransformerCallback(
const base::Time &ts, const ::RTT::extras::ReadOnlyPointer< ::base::samples::frame::Frame > &left_frame_sample);
116 virtual void right_frameTransformerCallback(
const base::Time &ts, const ::RTT::extras::ReadOnlyPointer< ::base::samples::frame::Frame > &right_frame_sample);
123 StereoOdometer(std::string
const& name =
"viso2::StereoOdometer");
130 StereoOdometer(std::string
const& name, RTT::ExecutionEngine* engine);
150 bool configureHook();
196 viso2::Viso2Info computeStereoOdometer(
const base::Time &ts,
const Eigen::Affine3d &tf);
198 void drawMatches(
const base::samples::frame::Frame &image1,
const base::samples::frame::Frame &image2,
199 const std::vector<Matcher::p_match> &matches,
const std::vector<int32_t>& inlier_indices, base::samples::frame::Frame &imageOutput);
201 void createDistanceImage(
const base::samples::frame::Frame &image1,
const base::samples::frame::Frame &image2,
202 const std::vector<Matcher::p_match> &matches,
const VisualOdometryStereo::parameters &viso2param,
203 base::samples::DistanceImage &distImage);
205 void createPointCloud(
const Eigen::Affine3d &tf,
206 const base::samples::frame::Frame &image1,
207 const std::vector<Matcher::p_match> &matches,
208 const std::vector<int32_t>& inlier_indices,
209 const Eigen::Matrix4d &Q,
210 const Eigen::Affine3d &deltaPose,
211 boost::unordered_map< int32_t, int32_t > &hashIdx,
212 boost::circular_buffer< std::map < int32_t,
HashPoint, std::less<int32_t>,
213 Eigen::aligned_allocator< std::pair < const int32_t, HashPoint > > > > &hashPointcloud);
215 base::Vector3d computeFeaturesJacobian (
const Eigen::Affine3d &deltaPose,
216 const base::Vector3d &
point);
218 void postProcessPointCloud (boost::unordered_map< int32_t, int32_t > & hashIdx,
219 boost::circular_buffer< std::map < int32_t,
HashPoint, std::less<int32_t>,
220 Eigen::aligned_allocator< std::pair < const int32_t, HashPoint > > > > &hashPointcloud,
221 base::samples::Pointcloud &pointcloud,
222 std::vector<base::Matrix3d> &pointsVar,
223 std::vector<unsigned int> &pointsIdx,
224 base::MatrixXd &deltaJacobCurr,
225 base::MatrixXd &deltaJacobPrev);
boost::unordered_map< int32_t, int32_t > hashIdx
Definition: StereoOdometer.hpp:102
The task context provides and requires services. It uses an ExecutionEngine to perform its functions...
Definition: StereoOdometer.hpp:68
frame_helper::FrameHelper frameHelperRight
Definition: StereoOdometer.hpp:98
base::Vector4d color
Definition: StereoOdometer.hpp:48
::base::Matrix2d pxrightVar
Definition: StereoOdometer.hpp:101
Eigen::Matrix4d Q
Definition: StereoOdometer.hpp:99
frame_helper::StereoCalibration cameracalib
Definition: StereoOdometer.hpp:88
base::samples::RigidBodyState poseOut
Definition: StereoOdometer.hpp:110
size_t idx
Definition: StereoOdometer.hpp:46
RTT::extras::ReadOnlyPointer< base::samples::frame::Frame > frame_out
Definition: StereoOdometer.hpp:111
Definition: StereoOdometer.hpp:41
base::Vector3d jacobian
Definition: StereoOdometer.hpp:50
::base::samples::frame::Frame leftColorImage
Definition: StereoOdometer.hpp:100
frame_helper::StereoCalibrationCv cameracalibCv
Definition: StereoOdometer.hpp:91
Definition: StereoOdometer.hpp:44
boost::circular_buffer< base::samples::frame::FramePair > imagePair
Definition: StereoOdometer.hpp:97
boost::shared_ptr< VisualOdometryStereo > viso
Definition: StereoOdometer.hpp:96
Eigen::Affine3d pose
Definition: StereoOdometer.hpp:109
Definition: viso2Types.hpp:43
base::Matrix3d cov
Definition: StereoOdometer.hpp:49
boost::circular_buffer< std::map< int32_t, HashPoint, std::less< int32_t >, Eigen::aligned_allocator< std::pair< const int32_t, HashPoint > > > > hashPointcloud
Definition: StereoOdometer.hpp:104
VisualOdometryStereo::parameters viso2param
Definition: StereoOdometer.hpp:85
base::Vector3d point
Definition: StereoOdometer.hpp:47