Skip to content
Open

Dev test #15747

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
13bafb6
add
Nov 4, 2024
3f35690
update: note
Dec 7, 2024
6b6e379
update:note
Jan 6, 2025
f12b9c0
update: open_space
Jan 16, 2025
6723ddb
update: note
Jan 30, 2025
5b15cc0
update: note
Mar 18, 2025
f3aedf0
pdate: planning_component.h
Mar 18, 2025
28128e5
update: planning_component learn
Mar 18, 2025
d23e4f9
update: planning_component.h整体
Mar 18, 2025
0263258
update: plan
Mar 18, 2025
0b70c06
pdate:plan_2
Mar 18, 2025
a55e31a
update: c++
Mar 18, 2025
7692d47
update: referenceline note
Mar 19, 2025
9cd1e79
update: planning_component init
Mar 29, 2025
89602bf
update: planning_component
Apr 1, 2025
bee8b81
update: 插件notes
Apr 1, 2025
405b24a
update: 轨迹拼接之前
Apr 1, 2025
d8378d9
update: 轨迹拼接
Apr 1, 2025
c5ecd68
update: 编译脚本
Apr 2, 2025
1f384a6
update
Apr 26, 2025
fffd8bb
update: time
May 7, 2025
a4a0e12
update: note
May 18, 2025
d6b71d7
update:control
May 21, 2025
b5fd5ce
update:lon_contro
May 21, 2025
c140df5
update: cankaoxian
May 21, 2025
b09a5f0
update: Route module
May 24, 2025
9e940cf
update:pull over
Jun 4, 2025
8554922
update: 起始点投影
Jun 14, 2025
5e90d17
update: lane_follow note
Jun 14, 2025
fc09499
update: path decider note
Jun 14, 2025
a16c4af
update: rule base stop simple note
Jun 14, 2025
316f5ae
update: speed_bound
Jun 14, 2025
5d3948c
update: path_decider
Jun 21, 2025
c8ef29e
update: note
Nov 7, 2025
d2d1eb2
Merge remote-tracking branch 'origin/dev_test' into dev_test
Nov 7, 2025
52d1acf
update: frame
Nov 19, 2025
121da93
update: open_space note
Nov 25, 2025
5b2394d
update: refer_line
Nov 27, 2025
f8cc6a0
update:执行task之前的准备
Dec 18, 2025
7449b94
update: decision
Dec 19, 2025
af40cb3
update: open_space
Dec 19, 2025
c0b29d9
update
Jan 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 0 additions & 87 deletions .gitignore

This file was deleted.

95 changes: 95 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"files.associations": {
"tuple": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"complex": "cpp",
"cstdint": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"optional": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"type_traits": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"memory": "cpp",
"new": "cpp",
"ostream": "cpp",
"numeric": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"utility": "cpp",
"typeinfo": "cpp",
"iterator": "cpp",
"memory_resource": "cpp",
"random": "cpp",
"string": "cpp",
"bit": "cpp",
"chrono": "cpp",
"codecvt": "cpp",
"condition_variable": "cpp",
"deque": "cpp",
"fstream": "cpp",
"mutex": "cpp",
"ratio": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"map": "cpp",
"set": "cpp",
"shared_mutex": "cpp",
"hash_map": "cpp",
"hash_set": "cpp",
"any": "cpp",
"regex": "cpp",
"future": "cpp",
"variant": "cpp",
"forward_list": "cpp",
"list": "cpp",
"valarray": "cpp",
"bitset": "cpp",
"csignal": "cpp"
},
"C_Cpp.errorSquiggles": "disabled",

// ✅ 护眼配色部分从这里开始
"workbench.colorCustomizations": {
"editor.background": "#E8F5E9", // 浅绿色背景(柔和明亮)
"editor.foreground": "#2E4A2E", // 深墨绿色文字
"activityBar.background": "#DDEEDD",
"sideBar.background": "#E3F2E3",
"statusBar.background": "#CDE5CD",
"editorLineNumber.foreground": "#6B8E6B",
"editorCursor.foreground": "#2E7D32", // 墨绿光标
"editor.selectionBackground": "#C5E1C5", // 柔和选中高亮
"editor.inactiveSelectionBackground": "#D0E6D0",
"editor.lineHighlightBackground": "#DDF0DD",
"terminal.foreground": "#2E4A2E",
"terminal.background": "#E8F5E9"
},
"editor.fontFamily": "JetBrains Mono, Fira Code, Consolas, monospace",
"editor.fontSize": 14,
"editor.lineHeight": 1.6,
"editor.fontLigatures": true
}
129 changes: 129 additions & 0 deletions 1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
bool Planning::FillPlanningResult(
const apollo::planning::Frame& frame,
const std::vector<apollo::common::TrajectoryPoint>& stitching_trajectory,
bestway::pnc::planning::ADCTrajectory* const planning_result) {

if (frame.reference_line_info().empty()) {
BERROR << "No reference line info in frame.";
return false;
}

const auto& reference_line_info = frame.reference_line_info().front();
const auto& trajectory = reference_line_info.trajectory();
RETURN_VAL_IF(trajectory.empty(), false);

BINFO << "Final traj length: " << trajectory.GetSpatialLength()
<< ", path length: " << reference_line_info.path_data().discretized_path().Length();

VehicleSignal::TurnSignal desired_turn_signal = VehicleSignal::TURN_NONE;

constexpr double kMaxLookaheadDist = 10.0; // 沿参考线看10米
constexpr double kMinTurnIntensity = 0.2; // 总曲率强度阈值
constexpr double kDominanceRatio = 1.2; // 主导方向需强20%

if (!trajectory.empty()) {
const auto& reference_line = reference_line_info.reference_line();

const auto& ego_path_point = trajectory.front().path_point();
apollo::common::SLPoint ego_sl;
if (!reference_line.XYToSL({ego_path_point.x(), ego_path_point.y()}, &ego_sl)) {
BERROR << "Failed to project ego pose to reference line for turn signal logic.";
} else {
double ego_s = ego_sl.s();
double left_turn_intensity = 0.0;
double right_turn_intensity = 0.0;
bool has_valid_kappa = false;
double prev_s = ego_s; // 上一个有效点的 s

for (size_t i = 0; i < trajectory.size(); ++i) {
const auto& pt = trajectory[i];
if (!pt.path_point().has_kappa()) continue;

apollo::common::SLPoint curr_sl;
if (!reference_line.XYToSL({pt.path_point().x(), pt.path_point().y()}, &curr_sl)) {
continue;
}

double curr_s = curr_sl.s();
// 忽略后方点
if (curr_s < ego_s) continue;

// 超出预瞄距离,停止
if (curr_s - ego_s > kMaxLookaheadDist) break;

double ds = curr_s - prev_s;
if (ds < 1e-3) {
// 点太近,不积分,但更新 prev_s 防止累积误差
prev_s = curr_s;
continue;
}

double kappa = pt.path_point().kappa();
if (kappa > 0) {
left_turn_intensity += kappa * ds;
} else if (kappa < 0) {
right_turn_intensity += (-kappa) * ds;
}

prev_s = curr_s;
has_valid_kappa = true;
}

// 判断是否打灯
if (has_valid_kappa) {
double total_intensity = left_turn_intensity + right_turn_intensity;
if (total_intensity >= kMinTurnIntensity) {
if (left_turn_intensity > right_turn_intensity * kDominanceRatio) {
desired_turn_signal = VehicleSignal::TURN_LEFT;
} else if (right_turn_intensity > left_turn_intensity * kDominanceRatio) {
desired_turn_signal = VehicleSignal::TURN_RIGHT;
}
}
}
}
}

// --- 接近目标点时取消转向灯 ---
double delta_s_to_goal = std::numeric_limits<double>::max();
const auto& goal = frame.goal();
const auto& reference_line = frame.reference_line_info().front().reference_line();
const auto& adc_pose = trajectory.front().path_point();

apollo::common::SLPoint adc_sl, goal_sl;
if (reference_line.XYToSL({adc_pose.x(), adc_pose.y()}, &adc_sl) &&
reference_line.XYToSL({goal.x(), goal.y()}, &goal_sl)) {
delta_s_to_goal = goal_sl.s() - adc_sl.s();
}
BERROR << "delta_s_to_goal: " << delta_s_to_goal;

constexpr double kTurnSignalCancelDistAlongS = 8.0;
if (delta_s_to_goal > 0 && delta_s_to_goal < kTurnSignalCancelDistAlongS) {
BERROR << "Near goal (Δs=" << delta_s_to_goal << "m), turn signal canceled.";
desired_turn_signal = VehicleSignal::TURN_NONE;
}

for (size_t i = 0; i < stitching_trajectory.size(); ++i) {
auto* point = planning_result->add_trajectory_point();
ConvertApolloToBestwayPoint(stitching_trajectory[i], point);
}

for (const auto& apollo_point : trajectory) {
auto* point = planning_result->add_trajectory_point();
ConvertApolloToBestwayPoint(apollo_point, point);
}

switch (desired_turn_signal) {
case VehicleSignal::TURN_LEFT:
planning_result->set_turn_signal(bestway::pnc::TurnSignal::TURN_LEFT);
break;
case VehicleSignal::TURN_RIGHT:
planning_result->set_turn_signal(bestway::pnc::TurnSignal::TURN_RIGHT);
break;
default:
planning_result->set_turn_signal(bestway::pnc::TurnSignal::TURN_NONE);
break;
}

planning_result->set_gear(bestway::pnc::GearPosition::GEAR_D);
return true;
}
Loading