Apollo 10.0
自动驾驶开放平台
gem_vehicle_factory.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 "modules/canbus/proto/canbus_conf.pb.h"
26#include "modules/canbus/proto/vehicle_parameter.pb.h"
27#include "modules/canbus_vehicle/gem/proto/gem.pb.h"
28#include "modules/common_msgs/control_msgs/control_cmd.pb.h"
29#include "cyber/cyber.h"
36
41namespace apollo {
42namespace canbus {
43
51 public:
55 virtual ~GemVehicleFactory() = default;
56
61 bool Init(const CanbusConf *canbus_conf) override;
62
67 bool Start() override;
68
73 void Stop() override;
74
78 void UpdateCommand(
79 const apollo::control::ControlCommand *control_command) override;
80
81 void UpdateCommand(
82 const apollo::external_command::ChassisCommand *chassis_command) override;
83
87 Chassis publish_chassis() override;
88
92 void PublishChassisDetail() override;
93
94 private:
99 std::unique_ptr<VehicleController<::apollo::canbus::Gem>>
100 CreateVehicleController();
101
106 std::unique_ptr<MessageManager<::apollo::canbus::Gem>> CreateMessageManager();
107
108 std::unique_ptr<::apollo::cyber::Node> node_ = nullptr;
109 std::unique_ptr<apollo::drivers::canbus::CanClient> can_client_;
110 CanSender<::apollo::canbus::Gem> can_sender_;
112 std::unique_ptr<MessageManager<::apollo::canbus::Gem>> message_manager_;
113 std::unique_ptr<VehicleController<::apollo::canbus::Gem>> vehicle_controller_;
114
115 std::shared_ptr<::apollo::cyber::Writer<::apollo::canbus::Gem>>
116 chassis_detail_writer_;
117};
118
120
121} // namespace canbus
122} // 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 PublishChassisDetail() override
publish chassis for vehicle messages
void Stop() override
create ch vehicle controller
bool Init(const CanbusConf *canbus_conf) override
init vehicle factory
void UpdateCommand(const apollo::control::ControlCommand *control_command) override
update control command
Chassis publish_chassis() override
publish chassis messages
bool Start() override
start canclient, cansender, canreceiver, vehicle controller
virtual ~GemVehicleFactory()=default
destructor
The class of MessageManager
class register implement
Definition arena_queue.h:37
The class of VehicleController