ros/src/dirt_detection/src/dirt_detector.cpp
//The call back for subsciption to 'scan'
The call back for subsciption to 'scan'
The call back for subsciption to ' scan '
void DirtDetector::scanCallBack(const sensor_msgs::LaserScan::ConstPtr &msg)
{
    scan = *msg;
    sensor_range = scan.range_max;
    if(!listener.waitForTransform(msg->header.frame_id,
                                    "map",
                                    msg->header.stamp +
                                        ros::Duration().fromSec(
                                            msg->ranges.size()*msg->time_increment),
                                    ros::Duration(1.0))){
        ROS_INFO("[%s]: wait for transform failed", robot_specifier.c_str());
        return;
    }
    projector.transformLaserScanToPointCloud("map", *msg, cloud, listener, laser_geometry::channel_option::Distance);
    laser_scan = *msg;
    DetectDirt();
}
void DirtDetector :: scanCallBack ( const sensor_msgs :: LaserScan :: ConstPtr & msg ) { scan = * msg ; sensor_range = scan . range_max ; if ( ! listener . waitForTransform ( msg -> header . frame_id , " " , msg -> header . stamp + ros :: Duration ( ) . fromSec ( msg -> ranges . size ( ) * msg -> time_increment ) , ros :: Duration ( 1.0 ) ) ) { ROS_INFO ( " " , robot_specifier . c_str ( ) ) ; return ; } projector . transformLaserScanToPointCloud ( " " , * msg , cloud , listener , laser_geometry :: channel_option :: Distance ) ; laser_scan = * msg ; DetectDirt ( ) ; }
The call back for subsciption to 'scan'
The call back for subsciption to ' scan '