sensor/internal/test_helpers.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016 The Cartographer Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CARTOGRAPHER_SENSOR_INTERNAL_TEST_HELPERS_H_
18 #define CARTOGRAPHER_SENSOR_INTERNAL_TEST_HELPERS_H_
19 
20 #include <string>
21 #include <tuple>
22 
30 #include "gmock/gmock.h"
31 
32 namespace cartographer {
33 namespace sensor {
34 
35 MATCHER_P(Near, point, std::string(negation ? "Doesn't" : "Does") + " match.") {
36  return arg.isApprox(point, 0.001f);
37 }
38 
39 namespace test {
40 
41 typedef std::tuple<int /* trajectory_id */, std::string /* sensor_id */,
44 
45 struct CollatorInput {
47  const std::string& sensor_id, int time) {
48  return CollatorInput{
52  }
54  const std::string& sensor_id,
55  int time) {
56  return CollatorInput{
59  sensor_id,
61  common::FromUniversal(time), Eigen::Vector3f::Zero(), {}}),
63  }
65  const std::string& sensor_id,
66  int time) {
67  return CollatorInput{
69  MakeDispatchable(sensor_id,
73  }
75  collator->AddSensorData(trajectory_id, std::move(data));
76  }
77 
78  const int trajectory_id;
79  std::unique_ptr<sensor::Data> data;
81 };
82 
83 } // namespace test
84 } // namespace sensor
85 } // namespace cartographer
86 
87 #endif // CARTOGRAPHER_SENSOR_INTERNAL_TEST_HELPERS_H_
static CollatorInput CreateImuData(int trajectory_id, const std::string &sensor_id, int time)
void MoveToCollator(CollatorInterface *collator)
virtual void AddSensorData(int trajectory_id, std::unique_ptr< Data > data)=0
static CollatorInput CreateTimedPointCloudData(int trajectory_id, const std::string &sensor_id, int time)
UniversalTimeScaleClock::time_point Time
Definition: time.h:44
Time FromUniversal(const int64 ticks)
Definition: time.cc:34
static time_point time
static CollatorInput CreateOdometryData(int trajectory_id, const std::string &sensor_id, int time)
MATCHER_P(Near, point, std::string(negation ? "Doesn't" :"Does")+" match.")
std::unique_ptr< Dispatchable< DataType > > MakeDispatchable(const std::string &sensor_id, const DataType &data)
Definition: dispatchable.h:44
std::tuple< int, std::string, common::Time > CollatorOutput


cartographer
Author(s): The Cartographer Authors
autogenerated on Mon Feb 28 2022 22:00:58