Apollo 10.0
自动驾驶开放平台
guardian_component.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 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
21#pragma once
22
23#include <memory>
24
25#include "cyber/common/macros.h"
27#include "cyber/cyber.h"
28
29#include "modules/common_msgs/chassis_msgs/chassis.pb.h"
30#include "modules/common_msgs/control_msgs/control_cmd.pb.h"
31#include "modules/common_msgs/guardian_msgs/guardian.pb.h"
32#include "modules/guardian/proto/guardian_conf.pb.h"
33#include "modules/common_msgs/monitor_msgs/system_status.pb.h"
34
39namespace apollo {
40namespace guardian {
41
43 public:
44 bool Init() override;
45 bool Proc() override;
46
47 private:
48 void PassThroughControlCommand();
49 void TriggerSafetyMode();
50
51 apollo::guardian::GuardianConf guardian_conf_;
53 apollo::monitor::SystemStatus system_status_;
56
57 double last_status_received_s_{};
58
59 std::shared_ptr<apollo::cyber::Reader<apollo::canbus::Chassis>>
60 chassis_reader_;
61 std::shared_ptr<apollo::cyber::Reader<apollo::control::ControlCommand>>
62 control_cmd_reader_;
63 std::shared_ptr<apollo::cyber::Reader<apollo::monitor::SystemStatus>>
64 system_status_reader_;
65 std::shared_ptr<apollo::cyber::Writer<apollo::guardian::GuardianCommand>>
66 guardian_writer_;
67
68 std::mutex mutex_;
69};
70
72
73} // namespace guardian
74} // namespace apollo
bool Proc() override
The Proc logic of the component, which called by the CyberRT frame.
#define CYBER_REGISTER_COMPONENT(name)
Definition component.h:656
class register implement
Definition arena_queue.h:37