27#include "absl/strings/str_cat.h"
47 AINFO <<
"Using " << name_ <<
".";
51 const std::string &calibration_table_path,
53 std::string calibration_table_path_absolute
54 = absl::StrCat(
"/apollo/modules/control/control_component/conf/", calibration_table_path);
56 AERROR <<
"Load calibration table failed!";
59 AINFO <<
"Load the calibraiton table file successfully, file path: " << calibration_table_path_absolute;
67 localization_ = localization;
69 trajectory_message_ = trajectory;
70 ACHECK(localization_ !=
nullptr) <<
"Fail to get localization msg!";
71 ACHECK(chassis_ !=
nullptr) <<
"Fail to get chassis msg!";
72 ACHECK(trajectory_message_ !=
nullptr) <<
"Fail to get trajectory msg!";
81 bool is_forward =
false;
99 bool is_in_edge_follow =
false;
101 is_in_edge_follow =
true;
103 return is_in_edge_follow;
107 double pit_replan_check_time,
108 double pit_replan_check_count,
109 double vehicle_speed,
111 static std::pair<double, int> replan_count(0, 0);
115 if (now - replan_count.first > pit_replan_check_time) {
116 replan_count.first = 0;
117 replan_count.second = 0;
121 if (now - replan_count.first > pit_replan_check_time) {
122 replan_count.first = now;
123 replan_count.second = 1;
125 replan_count.first = now;
126 replan_count.second++;
131 if (replan_count.second >= pit_replan_check_count
132 && abs(vehicle_speed) < vehicle_param.max_abs_speed_when_stopped()) {
144 const double ref_curvature,
145 const double min_large_ref_curvature,
146 bool *is_in_large_curvature) {
147 ADEBUG <<
"Into IsLargeCurvature. " <<
"ref_curvature is " << ref_curvature <<
", min_large_ref_curvature is "
148 << min_large_ref_curvature;
149 bool is_in_large_cur =
false;
150 if (ref_curvature > min_large_ref_curvature) {
151 ADEBUG <<
"ref_curvature is " << ref_curvature <<
", in large curvature.";
152 is_in_large_cur =
true;
153 *is_in_large_curvature = is_in_large_cur;
156 is_in_large_cur =
false;
157 *is_in_large_curvature = is_in_large_cur;
163 bool is_left_cur =
false;
164 if (ref_curvature > 0) {
171 std::shared_ptr<DependencyInjector> injector,
172 const bool &use_filter,
173 const double &filter_coeff) {
174 double vehicle_speed = injector->vehicle_state()->linear_velocity();
177 if (vehicle_speed * vehicle_speed_last_ < 0) {
178 vehicle_speed_last_ = 0.0;
182 vehicle_speed_last_ = vehicle_speed;
183 return vehicle_speed;
187 const bool &use_filter,
188 const double &filter_coeff,
189 const double &throttle) {
190 double throttle_filtered = throttle;
193 throttle_last_ = throttle_filtered;
196 return throttle_filtered;
A general class to denote the return status of an API call.
static const VehicleConfig & GetConfig()
Get the current vehicle configuration.
ControlTaskExtend()
constructor
bool IsLargeCurvature(const double ref_curvature, const double min_large_ref_curvature, bool *is_in_large_curvature)
double ThrottleCmdFilter(const bool &use_filter, const double &filter_coeff, const double &throttle)
bool VehicleStatusIdentificationUpdate(const localization::LocalizationEstimate *localization, const canbus::Chassis *chassis, const planning::ADCTrajectory *trajectory)
bool IsLeftCurvature(const double ref_curvature)
std::string Name() const
reset ControlTaskAgent
bool LoadCalibrationTable(const std::string &calibration_table_path, calibration_table *calibration_table_conf)
bool CheckInPit(double pit_replan_check_time, double pit_replan_check_count, double vehicle_speed, bool replan)
double GetVehicleSpeed(std::shared_ptr< DependencyInjector > injector, const bool &use_filter, const double &filter_coeff)
static double exponential_smoothing(const double ¤t_value, const double &last_value, const double &alpha)
static double NowInSeconds()
gets the current time in second.
Defines the Controller base class.
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
optional GearPosition gear_location
optional VehicleParam vehicle_param
optional TrajectoryType trajectory_type
optional apollo::canbus::Chassis::GearPosition gear