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_IO_POINTS_BATCH_H_ 00018 #define CARTOGRAPHER_IO_POINTS_BATCH_H_ 00019 00020 #include <array> 00021 #include <cstdint> 00022 #include <vector> 00023 00024 #include "Eigen/Core" 00025 #include "absl/container/flat_hash_set.h" 00026 #include "cartographer/common/time.h" 00027 #include "cartographer/io/color.h" 00028 #include "cartographer/sensor/point_cloud.h" 00029 00030 namespace cartographer { 00031 namespace io { 00032 00033 // A number of points, captured around the same 'time' and by a 00034 // sensor at the same 'origin'. 00035 struct PointsBatch { 00036 PointsBatch() { 00037 origin = Eigen::Vector3f::Zero(); 00038 trajectory_id = 0; 00039 } 00040 00041 // Time at which the first point of this batch has been acquired. 00042 common::Time start_time; 00043 00044 // Origin of the data, i.e. the location of the sensor in the world at 00045 // 'time'. 00046 Eigen::Vector3f origin; 00047 00048 // Sensor that generated this data's 'frame_id' or empty if this information 00049 // is unknown. 00050 std::string frame_id; 00051 00052 // Trajectory ID that produced this point. 00053 int trajectory_id; 00054 00055 // Geometry of the points in the map frame. 00056 sensor::PointCloud points; 00057 00058 // Intensities are optional and may be unspecified. The meaning of these 00059 // intensity values varies by device. For example, the VLP16 provides values 00060 // in the range [0, 100] for non-specular return values and values up to 255 00061 // for specular returns. On the other hand, Hokuyo lasers provide a 16-bit 00062 // value that rarely peaks above 4096. 00063 std::vector<float> intensities; 00064 00065 // Colors are optional. If set, they are RGB values. 00066 std::vector<FloatColor> colors; 00067 }; 00068 00069 // Removes the indices in 'to_remove' from 'batch'. 00070 void RemovePoints(absl::flat_hash_set<int> to_remove, PointsBatch* batch); 00071 00072 } // namespace io 00073 } // namespace cartographer 00074 00075 #endif // CARTOGRAPHER_IO_POINTS_BATCH_H_