/* * 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. */ #ifndef CARTOGRAPHER_GRPC_CLIENT_MAP_BUILDER_STUB_H_ #define CARTOGRAPHER_GRPC_CLIENT_MAP_BUILDER_STUB_H_ #include #include "cartographer/mapping/map_builder_interface.h" #include "cartographer/mapping/pose_graph_interface.h" #include "cartographer/mapping/trajectory_builder_interface.h" #include "grpc++/grpc++.h" namespace cartographer_grpc { namespace mapping { class MapBuilderStub : public cartographer::mapping::MapBuilderInterface { public: MapBuilderStub(const std::string& server_address); MapBuilderStub(const MapBuilderStub&) = delete; MapBuilderStub& operator=(const MapBuilderStub&) = delete; int AddTrajectoryBuilder( const std::set& expected_sensor_ids, const cartographer::mapping::proto::TrajectoryBuilderOptions& trajectory_options, LocalSlamResultCallback local_slam_result_callback) override; int AddTrajectoryForDeserialization( const cartographer::mapping::proto::TrajectoryBuilderOptionsWithSensorIds& options_with_sensor_ids_proto) override; cartographer::mapping::TrajectoryBuilderInterface* GetTrajectoryBuilder( int trajectory_id) const override; void FinishTrajectory(int trajectory_id) override; std::string SubmapToProto( const cartographer::mapping::SubmapId& submap_id, cartographer::mapping::proto::SubmapQuery::Response* response) override; void SerializeState( cartographer::io::ProtoStreamWriterInterface* writer) override; void LoadState(cartographer::io::ProtoStreamReaderInterface* reader, bool load_frozen_state) override; int num_trajectory_builders() const override; cartographer::mapping::PoseGraphInterface* pose_graph() override; const std::vector< cartographer::mapping::proto::TrajectoryBuilderOptionsWithSensorIds>& GetAllTrajectoryBuilderOptions() const override; private: std::shared_ptr client_channel_; std::unique_ptr pose_graph_stub_; std::map> trajectory_builder_stubs_; }; } // namespace mapping } // namespace cartographer_grpc #endif // CARTOGRAPHER_GRPC_CLIENT_MAP_BUILDER_STUB_H_