19 #include "async_grpc/rpc_handler.h" 21 #include "cartographer/cloud/proto/map_builder_service.pb.h" 26 #include "google/protobuf/empty.pb.h" 32 void AddSensorDataBatchHandler::OnRequest(
33 const proto::AddSensorDataBatchRequest& request) {
34 for (
const proto::SensorData& sensor_data : request.sensor_data()) {
35 switch (sensor_data.sensor_data_case()) {
36 case proto::SensorData::kOdometryData:
37 GetUnsynchronizedContext<MapBuilderContextInterface>()
39 sensor_data.sensor_metadata().trajectory_id(),
41 sensor_data.sensor_metadata().sensor_id(),
44 case proto::SensorData::kImuData:
45 GetUnsynchronizedContext<MapBuilderContextInterface>()
46 ->EnqueueSensorData(sensor_data.sensor_metadata().trajectory_id(),
48 sensor_data.sensor_metadata().sensor_id(),
51 case proto::SensorData::kTimedPointCloudData:
52 GetUnsynchronizedContext<MapBuilderContextInterface>()
54 sensor_data.sensor_metadata().trajectory_id(),
56 sensor_data.sensor_metadata().sensor_id(),
59 case proto::SensorData::kFixedFramePoseData:
60 GetUnsynchronizedContext<MapBuilderContextInterface>()
62 sensor_data.sensor_metadata().trajectory_id(),
64 sensor_data.sensor_metadata().sensor_id(),
67 case proto::SensorData::kLandmarkData:
68 GetUnsynchronizedContext<MapBuilderContextInterface>()
70 sensor_data.sensor_metadata().trajectory_id(),
72 sensor_data.sensor_metadata().sensor_id(),
75 case proto::SensorData::kLocalSlamResultData:
76 GetContext<MapBuilderContextInterface>()->EnqueueLocalSlamResultData(
77 sensor_data.sensor_metadata().trajectory_id(),
78 sensor_data.sensor_metadata().sensor_id(),
79 sensor_data.local_slam_result_data());
82 LOG(FATAL) <<
"Unknown sensor data type: " 83 << sensor_data.sensor_data_case();
86 Send(common::make_unique<google::protobuf::Empty>());
FixedFramePoseData FromProto(const proto::FixedFramePoseData &proto)
std::unique_ptr< Dispatchable< DataType > > MakeDispatchable(const std::string &sensor_id, const DataType &data)