17 #ifndef CARTOGRAPHER_CLOUD_INTERNAL_MAP_BUILDER_SERVER_H 18 #define CARTOGRAPHER_CLOUD_INTERNAL_MAP_BUILDER_SERVER_H 20 #include "async_grpc/execution_context.h" 21 #include "async_grpc/server.h" 25 #include "cartographer/cloud/proto/map_builder_server_options.pb.h" 40 class MapBuilderServer;
42 template <
class SubmapType>
62 std::unique_ptr<sensor::Data> data)
override;
64 const std::string& sensor_id,
65 const mapping::proto::LocalSlamResultData&
66 local_slam_result_data)
override;
79 const proto::MapBuilderServerOptions& map_builder_server_options,
80 std::unique_ptr<mapping::MapBuilderInterface>
map_builder);
89 void WaitForShutdown()
final;
92 void WaitUntilIdle()
final;
96 void Shutdown()
final;
105 void ProcessSensorDataQueue();
106 void StartSlamThread();
107 void OnLocalSlamResult(
113 void OnGlobalSlamOptimizations(
114 const std::map<int, mapping::SubmapId>& last_optimized_submap_ids,
115 const std::map<int, mapping::NodeId>& last_optimized_node_ids);
134 int current_subscription_index_ = 0;
136 local_slam_subscriptions_
GUARDED_BY(subscriptions_lock_);
139 global_slam_subscriptions_
GUARDED_BY(subscriptions_lock_);
141 int starting_submap_index_ = 0;
149 #endif // CARTOGRAPHER_CLOUD_INTERNAL_MAP_BUILDER_SERVER_H
mapping::TrajectoryBuilderInterface::LocalSlamResultCallback GetLocalSlamResultCallbackForSubscriptions() override
void AddSensorDataToTrajectory(const Data &sensor_data) override
std::unique_ptr< mapping::MapBuilderInterface > map_builder_
void UnsubscribeGlobalSlamOptimizations(int subscription_index) override
void NotifyFinishTrajectory(int trajectory_id) override
std::function< bool(std::unique_ptr< LocalSlamResult >)> LocalSlamSubscriptionCallback
std::function< bool(const std::map< int, mapping::SubmapId > &, const std::map< int, mapping::NodeId > &)> GlobalSlamOptimizationCallback
MapBuilderContextInterface::LocalSlamSubscriptionId SubscribeLocalSlamResults(int trajectory_id, LocalSlamSubscriptionCallback callback) override
std::unique_ptr< async_grpc::Server > grpc_server_
UniversalTimeScaleClock::time_point Time
std::unique_ptr< LocalTrajectoryUploaderInterface > local_trajectory_uploader_
mapping::MapBuilderInterface & map_builder() override
MapBuilderContext(MapBuilderServer *map_builder_server)
common::BlockingQueue< std::unique_ptr< MapBuilderContextInterface::Data > > & sensor_data_queue() override
std::unique_ptr< std::thread > slam_thread_
LocalTrajectoryUploaderInterface * local_trajectory_uploader() override
void EnqueueSensorData(int trajectory_id, std::unique_ptr< sensor::Data > data) override
void UnsubscribeLocalSlamResults(const LocalSlamSubscriptionId &subscription_id) override
common::BlockingQueue< std::unique_ptr< MapBuilderContextInterface::Data > > incoming_data_queue_
std::map< int, MapBuilderContextInterface::LocalSlamSubscriptionCallback > LocalSlamResultHandlerSubscriptions
int SubscribeGlobalSlamOptimizations(GlobalSlamOptimizationCallback callback) override
mapping::SubmapController< SubmapType > submap_controller_
MapBuilderServer * map_builder_server_
common::Mutex subscriptions_lock_
void EnqueueLocalSlamResultData(int trajectory_id, const std::string &sensor_id, const mapping::proto::LocalSlamResultData &local_slam_result_data) override
std::function< void(int, common::Time, transform::Rigid3d, sensor::RangeData, std::unique_ptr< const InsertionResult >)> LocalSlamResultCallback