Closed DYFeng closed 3 years ago
LaserScan is a standard ROS message type. The angle precision of LaserFan message type will not be lost, and LaserScan will lose the angle precision:
for(size_t i=0; i < scan.points.size(); i++) {
// Convert angle to index will cause angle precision loss
int index = std::ceil((scan.points[i].angle - scan.config.min_angle)/scan.config.angle_increment);
if(index >=0 && index < size) {
if(scan.points[i].range >= scan.config.min_range) {
scan_msg.ranges[index] = scan.points[i].range;
scan_msg.intensities[index] = scan.points[i].intensity;
}
}
// Keep the original angle
fan.angles.push_back(scan.points[i].angle);
fan.ranges.push_back(scan.points[i].range);
fan.intensities.push_back(scan.points[i].intensity);
}
What's the point of creating a new message type LaserFan?