Apollo 10.0
自动驾驶开放平台
zhongyun_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/zhongyun/proto/zhongyun.pb.h"
28#include "modules/common_msgs/control_msgs/control_cmd.pb.h"
29#include "cyber/cyber.h"
37
42namespace apollo {
43namespace canbus {
44
52 public:
56 virtual ~ZhongyunVehicleFactory() = default;
57
62 bool Init(const CanbusConf *canbus_conf) override;
63
68 bool Start() override;
69
74 void Stop() override;
75
79 void UpdateCommand(
80 const apollo::control::ControlCommand *control_command) override;
81
82 void UpdateCommand(
83 const apollo::external_command::ChassisCommand *chassis_command) override;
84
88 Chassis publish_chassis() override;
89
93 void PublishChassisDetail() override;
94
95 private:
100 std::unique_ptr<VehicleController<::apollo::canbus::Zhongyun>>
101 CreateVehicleController();
102
107 std::unique_ptr<MessageManager<::apollo::canbus::Zhongyun>>
108 CreateMessageManager();
109
110 std::unique_ptr<::apollo::cyber::Node> node_ = nullptr;
111 std::unique_ptr<apollo::drivers::canbus::CanClient> can_client_;
112 CanSender<::apollo::canbus::Zhongyun> can_sender_;
114 can_receiver_;
115 std::unique_ptr<MessageManager<::apollo::canbus::Zhongyun>> message_manager_;
116 std::unique_ptr<VehicleController<::apollo::canbus::Zhongyun>>
117 vehicle_controller_;
118
119 std::shared_ptr<::apollo::cyber::Writer<::apollo::canbus::Zhongyun>>
120 chassis_detail_writer_;
121};
122
124
125} // namespace canbus
126} // namespace apollo
#define CYBER_REGISTER_VEHICLEFACTORY(name)
Defines the CanFrame struct and CanClient interface.
Defines CanReceiver class.
Defines SenderMessage class and CanSender class.
this class is the abstract factory following the AbstractFactory design pattern.
this class is inherited from AbstractVehicleFactory.
void Stop() override
create ch vehicle controller
virtual ~ZhongyunVehicleFactory()=default
destructor
Chassis publish_chassis() override
publish chassis messages
bool Init(const CanbusConf *canbus_conf) override
init vehicle factory
void PublishChassisDetail() override
publish chassis for vehicle messages
bool Start() override
start canclient, cansender, canreceiver, vehicle controller
void UpdateCommand(const apollo::control::ControlCommand *control_command) override
update control command
The class of MessageManager
class register implement
Definition arena_queue.h:37
The class of VehicleController