同步操作将从 ApolloAuto/apollo 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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 CANbus
. The default control algorithm in Apollo contains a lateral controller (LatController) and a longitudinal controller (LonController). They are responsible for the vehicle control in the lateral and longitudinal directions respectively.
The new control algorithm does not have to follow the default pattern, e.g., one lateral controller + one longitudinal controller. It could be a single controller or a combination of any number of controllers.
Complete the following task sequence to add a new control algorithm:
control_config
fileThe steps are elaborated below for better understanding:
All controllers must inherit the base class Controller
, which defines a set of interfaces. Here 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
To add the new controller configuration complete the following steps:
Define a proto
for the new controller configurations and parameters based on the algorithm requirements. An example proto
definition of LatController
can be found at: modules/control/proto/lat_controller_conf.proto
After defining the new controller proto
, e.g., new_controller_conf.proto
, type the following:
syntax = "proto2";
package apollo.control;
message NewControllerConf {
double parameter1 = 1;
int32 parameter2 = 2;
}
Update control_conf.proto
at modules/control/proto/control_conf.proto
:
optional apollo.control.NewControllerConf new_controller_conf = 15;
Update ControllerType
in this file:
enum ControllerType {
LAT_CONTROLLER = 0;
LON_CONTROLLER = 1;
NEW_CONTROLLER = 2;
};
When the protobuf
definition is complete, update the control configuration file accordingly at modules/control/conf/control_conf.pb.txt
Note: The above `control/conf` file is the default for Apollo. Your project may use a different control configuration file.
To activate a new controller in the Apollo system, register the new controller in ControllerAgent
. Go to:
modules/control/controller/controller_agent.cc
Type your registration information in the shell. For example:
void ControllerAgent::RegisterControllers() {
controller_factory_.Register(
ControlConf::NEW_CONTROLLER,
[]() -> Controller * { return new NewController(); });
}
After this code update sequence is complete, you new controller should take effect in the Apollo system.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。