20 #include "cartographer/cloud/proto/map_builder_service.pb.h" 23 #include "glog/logging.h" 29 std::shared_ptr<::grpc::Channel> client_channel,
const int trajectory_id,
34 if (local_slam_result_callback) {
35 proto::ReceiveLocalSlamResultsRequest request;
36 request.set_trajectory_id(trajectory_id);
38 auto* receive_local_slam_results_client_ptr =
41 [receive_local_slam_results_client_ptr, local_slam_result_callback]() {
43 local_slam_result_callback);
75 const std::string& sensor_id,
79 async_grpc::Client<handlers::AddRangefinderDataSignature>>(
82 proto::AddRangefinderDataRequest request;
93 common::make_unique<async_grpc::Client<handlers::AddImuDataSignature>>(
96 proto::AddImuDataRequest request;
106 async_grpc::Client<handlers::AddOdometryDataSignature>>(
109 proto::AddOdometryDataRequest request;
116 const std::string& sensor_id,
120 async_grpc::Client<handlers::AddFixedFramePoseDataSignature>>(
123 proto::AddFixedFramePoseDataRequest request;
133 async_grpc::Client<handlers::AddLandmarkDataSignature>>(
136 proto::AddLandmarkDataRequest request;
143 std::unique_ptr<mapping::LocalSlamResultData> local_slam_result_data) {
144 LOG(FATAL) <<
"Not implemented";
148 async_grpc::Client<handlers::ReceiveLocalSlamResultsSignature>* client,
150 proto::ReceiveLocalSlamResultsResponse response;
151 while (client->StreamRead(&response)) {
152 int trajectory_id = response.trajectory_id();
156 auto insertion_result =
157 response.has_insertion_result()
158 ? common::make_unique<InsertionResult>(
161 response.insertion_result().node_id().node_index()}})
163 local_slam_result_callback(trajectory_id, time, local_pose, range_data,
164 std::move(insertion_result));
166 client->StreamFinish();
~TrajectoryBuilderStub() override
std::unique_ptr< async_grpc::Client< handlers::AddFixedFramePoseDataSignature > > add_fixed_frame_pose_client_
_Unique_if< T >::_Single_object make_unique(Args &&... args)
std::unique_ptr< async_grpc::Client< handlers::AddImuDataSignature > > add_imu_client_
void AddSensorData(const std::string &sensor_id, const sensor::TimedPointCloudData &timed_point_cloud_data) override
void CreateAddRangeFinderDataRequest(const std::string &sensor_id, int trajectory_id, const sensor::proto::TimedPointCloudData &timed_point_cloud_data, proto::AddRangefinderDataRequest *proto)
proto::FixedFramePoseData ToProto(const FixedFramePoseData &pose_data)
FixedFramePoseData FromProto(const proto::FixedFramePoseData &proto)
UniversalTimeScaleClock::time_point Time
std::unique_ptr< async_grpc::Client< handlers::AddLandmarkDataSignature > > add_landmark_client_
Time FromUniversal(const int64 ticks)
std::shared_ptr<::grpc::Channel > client_channel_
void AddLocalSlamResultData(std::unique_ptr< mapping::LocalSlamResultData > local_slam_result_data) override
static void RunLocalSlamResultsReader(async_grpc::Client< handlers::ReceiveLocalSlamResultsSignature > *client_reader, LocalSlamResultCallback local_slam_result_callback)
async_grpc::Client< handlers::ReceiveLocalSlamResultsSignature > receive_local_slam_results_client_
void CreateAddOdometryDataRequest(const std::string &sensor_id, int trajectory_id, const sensor::proto::OdometryData &odometry_data, proto::AddOdometryDataRequest *proto)
std::unique_ptr< async_grpc::Client< handlers::AddRangefinderDataSignature > > add_rangefinder_client_
std::unique_ptr< async_grpc::Client< handlers::AddOdometryDataSignature > > add_odometry_client_
std::unique_ptr< std::thread > receive_local_slam_results_thread_
void CreateAddFixedFramePoseDataRequest(const std::string &sensor_id, int trajectory_id, const sensor::proto::FixedFramePoseData &fixed_frame_pose_data, proto::AddFixedFramePoseDataRequest *proto)
void CreateAddLandmarkDataRequest(const std::string &sensor_id, int trajectory_id, const sensor::proto::LandmarkData &landmark_data, proto::AddLandmarkDataRequest *proto)
void CreateAddImuDataRequest(const std::string &sensor_id, const int trajectory_id, const sensor::proto::ImuData &imu_data, proto::AddImuDataRequest *proto)
std::shared_ptr<::grpc::Channel > client_channel_
TrajectoryBuilderStub(std::shared_ptr<::grpc::Channel > client_channel, const int trajectory_id, LocalSlamResultCallback local_slam_result_callback)
std::function< void(int, common::Time, transform::Rigid3d, sensor::RangeData, std::unique_ptr< const InsertionResult >)> LocalSlamResultCallback