Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "cartographer/sensor/point_cloud.h"
00018
00019 #include "cartographer/sensor/proto/sensor.pb.h"
00020 #include "cartographer/transform/transform.h"
00021
00022 namespace cartographer {
00023 namespace sensor {
00024
00025 PointCloud TransformPointCloud(const PointCloud& point_cloud,
00026 const transform::Rigid3f& transform) {
00027 PointCloud result;
00028 result.reserve(point_cloud.size());
00029 for (const RangefinderPoint& point : point_cloud) {
00030 result.emplace_back(transform * point);
00031 }
00032 return result;
00033 }
00034
00035 TimedPointCloud TransformTimedPointCloud(const TimedPointCloud& point_cloud,
00036 const transform::Rigid3f& transform) {
00037 TimedPointCloud result;
00038 result.reserve(point_cloud.size());
00039 for (const TimedRangefinderPoint& point : point_cloud) {
00040 result.push_back(transform * point);
00041 }
00042 return result;
00043 }
00044
00045 PointCloud CropPointCloud(const PointCloud& point_cloud, const float min_z,
00046 const float max_z) {
00047 PointCloud cropped_point_cloud;
00048 for (const RangefinderPoint& point : point_cloud) {
00049 if (min_z <= point.position.z() && point.position.z() <= max_z) {
00050 cropped_point_cloud.push_back(point);
00051 }
00052 }
00053 return cropped_point_cloud;
00054 }
00055
00056 TimedPointCloud CropTimedPointCloud(const TimedPointCloud& point_cloud,
00057 const float min_z, const float max_z) {
00058 TimedPointCloud cropped_point_cloud;
00059 for (const TimedRangefinderPoint& point : point_cloud) {
00060 if (min_z <= point.position.z() && point.position.z() <= max_z) {
00061 cropped_point_cloud.push_back(point);
00062 }
00063 }
00064 return cropped_point_cloud;
00065 }
00066
00067 }
00068 }