00001 /* 00002 * Copyright 2016 The Cartographer Authors 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef CARTOGRAPHER_SENSOR_RANGE_DATA_H_ 00018 #define CARTOGRAPHER_SENSOR_RANGE_DATA_H_ 00019 00020 #include "cartographer/common/port.h" 00021 #include "cartographer/sensor/compressed_point_cloud.h" 00022 #include "cartographer/sensor/point_cloud.h" 00023 #include "cartographer/sensor/proto/sensor.pb.h" 00024 00025 namespace cartographer { 00026 namespace sensor { 00027 00028 // Rays begin at 'origin'. 'returns' are the points where obstructions were 00029 // detected. 'misses' are points in the direction of rays for which no return 00030 // was detected, and were inserted at a configured distance. It is assumed that 00031 // between the 'origin' and 'misses' is free space. 00032 struct RangeData { 00033 Eigen::Vector3f origin; 00034 PointCloud returns; 00035 PointCloud misses; 00036 }; 00037 00038 // Like 'RangeData', but with 'TimedPointClouds'. 00039 struct TimedRangeData { 00040 Eigen::Vector3f origin; 00041 TimedPointCloud returns; 00042 TimedPointCloud misses; 00043 }; 00044 00045 RangeData TransformRangeData(const RangeData& range_data, 00046 const transform::Rigid3f& transform); 00047 00048 TimedRangeData TransformTimedRangeData(const TimedRangeData& range_data, 00049 const transform::Rigid3f& transform); 00050 00051 // Crops 'range_data' according to the region defined by 'min_z' and 'max_z'. 00052 RangeData CropRangeData(const RangeData& range_data, float min_z, float max_z); 00053 00054 // Crops 'range_data' according to the region defined by 'min_z' and 'max_z'. 00055 TimedRangeData CropTimedRangeData(const TimedRangeData& range_data, float min_z, 00056 float max_z); 00057 00058 // Converts 'range_data' to a proto::RangeData. 00059 proto::RangeData ToProto(const RangeData& range_data); 00060 00061 // Converts 'proto' to RangeData. 00062 RangeData FromProto(const proto::RangeData& proto); 00063 00064 } // namespace sensor 00065 } // namespace cartographer 00066 00067 #endif // CARTOGRAPHER_SENSOR_RANGE_DATA_H_