Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00037 #ifndef LASERSCAN_KINECT
00038 #define LASERSCAN_KINECT
00039
00040 #include <ros/console.h>
00041 #include <sensor_msgs/Image.h>
00042 #include <sensor_msgs/LaserScan.h>
00043 #include <sensor_msgs/image_encodings.h>
00044 #include <image_geometry/pinhole_camera_model.h>
00045
00046 #include <limits.h>
00047 #include <algorithm>
00048 #include <vector>
00049 #include <cmath>
00050 #include <string>
00051 #include <boost/lexical_cast.hpp>
00052
00053 #define MAX_UINT16 65535
00054 #define SCAN_TIME 1.0/30.0
00055
00056 namespace laserscan_kinect
00057 {
00058 class LaserScanKinect
00059 {
00060 public:
00061 LaserScanKinect();
00062 ~LaserScanKinect() { }
00063
00072 sensor_msgs::LaserScanPtr prepareLaserScanMsg(const sensor_msgs::ImageConstPtr& depth_msg,
00073 const sensor_msgs::CameraInfoConstPtr& info_msg);
00078 void setOutputFrame (const std::string frame) { output_frame_id_ = frame; }
00085 void setRangeLimits(const float rmin, const float rmax);
00091 void setScanHeight(const int scan_height);
00097 void setDepthImgRowStep(const int row_step);
00103 void setCamModelUpdate (const bool enable) { cam_model_update_ = enable; }
00107 void setSensorMountHeight (const float height);
00113 void setSensorTiltAngle (const float angle);
00119 void setGroundRemove (const bool enable) { ground_remove_enable_ = enable; }
00125 void setGroundMargin (const float margin);
00131 void setTiltCompensation (const bool enable) { tilt_compensation_enable_ = enable; }
00137 void setScanConfigurated (const bool configurated) { is_scan_msg_configurated_ = configurated; }
00138
00139 private:
00146 double lengthOfVector(const cv::Point3d& ray) const;
00154 double angleBetweenRays(const cv::Point3d& ray1, const cv::Point3d& ray2) const;
00167 void fieldOfView( double & min, double & max, double x1, double y1,
00168 double xc, double yc, double x2, double y2);
00174 void calcGroundDistancesForImgRows(double vertical_fov);
00180 void calcTiltCompensationFactorsForImgRows(double vertical_fov);
00186 void calcScanMsgIndexForImgCols(const sensor_msgs::ImageConstPtr& depth_msg);
00192 void convertDepthToPolarCoords( const sensor_msgs::ImageConstPtr& depth_msg);
00193
00194 private:
00195
00196
00197 std::string output_frame_id_;
00198 float range_min_;
00199 float range_max_;
00200 unsigned int scan_height_;
00201 unsigned int depth_img_row_step_;
00202 bool cam_model_update_;
00203 float sensor_mount_height_;
00204 float sensor_tilt_angle_;
00205 bool ground_remove_enable_;
00206 float ground_margin_;
00207 bool tilt_compensation_enable_;
00208
00209
00211 sensor_msgs::LaserScanPtr scan_msg_;
00212
00214 image_geometry::PinholeCameraModel camera_model_;
00215
00217 bool is_scan_msg_configurated_;
00218
00220 std::vector<unsigned int> scan_msg_index_;
00221
00223 std::vector<unsigned int> dist_to_ground_;
00224
00226 std::vector<double> tilt_compensation_factor_;
00227
00228 };
00229 };
00230
00231 #endif