local_trajectory_uploader.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2018 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_CLOUD_INTERNAL_LOCAL_TRAJECTORY_UPLOADER_H
00018 #define CARTOGRAPHER_CLOUD_INTERNAL_LOCAL_TRAJECTORY_UPLOADER_H
00019 
00020 #include <memory>
00021 #include <set>
00022 #include <string>
00023 
00024 #include "cartographer/cloud/proto/map_builder_service.pb.h"
00025 #include "cartographer/mapping/proto/trajectory_builder_options.pb.h"
00026 #include "cartographer/mapping/trajectory_builder_interface.h"
00027 #include "grpc++/support/status.h"
00028 
00029 namespace cartographer {
00030 namespace cloud {
00031 
00032 // Uploads sensor data batches to uplink server.
00033 // Gracefully handles interruptions of the connection.
00034 class LocalTrajectoryUploaderInterface {
00035  public:
00036   using SensorId = mapping::TrajectoryBuilderInterface::SensorId;
00037 
00038   virtual ~LocalTrajectoryUploaderInterface() = default;
00039 
00040   // Starts the upload thread.
00041   virtual void Start() = 0;
00042 
00043   // Shuts down the upload thread. This method blocks until the shutdown is
00044   // complete.
00045   virtual void Shutdown() = 0;
00046 
00047   // Enqueue an Add*DataRequest message to be uploaded.
00048   virtual void EnqueueSensorData(
00049       std::unique_ptr<proto::SensorData> sensor_data) = 0;
00050 
00051   // Creates a new trajectory with the specified settings in the uplink. A
00052   // return 'value' with '!value.ok()' indicates that the creation failed.
00053   virtual grpc::Status AddTrajectory(
00054       const std::string& client_id, int local_trajectory_id,
00055       const std::set<SensorId>& expected_sensor_ids,
00056       const mapping::proto::TrajectoryBuilderOptions& trajectory_options) = 0;
00057 
00058   virtual grpc::Status FinishTrajectory(const std::string& client_id,
00059                                         int local_trajectory_id) = 0;
00060   virtual SensorId GetLocalSlamResultSensorId(
00061       int local_trajectory_id) const = 0;
00062 };
00063 
00064 // Returns LocalTrajectoryUploader with the actual implementation.
00065 std::unique_ptr<LocalTrajectoryUploaderInterface> CreateLocalTrajectoryUploader(
00066     const std::string& uplink_server_address, int batch_size,
00067     bool enable_ssl_encryption, bool enable_google_auth);
00068 
00069 }  // namespace cloud
00070 }  // namespace cartographer
00071 
00072 #endif  // CARTOGRAPHER_CLOUD_INTERNAL_LOCAL_TRAJECTORY_UPLOADER_H


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:35