原驱动代码
for( std::size_t i=0; i<scandata.distance_data.size(); i++ ) { scanmsg.ranges[i] = float(scandata.distance_data[i])/1000.0f; scanmsg.intensities[i] = scandata.amplitude_data[i]; } scan_publisher_.publish(scanmsg); }
修改角度(逆时针)后
for( std::size_t i=0; i<scandata.distance_data.size(); i++ ) { scanmsg.ranges[i] = float(scandata.distance_data[i])/1000.0f; if(i<10||i>(1440-10)) scanmsg.ranges[i] = std::numeric_limits<float>::infinity(); scanmsg.intensities[i] = scandata.amplitude_data[i]; } scan_publisher_.publish(scanmsg); }