src/walker.cpp
/**
 *Laserscan callback function to subscribe the topic
 */
Laserscan callback function to subscribe the topic
Laserscan callback function to subscribe the topic
void walker::laserScanCallback(const sensor_msgs::LaserScan::ConstPtr& msg) {
    for (auto i = 0; i < msg->ranges.size(); ++i) {
        if (msg->ranges[i] < 2) {
            range = true;
            ROS_DEBUG_STREAM("Range " << msg->ranges[i] << " less than 2m");
            return;
        }
    }
    range = false;
    ROS_DEBUG_STREAM("No obstacles in range");
    return;
}
void walker :: laserScanCallback ( const sensor_msgs :: LaserScan :: ConstPtr & msg ) { for ( auto i = 0 ; i < msg -> ranges . size ( ) ; ++ i ) { if ( msg -> ranges [ i ] < 2 ) { range = true ; ROS_DEBUG_STREAM ( " " << msg -> ranges [ i ] << " " ) ; return ; } } range = false ; ROS_DEBUG_STREAM ( " " ) ; return ; }
Laserscan callback function to subscribe the topic
Laserscan callback function to subscribe the topic