Apollo  6.0
Open source self driving car software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
channel_verify_agent.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 
18 #include <map>
19 #include <memory>
20 #include <mutex>
21 #include <string>
22 #include <utility>
23 #include <vector>
24 
25 #include "grpc++/grpc++.h"
26 
27 #include "modules/map/tools/map_datachecker/proto/collection_error_code.pb.h"
28 #include "modules/map/tools/map_datachecker/proto/collection_service.pb.h"
30 
31 namespace apollo {
32 namespace hdmap {
33 
35 
37  public:
38  explicit ChannelVerifyAgent(std::shared_ptr<JsonConf> sp_conf);
39  grpc::Status ProcessGrpcRequest(grpc::ServerContext *context,
40  ChannelVerifyRequest *request,
41  ChannelVerifyResponse *response);
42 
43  private:
44  void StartCheck(ChannelVerifyRequest *request,
45  ChannelVerifyResponse *response);
46  void AsyncCheck(const std::string &records_path);
47  void DoCheck(const std::string &records_path);
48  void CheckResult(ChannelVerifyRequest *request,
49  ChannelVerifyResponse *response);
50  void StopCheck(ChannelVerifyRequest *request,
51  ChannelVerifyResponse *response);
52  void Reset();
55  int AddTopicLack(VerifyResult *result, const std::string &record_path,
56  std::vector<std::string> const &lack_channels);
57  int AddInadequateRate(
58  VerifyResult *result, std::string const &record_path,
59  std::map<std::string, std::pair<double, double>> const &inadequate_rate);
60  FrameRate *FindRates(VerifyResult *result, const std::string &channel);
61 
62  private:
64  std::mutex stop_mutex_;
65  bool need_stop_;
66  bool stopped_;
67  std::shared_ptr<JsonConf> sp_conf_ = nullptr;
68  std::shared_ptr<ChannelVerify> sp_channel_checker_ = nullptr;
69  CheckedResult sp_check_result_ = nullptr;
70  std::thread::id check_thread_id_;
71 };
72 
73 } // namespace hdmap
74 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: channel_verify_agent.h:36
State GetState()
std::shared_ptr< std::vector< OneRecordChannelCheckResult > > CheckedResult
Definition: channel_verify.h:54
void SetState(const State &state)
ChannelVerifyAgentState
Definition: channel_verify_agent.h:34