add_sensor_data_batch_handler.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2018 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef CARTOGRAPHER_CLOUD_INTERNAL_HANDLERS_ADD_SENSOR_DATA_BATCH_HANDLER_H
00018 #define CARTOGRAPHER_CLOUD_INTERNAL_HANDLERS_ADD_SENSOR_DATA_BATCH_HANDLER_H
00019 
00020 #include <memory>
00021 #include <string>
00022 
00023 #include "absl/container/flat_hash_map.h"
00024 #include "async_grpc/rpc_handler.h"
00025 #include "cartographer/cloud/proto/map_builder_service.pb.h"
00026 #include "cartographer/metrics/counter.h"
00027 #include "cartographer/metrics/family_factory.h"
00028 #include "google/protobuf/empty.pb.h"
00029 
00030 namespace cartographer {
00031 namespace cloud {
00032 namespace handlers {
00033 
00034 DEFINE_HANDLER_SIGNATURE(
00035     AddSensorDataBatchSignature, proto::AddSensorDataBatchRequest,
00036     google::protobuf::Empty,
00037     "/cartographer.cloud.proto.MapBuilderService/AddSensorDataBatch")
00038 
00039 class AddSensorDataBatchHandler
00040     : public async_grpc::RpcHandler<AddSensorDataBatchSignature> {
00041  public:
00042   void OnRequest(const proto::AddSensorDataBatchRequest& request) override;
00043 
00044   static void RegisterMetrics(metrics::FamilyFactory* family_factory);
00045 
00046  private:
00047   struct ClientMetrics {
00048     metrics::Counter* odometry_sensor_counter;
00049     metrics::Counter* imu_sensor_counter;
00050     metrics::Counter* timed_point_cloud_counter;
00051     metrics::Counter* fixed_frame_pose_counter;
00052     metrics::Counter* landmark_counter;
00053     metrics::Counter* local_slam_result_counter;
00054   };
00055 
00056   ClientMetrics* GetOrCreateClientMetrics(const std::string& client_id,
00057                                           int trajectory_id);
00058 
00059   static cartographer::metrics::Family<metrics::Counter>*
00060       counter_metrics_family_;
00061 
00062   // Holds individual metrics for each client.
00063   absl::flat_hash_map<std::string, std::unique_ptr<ClientMetrics>>
00064       client_metric_map_;
00065 };
00066 
00067 }  // namespace handlers
00068 }  // namespace cloud
00069 }  // namespace cartographer
00070 
00071 #endif  // CARTOGRAPHER_CLOUD_INTERNAL_HANDLERS_ADD_SENSOR_DATA_BATCH_HANDLER_H


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:35