Apollo 10.0
自动驾驶开放平台
ch_vehicle_factory.h
浏览该文件的文档.
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
21#pragma once
22
23#include <memory>
24
25#include "modules/canbus/proto/canbus_conf.pb.h"
26#include "modules/canbus/proto/vehicle_parameter.pb.h"
27#include "modules/canbus_vehicle/ch/proto/ch.pb.h"
28#include "modules/common_msgs/control_msgs/control_cmd.pb.h"
29
30#include "cyber/cyber.h"
40
45namespace apollo {
46namespace canbus {
47
55 public:
59 virtual ~ChVehicleFactory() = default;
60
65 bool Init(const CanbusConf *canbus_conf) override;
66
71 bool Start() override;
72
76 void Stop() override;
77
81 void UpdateCommand(
82 const apollo::control::ControlCommand *control_command) override;
83
84 void UpdateCommand(
85 const apollo::external_command::ChassisCommand *chassis_command) override;
86
90 Chassis publish_chassis() override;
91
95 void PublishChassisDetail() override;
96
100 void PublishChassisDetailSender() override;
101
105 bool CheckChassisCommunicationFault() override;
106
107 private:
112 std::unique_ptr<VehicleController<::apollo::canbus::Ch>>
113 CreateVehicleController();
114
119 std::unique_ptr<MessageManager<::apollo::canbus::Ch>> CreateMessageManager();
120
121 std::unique_ptr<::apollo::cyber::Node> node_ = nullptr;
122 std::unique_ptr<apollo::drivers::canbus::CanClient> can_client_;
123 CanSender<::apollo::canbus::Ch> can_sender_;
125 std::unique_ptr<MessageManager<::apollo::canbus::Ch>> message_manager_;
126 std::unique_ptr<VehicleController<::apollo::canbus::Ch>> vehicle_controller_;
127
128 std::shared_ptr<::apollo::cyber::Writer<::apollo::canbus::Ch>>
129 chassis_detail_writer_;
130 std::shared_ptr<::apollo::cyber::Writer<::apollo::canbus::Ch>>
131 chassis_detail_sender_writer_;
132};
133
135
136} // namespace canbus
137} // namespace apollo
#define CYBER_REGISTER_VEHICLEFACTORY(name)
Defines the CanFrame struct and CanClient interface.
Defines CanReceiver class.
Defines SenderMessage class and CanSender class.
the class of ChMessageManager
this class is the abstract factory following the AbstractFactory design pattern.
this class is inherited from AbstractVehicleFactory.
bool Init(const CanbusConf *canbus_conf) override
init vehicle factory
void Stop() override
stop canclient, cansender, canreceiver, vehicle controller
bool Start() override
start canclient, cansender, canreceiver, vehicle controller
void PublishChassisDetail() override
publish chassis for vehicle messages
Chassis publish_chassis() override
publish chassis messages
void PublishChassisDetailSender() override
publish chassis for apollo sender messages
void UpdateCommand(const apollo::control::ControlCommand *control_command) override
update control command
virtual ~ChVehicleFactory()=default
destructor
bool CheckChassisCommunicationFault() override
check chassis can receiver lost
The class of MessageManager
class register implement
Definition arena_queue.h:37
The class of VehicleController