29 #include "modules/common/configs/proto/vehicle_config.pb.h" 69 const ControlConf *control_conf)
override;
81 const localization::LocalizationEstimate *localization,
82 const canbus::Chassis *chassis,
const planning::ADCTrajectory *trajectory,
83 ControlCommand *cmd)
override;
100 std::string
Name()
const override;
110 const double linear_v,
const double angular_v,
111 const double linear_a,
113 SimpleMPCDebug *debug);
116 SimpleMPCDebug *debug);
124 void ProcessLogs(
const SimpleMPCDebug *debug,
const canbus::Chassis *chassis);
137 const MPCControllerConf &mpc_controller_conf);
const std::string name_
Definition: mpc_controller.h:246
double lf_
Definition: mpc_controller.h:155
double standstill_acceleration_
Definition: mpc_controller.h:252
double previous_lateral_error_
Definition: mpc_controller.h:211
common::MeanFilter lateral_error_filter_
Definition: mpc_controller.h:267
double previous_ref_heading_rate_
Definition: mpc_controller.h:218
double ts_
Definition: mpc_controller.h:145
Eigen::MatrixXd matrix_a_coeff_
Definition: mpc_controller.h:204
common::Status ComputeControlCommand(const localization::LocalizationEstimate *localization, const canbus::Chassis *chassis, const planning::ADCTrajectory *trajectory, ControlCommand *cmd) override
compute steering target and throttle/ brake based on current vehicle status and target trajectory ...
double previous_ref_heading_acceleration_
Definition: mpc_controller.h:221
void InitializeFilters(const ControlConf *control_conf)
Eigen::MatrixXd matrix_cd_
Definition: mpc_controller.h:191
MPCController, combined lateral and longitudinal controllers.
Definition: mpc_controller.h:51
common::DigitalFilter digital_filter_
Definition: mpc_controller.h:233
bool enable_mpc_feedforward_compensation_
Definition: mpc_controller.h:276
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void Stop() override
stop MPC controller
double max_lat_acc_
Definition: mpc_controller.h:168
The MeanFilter class is used to smoothen a series of noisy numbers, such as sensor data or the output...
Definition: mean_filter.h:45
void LoadControlCalibrationTable(const MPCControllerConf &mpc_controller_conf)
std::shared_ptr< DependencyInjector > injector_
Definition: mpc_controller.h:282
void UpdateMatrix(SimpleMPCDebug *debug)
double steer_angle_feedforwardterm_
Definition: mpc_controller.h:258
double max_abs_speed_when_stopped_
Definition: mpc_controller.h:250
Eigen::MatrixXd matrix_r_
Definition: mpc_controller.h:196
double minimum_speed_protection_
Definition: mpc_controller.h:272
Eigen::MatrixXd matrix_a_
Definition: mpc_controller.h:179
void ComputeLongitudinalErrors(const TrajectoryAnalyzer *trajectory, SimpleMPCDebug *debug)
Defines the MeanFilter class.
double steer_ratio_
Definition: mpc_controller.h:161
Eigen::MatrixXd matrix_state_
Definition: mpc_controller.h:206
std::unique_ptr< Interpolation2D > control_interpolation_
Definition: mpc_controller.h:141
base class for all controllers.
Definition: controller.h:46
Eigen::MatrixXd matrix_ad_
Definition: mpc_controller.h:181
Eigen::MatrixXd matrix_q_
Definition: mpc_controller.h:200
Eigen::MatrixXd matrix_k_
Definition: mpc_controller.h:194
double lr_
Definition: mpc_controller.h:157
double previous_heading_rate_
Definition: mpc_controller.h:217
Eigen::MatrixXd matrix_r_updated_
Definition: mpc_controller.h:198
MPCController()
constructor
void UpdateState(SimpleMPCDebug *debug)
Eigen::MatrixXd matrix_bd_
Definition: mpc_controller.h:186
void LoadMPCGainScheduler(const MPCControllerConf &mpc_controller_conf)
process point query and conversion related to trajectory
Definition: trajectory_analyzer.h:44
double steer_single_direction_max_degree_
Definition: mpc_controller.h:163
Defines the DigitalFilter class.
double cf_
Definition: mpc_controller.h:147
double wheel_single_direction_max_degree_
Definition: mpc_controller.h:165
double wheelbase_
Definition: mpc_controller.h:151
std::unique_ptr< Interpolation1D > feedforwardterm_interpolation_
Definition: mpc_controller.h:239
double steer_angle_feedforwardterm_updated_
Definition: mpc_controller.h:260
double mpc_eps_
Definition: mpc_controller.h:231
Defines the Controller base class.
double max_deceleration_
Definition: mpc_controller.h:264
double brake_lowerbound_
Definition: mpc_controller.h:256
Eigen::MatrixXd matrix_c_
Definition: mpc_controller.h:189
TrajectoryAnalyzer trajectory_analyzer_
Definition: mpc_controller.h:134
std::string Name() const override
MPC controller name.
Functions to generate coefficients for digital filter.
void ProcessLogs(const SimpleMPCDebug *debug, const canbus::Chassis *chassis)
double previous_acceleration_
Definition: mpc_controller.h:225
Eigen::MatrixXd matrix_b_
Definition: mpc_controller.h:184
const int horizon_
Definition: mpc_controller.h:177
double Wheel2SteerPct(const double wheel_angle)
double iz_
Definition: mpc_controller.h:159
common::Status Init(std::shared_ptr< DependencyInjector > injector, const ControlConf *control_conf) override
initialize MPC Controller
double max_acceleration_when_stopped_
Definition: mpc_controller.h:248
bool LoadControlConf(const ControlConf *control_conf)
const int basic_state_size_
Definition: mpc_controller.h:173
common::MeanFilter heading_error_filter_
Definition: mpc_controller.h:270
const int controls_
Definition: mpc_controller.h:175
double previous_lateral_acceleration_
Definition: mpc_controller.h:215
The DigitalFilter class is used to pass signals with a frequency lower than a certain cutoff frequenc...
Definition: digital_filter.h:40
double previous_heading_error_
Definition: mpc_controller.h:209
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
double previous_heading_acceleration_
Definition: mpc_controller.h:220
std::unique_ptr< Interpolation1D > steer_weight_interpolation_
Definition: mpc_controller.h:241
double cr_
Definition: mpc_controller.h:149
double throttle_lowerbound_
Definition: mpc_controller.h:254
void ComputeLateralErrors(const double x, const double y, const double theta, const double linear_v, const double angular_v, const double linear_a, const TrajectoryAnalyzer &trajectory_analyzer, SimpleMPCDebug *debug)
common::Status Reset() override
reset MPC Controller
void FeedforwardUpdate(SimpleMPCDebug *debug)
double unconstrained_control_diff_limit_
Definition: mpc_controller.h:280
std::ofstream mpc_log_file_
Definition: mpc_controller.h:244
virtual ~MPCController()
destructor
std::unique_ptr< Interpolation1D > lat_err_interpolation_
Definition: mpc_controller.h:235
common::VehicleParam vehicle_param_
Definition: mpc_controller.h:131
double previous_acceleration_reference_
Definition: mpc_controller.h:226
std::unique_ptr< Interpolation1D > heading_err_interpolation_
Definition: mpc_controller.h:237
Eigen::MatrixXd matrix_q_updated_
Definition: mpc_controller.h:202
double mass_
Definition: mpc_controller.h:153
double max_acceleration_
Definition: mpc_controller.h:262
int mpc_max_iteration_
Definition: mpc_controller.h:229
Defines the TrajectoryAnalyzer class.