2018-02-01 02:22:08 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2018 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_MAP_BUILDER_CONTEXT_H
|
|
|
|
#define CARTOGRAPHER_GRPC_MAP_BUILDER_CONTEXT_H
|
|
|
|
|
2018-02-27 00:40:29 +08:00
|
|
|
#include "cartographer/mapping/2d/submap_2d.h"
|
|
|
|
#include "cartographer/mapping/3d/submap_3d.h"
|
2018-03-02 21:16:49 +08:00
|
|
|
#include "cartographer_grpc/internal/map_builder_context_interface.h"
|
2018-02-01 02:22:08 +08:00
|
|
|
|
2018-03-03 06:21:28 +08:00
|
|
|
namespace cartographer {
|
|
|
|
namespace cloud {
|
2018-02-01 02:22:08 +08:00
|
|
|
|
|
|
|
class MapBuilderContext : public MapBuilderContextInterface {
|
|
|
|
public:
|
|
|
|
MapBuilderContext(MapBuilderServer* map_builder_server);
|
2018-03-03 06:21:28 +08:00
|
|
|
mapping::MapBuilderInterface& map_builder() override;
|
|
|
|
common::BlockingQueue<std::unique_ptr<Data>>& sensor_data_queue() override;
|
|
|
|
mapping::TrajectoryBuilderInterface::LocalSlamResultCallback
|
2018-02-01 02:22:08 +08:00
|
|
|
GetLocalSlamResultCallbackForSubscriptions() override;
|
|
|
|
void AddSensorDataToTrajectory(const Data& sensor_data) override;
|
|
|
|
SubscriptionId SubscribeLocalSlamResults(
|
|
|
|
int trajectory_id, LocalSlamSubscriptionCallback callback) override;
|
|
|
|
void UnsubscribeLocalSlamResults(
|
|
|
|
const SubscriptionId& subscription_id) override;
|
|
|
|
void NotifyFinishTrajectory(int trajectory_id) override;
|
2018-03-03 06:21:28 +08:00
|
|
|
std::unique_ptr<mapping::LocalSlamResultData> ProcessLocalSlamResultData(
|
|
|
|
const std::string& sensor_id, common::Time time,
|
|
|
|
const mapping::proto::LocalSlamResultData& proto) override;
|
2018-02-01 20:05:08 +08:00
|
|
|
LocalTrajectoryUploaderInterface* local_trajectory_uploader() override;
|
2018-03-03 06:21:28 +08:00
|
|
|
void EnqueueSensorData(int trajectory_id,
|
|
|
|
std::unique_ptr<sensor::Data> data) override;
|
|
|
|
void EnqueueLocalSlamResultData(int trajectory_id,
|
|
|
|
const std::string& sensor_id,
|
|
|
|
std::unique_ptr<mapping::LocalSlamResultData>
|
|
|
|
local_slam_result_data) override;
|
2018-02-01 02:22:08 +08:00
|
|
|
|
|
|
|
private:
|
2018-03-03 06:21:28 +08:00
|
|
|
std::shared_ptr<mapping::Submap2D> UpdateSubmap2D(
|
|
|
|
const mapping::proto::Submap& proto);
|
|
|
|
std::shared_ptr<mapping::Submap3D> UpdateSubmap3D(
|
|
|
|
const mapping::proto::Submap& proto);
|
2018-02-01 02:22:08 +08:00
|
|
|
|
|
|
|
MapBuilderServer* map_builder_server_;
|
2018-03-03 06:21:28 +08:00
|
|
|
mapping::MapById<mapping::SubmapId, std::shared_ptr<mapping::Submap>>
|
2018-02-01 02:22:08 +08:00
|
|
|
unfinished_submaps_;
|
|
|
|
};
|
|
|
|
|
2018-03-03 06:21:28 +08:00
|
|
|
} // namespace cloud
|
|
|
|
} // namespace cartographer
|
2018-02-01 02:22:08 +08:00
|
|
|
|
2018-02-01 20:05:08 +08:00
|
|
|
#endif // CARTOGRAPHER_GRPC_MAP_BUILDER_CONTEXT_H
|