Apollo  6.0
Open source self driving car software
lat_lon_controller_submodule.h
Go to the documentation of this file.
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 
17 #pragma once
18 
19 #include <memory>
20 #include <string>
21 
25 #include "modules/canbus/proto/chassis.pb.h"
31 #include "modules/control/proto/control_cmd.pb.h"
32 #include "modules/control/proto/control_conf.pb.h"
33 #include "modules/control/proto/pad_msg.pb.h"
34 #include "modules/control/proto/preprocessor.pb.h"
35 #include "modules/localization/proto/localization.pb.h"
36 #include "modules/planning/proto/planning.pb.h"
37 
38 namespace apollo {
39 namespace control {
40 class LatLonControllerSubmodule final : public cyber::Component<Preprocessor> {
41  public:
51 
56  std::string Name() const;
57 
62  bool Init() override;
63 
70  bool Proc(const std::shared_ptr<Preprocessor>& preprocessor_status) override;
71 
72  private:
73  common::Status ProduceControlCoreCommand(
74  const LocalView& local_view, ControlCommand* control_core_command);
75 
76  private:
77  bool estop_ = false;
78 
79  common::monitor::MonitorLogBuffer monitor_logger_buffer_;
80 
81  LatController lateral_controller_;
82  LonController longitudinal_controller_;
83 
84  std::mutex mutex_;
85  // TODO(SHU): separate conf
86  ControlConf lateral_controller_conf_;
87  ControlConf longitudinal_controller_conf_;
88  std::shared_ptr<cyber::Writer<ControlCommand>> control_core_writer_;
89  std::shared_ptr<DependencyInjector> injector_;
90 };
91 
93 
94 } // namespace control
95 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool Proc(const std::shared_ptr< Preprocessor > &preprocessor_status) override
generate control command
LocalView contains all necessary data as planning input.
LatLonControllerSubmodule()
Construct a new PID+LQR ControllerSubmodule object.
CYBER_REGISTER_COMPONENT(PreprocessorSubmodule)
LQR-Based lateral controller, to compute steering target. For more details, please refer to "Vehicle ...
Definition: lat_controller.h:53
Definition: lat_lon_controller_submodule.h:40
Defines the LonController class.
Defines the Controller base class.
Defines the LatController class.
The class of MonitorLogBuffer.
std::string Name() const
Get name of the node.
A general class to denote the return status of an API call. It can either be an OK status for success...
Definition: status.h:43
bool Init() override
Initialize the node.
This class help collect MonitorMessage pb to monitor topic. The messages can be published automatical...
Definition: monitor_log_buffer.h:60
Some util functions.
The Component can process up to four channels of messages. The message type is specified when the com...
Definition: component.h:58
Longitudinal controller, to compute brake / throttle values.
Definition: lon_controller.h:49