2017-12-13 22:53:47 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2017 The Cartographer Authors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2018-03-02 01:30:30 +08:00
|
|
|
#ifndef CARTOGRAPHER_GRPC_CLIENT_MAP_BUILDER_STUB_H_
|
|
|
|
#define CARTOGRAPHER_GRPC_CLIENT_MAP_BUILDER_STUB_H_
|
2017-12-13 22:53:47 +08:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "cartographer/mapping/map_builder_interface.h"
|
2018-03-02 01:30:30 +08:00
|
|
|
#include "cartographer/mapping/pose_graph_interface.h"
|
|
|
|
#include "cartographer/mapping/trajectory_builder_interface.h"
|
2017-12-13 22:53:47 +08:00
|
|
|
#include "grpc++/grpc++.h"
|
|
|
|
|
2018-03-03 06:21:28 +08:00
|
|
|
namespace cartographer {
|
|
|
|
namespace cloud {
|
2017-12-13 22:53:47 +08:00
|
|
|
|
2018-03-03 06:21:28 +08:00
|
|
|
class MapBuilderStub : public mapping::MapBuilderInterface {
|
2017-12-13 22:53:47 +08:00
|
|
|
public:
|
|
|
|
MapBuilderStub(const std::string& server_address);
|
|
|
|
|
|
|
|
MapBuilderStub(const MapBuilderStub&) = delete;
|
|
|
|
MapBuilderStub& operator=(const MapBuilderStub&) = delete;
|
|
|
|
|
|
|
|
int AddTrajectoryBuilder(
|
2018-01-26 22:07:49 +08:00
|
|
|
const std::set<SensorId>& expected_sensor_ids,
|
2018-03-03 06:21:28 +08:00
|
|
|
const mapping::proto::TrajectoryBuilderOptions& trajectory_options,
|
2017-12-13 22:53:47 +08:00
|
|
|
LocalSlamResultCallback local_slam_result_callback) override;
|
2018-02-05 16:45:43 +08:00
|
|
|
int AddTrajectoryForDeserialization(
|
2018-03-03 06:21:28 +08:00
|
|
|
const mapping::proto::TrajectoryBuilderOptionsWithSensorIds&
|
2018-02-05 16:45:43 +08:00
|
|
|
options_with_sensor_ids_proto) override;
|
2018-03-03 06:21:28 +08:00
|
|
|
mapping::TrajectoryBuilderInterface* GetTrajectoryBuilder(
|
2017-12-13 22:53:47 +08:00
|
|
|
int trajectory_id) const override;
|
|
|
|
void FinishTrajectory(int trajectory_id) override;
|
|
|
|
std::string SubmapToProto(
|
2018-03-03 06:21:28 +08:00
|
|
|
const mapping::SubmapId& submap_id,
|
|
|
|
mapping::proto::SubmapQuery::Response* response) override;
|
|
|
|
void SerializeState(io::ProtoStreamWriterInterface* writer) override;
|
|
|
|
void LoadState(io::ProtoStreamReaderInterface* reader,
|
2018-02-28 03:38:57 +08:00
|
|
|
bool load_frozen_state) override;
|
2017-12-13 22:53:47 +08:00
|
|
|
int num_trajectory_builders() const override;
|
2018-03-03 06:21:28 +08:00
|
|
|
mapping::PoseGraphInterface* pose_graph() override;
|
|
|
|
const std::vector<mapping::proto::TrajectoryBuilderOptionsWithSensorIds>&
|
2018-02-05 16:45:43 +08:00
|
|
|
GetAllTrajectoryBuilderOptions() const override;
|
2017-12-13 22:53:47 +08:00
|
|
|
|
|
|
|
private:
|
2018-03-03 06:21:28 +08:00
|
|
|
std::shared_ptr<::grpc::Channel> client_channel_;
|
|
|
|
std::unique_ptr<mapping::PoseGraphInterface> pose_graph_stub_;
|
|
|
|
std::map<int, std::unique_ptr<mapping::TrajectoryBuilderInterface>>
|
2017-12-13 22:53:47 +08:00
|
|
|
trajectory_builder_stubs_;
|
|
|
|
};
|
|
|
|
|
2018-03-03 06:21:28 +08:00
|
|
|
} // namespace cloud
|
|
|
|
} // namespace cartographer
|
2017-12-13 22:53:47 +08:00
|
|
|
|
2018-03-02 01:30:30 +08:00
|
|
|
#endif // CARTOGRAPHER_GRPC_CLIENT_MAP_BUILDER_STUB_H_
|