Go to the documentation of this file.00001
00024 #ifndef CCNY_RGBD_RGBD_VISUAL_ODOMETRY_H
00025 #define CCNY_RGBD_RGBD_VISUAL_ODOMETRY_H
00026
00027 #include <ros/ros.h>
00028 #include <ros/publisher.h>
00029 #include <sensor_msgs/PointCloud2.h>
00030 #include <geometry_msgs/PoseStamped.h>
00031 #include <visualization_msgs/Marker.h>
00032 #include <tf/transform_listener.h>
00033 #include <tf/transform_broadcaster.h>
00034 #include <pcl_ros/point_cloud.h>
00035 #include <rgbdtools/rgbdtools.h>
00036
00037
00038 #include "ccny_rgbd/types.h"
00039 #include "ccny_rgbd/util.h"
00040 #include "ccny_rgbd/FeatureDetectorConfig.h"
00041 #include "ccny_rgbd/GftDetectorConfig.h"
00042 #include "ccny_rgbd/StarDetectorConfig.h"
00043 #include "ccny_rgbd/SurfDetectorConfig.h"
00044 #include "ccny_rgbd/OrbDetectorConfig.h"
00045 #include "ccny_rgbd/Save.h"
00046 #include "ccny_rgbd/Load.h"
00047 namespace ccny_rgbd {
00048
00057 class VisualOdometry
00058 {
00059 public:
00060
00065 VisualOdometry(const ros::NodeHandle& nh,
00066 const ros::NodeHandle& nh_private);
00067
00070 virtual ~VisualOdometry();
00071
00072 private:
00073
00074
00075
00076 ros::NodeHandle nh_;
00077 ros::NodeHandle nh_private_;
00078 tf::TransformListener tf_listener_;
00079 tf::TransformBroadcaster tf_broadcaster_;
00080 ros::Publisher odom_publisher_;
00081 ros::Publisher pose_stamped_publisher_;
00082 ros::Publisher path_pub_;
00083
00084 ros::Publisher feature_cloud_publisher_;
00085 ros::Publisher feature_cov_publisher_;
00086 ros::Publisher model_cloud_publisher_;
00087 ros::Publisher model_cov_publisher_;
00088 ros::ServiceServer reset_pos_;
00089 FILE * diagnostics_file_;
00090 std::string diagnostics_file_name_;
00091 bool save_diagnostics_;
00092 bool verbose_;
00093
00094 GftDetectorConfigServerPtr gft_config_server_;
00095 StarDetectorConfigServerPtr star_config_server_;
00096 SurfDetectorConfigServerPtr surf_config_server_;
00097 OrbDetectorConfigServerPtr orb_config_server_;
00098
00100 boost::shared_ptr<ImageTransport> rgb_it_;
00101
00103 boost::shared_ptr<ImageTransport> depth_it_;
00104
00106 boost::shared_ptr<RGBDSynchronizer3> sync_;
00107
00109 ImageSubFilter sub_rgb_;
00110
00112 ImageSubFilter sub_depth_;
00113
00115 CameraInfoSubFilter sub_info_;
00116
00117
00118
00119 std::string fixed_frame_;
00120 std::string base_frame_;
00121 bool publish_tf_;
00122 bool publish_path_;
00123 bool publish_odom_;
00124 bool publish_pose_;
00125
00126 bool publish_feature_cloud_;
00127 bool publish_feature_cov_;
00128
00129 bool publish_model_cloud_;
00130 bool publish_model_cov_;
00131
00140 std::string detector_type_;
00141
00148 std::string reg_type_;
00149
00154 bool publish_cloud_;
00155
00156 int queue_size_;
00157
00158
00159
00160 bool initialized_;
00161 int frame_count_;
00162 ros::Time init_time_;
00163
00164 tf::Transform b2c_;
00165 tf::Transform f2b_;
00166
00167 boost::shared_ptr<rgbdtools::FeatureDetector> feature_detector_;
00168
00169 rgbdtools::MotionEstimationICPProbModel motion_estimation_;
00170
00171 PathMsg path_msg_;
00172
00173
00174
00181 void RGBDCallback(const ImageMsg::ConstPtr& rgb_msg,
00182 const ImageMsg::ConstPtr& depth_msg,
00183 const CameraInfoMsg::ConstPtr& info_msg);
00184
00187 void initParams();
00188 bool resetposSrvCallback(Save::Request& request,Save::Response& response);
00189
00192 void resetDetector();
00193
00197 void publishTf(const std_msgs::Header& header);
00198
00203 void publishOdom(const std_msgs::Header& header);
00204
00208 void publishPoseStamped(const std_msgs::Header& header);
00209
00213 void publishPath(const std_msgs::Header& header);
00214
00219 void publishFeatureCloud(rgbdtools::RGBDFrame& frame);
00220
00221 void publishFeatureCovariances(rgbdtools::RGBDFrame& frame);
00222
00223 void publishModelCloud();
00224
00225 void publishModelCovariances();
00226
00230 bool getBaseToCameraTf(const std_msgs::Header& header);
00231
00234 void gftReconfigCallback(GftDetectorConfig& config, uint32_t level);
00235
00238 void starReconfigCallback(StarDetectorConfig& config, uint32_t level);
00239
00242 void surfReconfigCallback(SurfDetectorConfig& config, uint32_t level);
00243
00246 void orbReconfigCallback(OrbDetectorConfig& config, uint32_t level);
00247
00252 void diagnostics(
00253 int n_features, int n_valid_features, int n_model_pts,
00254 double d_frame, double d_features, double d_reg, double d_total);
00255
00256 void configureMotionEstimation();
00257 };
00258
00259 }
00260
00261 #endif // CCNY_RGBD_RGBD_VISUAL_ODOMETRY_H