Apollo 10.0
自动驾驶开放平台
abstract_vehicle_factory.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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 "modules/canbus/proto/vehicle_parameter.pb.h"
26#include "modules/common_msgs/control_msgs/control_cmd.pb.h"
30
32
37namespace apollo {
38namespace canbus {
39
48 public:
52 virtual ~AbstractVehicleFactory() = default;
53
57 void SetVehicleParameter(const VehicleParameter &vehicle_paramter);
58
63 virtual bool Init(const CanbusConf *canbus_conf) = 0;
64
69 virtual bool Start() = 0;
70
74 virtual void Stop() = 0;
75
79 virtual void UpdateCommand(const ControlCommand *control_command) = 0;
80
84 virtual void UpdateCommand(const ChassisCommand *chassis_command) = 0;
85
89 virtual Chassis publish_chassis() = 0;
90
94 virtual void PublishChassisDetail() = 0;
95
99 virtual void PublishChassisDetailSender();
100
104 virtual void UpdateHeartbeat();
105
109 virtual bool CheckChassisCommunicationFault();
110
114 virtual void AddSendProtocol();
115
119 virtual void ClearSendProtocol();
120
124 virtual bool IsSendProtocolClear();
125
130
131 private:
132 VehicleParameter vehicle_parameter_;
133};
134
135#define CYBER_REGISTER_VEHICLEFACTORY(name) \
136 CLASS_LOADER_REGISTER_CLASS(name, AbstractVehicleFactory)
137
138} // namespace canbus
139} // namespace apollo
this class is the abstract factory following the AbstractFactory design pattern.
virtual Chassis::DrivingMode Driving_Mode()
get chassis driving mode
virtual void AddSendProtocol()
add send protocol message
virtual Chassis publish_chassis()=0
publish chassis messages
virtual void Stop()=0
stop canclient, cansender, canreceiver, vehicle controller
virtual bool Init(const CanbusConf *canbus_conf)=0
init vehicle factory
virtual void ClearSendProtocol()
clear send protocol message, make a sender can error
virtual void PublishChassisDetailSender()
publish chassis for vehicle messages
virtual void UpdateCommand(const ChassisCommand *chassis_command)=0
update chassis command
virtual void UpdateHeartbeat()
create cansender heartbeat
virtual void UpdateCommand(const ControlCommand *control_command)=0
update control command
void SetVehicleParameter(const VehicleParameter &vehicle_paramter)
set VehicleParameter.
virtual void PublishChassisDetail()=0
publish chassis for vehicle messages
virtual bool Start()=0
start canclient, cansender, canreceiver, vehicle controller
virtual ~AbstractVehicleFactory()=default
destructor
virtual bool CheckChassisCommunicationFault()
check chassis detail communication fault
virtual bool IsSendProtocolClear()
check send protocol message whether is clear or not
The class of MessageManager
class register implement
Definition arena_queue.h:37
The class of VehicleController