Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add a new control algorithm to Apollo

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to add a new control algorithm in Apollo, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The control algorithm in Apollo consists of one or more controllers that can be easily changed or replaced with different algorithms. Each controller outputs one or more control commands to the CANbus.

The default control algorithm in Apollo includes horizontal controller (LatController) and vertical controller (LonController). They are responsible for horizontal and longitudinal vehicle control respectively.

The new control algorithm does not have to follow the default mode, for example, a horizontal controller + a vertical controller. It can be a single controller or a combination of any number of controllers.

To add a new control algorithm:

Create a controller

Add the configuration information for the new controller to the file control_config

Register a new controller

For a better understanding, each step is described in detail below:

First, create a controller

All controllers must inherit the base class Controller, which defines a set of interfaces. The following is an example of a controller implementation:

Namespace apollo {namespace control {class NewController: public Controller {public: NewController (); virtual ~ NewController (); Status Init (const ControlConf* control_conf) override; Status ComputeControlCommand (const localization::LocalizationEstimate* localization, const canbus::Chassis* chassis, const planning::ADCTrajectory* trajectory, ControlCommand* cmd) override; Status Reset () override; void Stop () override; std::string Name () const override;} } / / namespace control} / / namespace apollo II. Add configuration information for the new controller

Follow these steps to add configuration information for the new controller to the file control_config:

1. Define proto for the new controller configuration and parameters according to the algorithm requirements. As an example, you can refer to the proto definition of LatController at the following location: modules/control/proto/ lat_controller_conf.proto

2. After defining a new controller proto, such as new_controller_conf.proto, enter the following:

Syntax = "proto2"; package apollo.control;message NewControllerConf {double parameter1 = 1; int32 parameter2 = 2;}

3. Update the modules/control/proto/control_conf.proto file by referring to the following:

Optional apollo.control.NewControllerConf new_controller_conf = 15

4. Refer to update ControllerType with content (in modules/control/proto/control_conf.proto):

Enum ControllerType {LAT_CONTROLLER = 0; LON_CONTROLLER = 1; NEW_CONTROLLER = 2;}

After the protobuf definition is complete, update the control profile in modules/control/conf/lincoln.pb.txt accordingly.

Note: the "control/conf" file above is the default file for Apollo. Your project may use different control profiles.

Register a new controller

To activate the new controller in the Apollo system, register the new controller in "ControllerAgent" in the following file: modules/control/controller/controller_agent.cc

Add registration information as shown in the following example:

Void ControllerAgent::RegisterControllers () {controller_factory_.Register (ControlConf::NEW_CONTROLLER, [] ()-> Controller * {return new NewController ();});}

After completing the above steps, your new controller will take effect in the Apollo system.

These are all the contents of the article "how to add New Control algorithms in Apollo". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report