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_INTERNAL_CLIENT_TRAJECTORY_BUILDER_STUB_H_
|
|
|
|
#define CARTOGRAPHER_GRPC_INTERNAL_CLIENT_TRAJECTORY_BUILDER_STUB_H_
|
2017-12-13 22:53:47 +08:00
|
|
|
|
2017-12-20 19:42:27 +08:00
|
|
|
#include <thread>
|
|
|
|
|
2018-01-11 17:19:37 +08:00
|
|
|
#include "cartographer/mapping/local_slam_result_data.h"
|
2017-12-13 22:53:47 +08:00
|
|
|
#include "cartographer/mapping/trajectory_builder_interface.h"
|
2018-03-02 21:16:49 +08:00
|
|
|
#include "cartographer_grpc/internal/framework/client.h"
|
2018-03-02 18:38:35 +08:00
|
|
|
#include "cartographer_grpc/internal/handlers/add_fixed_frame_pose_data_handler.h"
|
|
|
|
#include "cartographer_grpc/internal/handlers/add_imu_data_handler.h"
|
|
|
|
#include "cartographer_grpc/internal/handlers/add_landmark_data_handler.h"
|
|
|
|
#include "cartographer_grpc/internal/handlers/add_local_slam_result_data_handler.h"
|
|
|
|
#include "cartographer_grpc/internal/handlers/add_odometry_data_handler.h"
|
|
|
|
#include "cartographer_grpc/internal/handlers/add_rangefinder_data_handler.h"
|
|
|
|
#include "cartographer_grpc/internal/handlers/receive_local_slam_results_handler.h"
|
2017-12-13 22:53:47 +08:00
|
|
|
#include "grpc++/grpc++.h"
|
2018-03-02 01:30:30 +08:00
|
|
|
#include "pose_graph_stub.h"
|
|
|
|
#include "trajectory_builder_stub.h"
|
2017-12-13 22:53:47 +08:00
|
|
|
|
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 TrajectoryBuilderStub : public mapping::TrajectoryBuilderInterface {
|
2017-12-13 22:53:47 +08:00
|
|
|
public:
|
2018-03-03 06:21:28 +08:00
|
|
|
TrajectoryBuilderStub(std::shared_ptr<::grpc::Channel> client_channel,
|
2017-12-20 19:42:27 +08:00
|
|
|
const int trajectory_id,
|
|
|
|
LocalSlamResultCallback local_slam_result_callback);
|
2017-12-18 18:24:16 +08:00
|
|
|
~TrajectoryBuilderStub() override;
|
2017-12-13 22:53:47 +08:00
|
|
|
TrajectoryBuilderStub(const TrajectoryBuilderStub&) = delete;
|
|
|
|
TrajectoryBuilderStub& operator=(const TrajectoryBuilderStub&) = delete;
|
|
|
|
|
|
|
|
void AddSensorData(
|
|
|
|
const std::string& sensor_id,
|
2018-03-03 06:21:28 +08:00
|
|
|
const sensor::TimedPointCloudData& timed_point_cloud_data) override;
|
2017-12-13 22:53:47 +08:00
|
|
|
void AddSensorData(const std::string& sensor_id,
|
2018-03-03 06:21:28 +08:00
|
|
|
const sensor::ImuData& imu_data) override;
|
|
|
|
void AddSensorData(const std::string& sensor_id,
|
|
|
|
const sensor::OdometryData& odometry_data) override;
|
2018-01-19 16:41:24 +08:00
|
|
|
void AddSensorData(
|
|
|
|
const std::string& sensor_id,
|
2018-03-03 06:21:28 +08:00
|
|
|
const sensor::FixedFramePoseData& fixed_frame_pose) override;
|
|
|
|
void AddSensorData(const std::string& sensor_id,
|
|
|
|
const sensor::LandmarkData& landmark_data) override;
|
|
|
|
void AddLocalSlamResultData(std::unique_ptr<mapping::LocalSlamResultData>
|
|
|
|
local_slam_result_data) override;
|
2017-12-13 22:53:47 +08:00
|
|
|
|
|
|
|
private:
|
2018-02-02 00:19:15 +08:00
|
|
|
static void RunLocalSlamResultsReader(
|
|
|
|
framework::Client<handlers::ReceiveLocalSlamResultsHandler>*
|
|
|
|
client_reader,
|
2017-12-20 19:42:27 +08:00
|
|
|
LocalSlamResultCallback local_slam_result_callback);
|
2017-12-18 18:24:16 +08:00
|
|
|
|
2018-03-03 06:21:28 +08:00
|
|
|
std::shared_ptr<::grpc::Channel> client_channel_;
|
2017-12-18 18:24:16 +08:00
|
|
|
const int trajectory_id_;
|
2018-02-02 00:19:15 +08:00
|
|
|
std::unique_ptr<framework::Client<handlers::AddRangefinderDataHandler>>
|
|
|
|
add_rangefinder_client_;
|
|
|
|
std::unique_ptr<framework::Client<handlers::AddImuDataHandler>>
|
|
|
|
add_imu_client_;
|
|
|
|
std::unique_ptr<framework::Client<handlers::AddOdometryDataHandler>>
|
|
|
|
add_odometry_client_;
|
|
|
|
std::unique_ptr<framework::Client<handlers::AddFixedFramePoseDataHandler>>
|
|
|
|
add_fixed_frame_pose_client_;
|
|
|
|
std::unique_ptr<framework::Client<handlers::AddLandmarkDataHandler>>
|
|
|
|
add_landmark_client_;
|
|
|
|
framework::Client<handlers::ReceiveLocalSlamResultsHandler>
|
|
|
|
receive_local_slam_results_client_;
|
|
|
|
std::unique_ptr<std::thread> receive_local_slam_results_thread_;
|
2017-12-13 22:53:47 +08:00
|
|
|
};
|
|
|
|
|
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_INTERNAL_CLIENT_TRAJECTORY_BUILDER_STUB_H_
|