Skip to content

Commit 99c1aa4

Browse files
[pre-commit.ci] pre-commit autoupdate (#8)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 23.11.0 → 24.2.0](psf/black@23.11.0...24.2.0) - [github.com/pycqa/isort: 5.12.0 → 5.13.2](PyCQA/isort@5.12.0...5.13.2) - [github.com/astral-sh/ruff-pre-commit: v0.1.6 → v0.2.2](astral-sh/ruff-pre-commit@v0.1.6...v0.2.2) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent cfb32cb commit 99c1aa4

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ fail_fast: false
22

33
repos:
44
- repo: https://github.com/psf/black
5-
rev: 23.11.0
5+
rev: 24.2.0
66
hooks:
77
- id: black
88
args: [--config, "./pyproject.toml"]
99

1010
- repo: https://github.com/pycqa/isort
11-
rev: 5.12.0
11+
rev: 5.13.2
1212
hooks:
1313
- id: isort
1414
args: [--settings-path, "./pyproject.toml"]
1515

1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.1.6
17+
rev: v0.2.2
1818
hooks:
1919
- id: ruff
2020

src/LocalPathPlanning/FSAE_PathPlanning/FSAE_local_path_planning.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ def get_translation(
235235
for i in range(len(test_data)):
236236
red = get_traffic_cone_matrix(np.array(test_data[i]), 2) # 左侧锥桶位置矩阵
237237
blue = get_traffic_cone_matrix(np.array(test_data[i]), 11) # 右侧锥桶位置矩阵
238-
local_path = local_path_fitting(red, blue, translation_dis=1.5) # 规划出的局部路径矩阵
238+
local_path = local_path_fitting(
239+
red, blue, translation_dis=1.5
240+
) # 规划出的局部路径矩阵
239241

240242
row = i // 4 # 绘图布局用
241243
col = i % 4

src/utilities/discrete_curve_funcs.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ def find_match_point(
2626

2727
x, y = xy_coordinate
2828
reference_line_length = reference_line_nodes.shape[0]
29-
increase_count = 0 # 用 increase_count 记录 distance 连续增大的次数,避免多个局部最小值的干扰
29+
increase_count = (
30+
0 # 用 increase_count 记录 distance 连续增大的次数,避免多个局部最小值的干扰
31+
)
3032
min_distance_square = float("inf")
31-
match_point_index = start_index # 若最后仍没有找到匹配索引,则说明起始索引已经是最佳匹配,直接返回
33+
match_point_index = (
34+
start_index # 若最后仍没有找到匹配索引,则说明起始索引已经是最佳匹配,直接返回
35+
)
3236

3337
if start_index == 0:
3438
# 首次运行情况
@@ -130,7 +134,9 @@ def get_projection_point(
130134

131135
# 计算投影点的位置信息
132136
x_r, y_r = r_m_v + ds * tau # 计算投影点坐标
133-
theta_r = normalize_angle(theta_match + kappa_match * ds) # 计算投影点在参考线上切线与 x 轴的夹角
137+
theta_r = normalize_angle(
138+
theta_match + kappa_match * ds
139+
) # 计算投影点在参考线上切线与 x 轴的夹角
134140
kappa_r = kappa_match # 投影点在参考线处的曲率
135141

136142
return x_r, y_r, theta_r, kappa_r
@@ -155,15 +161,19 @@ def calculate_heading_kappa(path_points: npt.NDArray[np.float_]):
155161
# TODO 将填补差分的功能提取至单独的函数中
156162

157163
points_array = np.array(path_points)
158-
d_xy_ = points_array[1:, :] - points_array[:-1, :] # 一阶差分,此种写法比 np.diff() 性能高得多
164+
d_xy_ = (
165+
points_array[1:, :] - points_array[:-1, :]
166+
) # 一阶差分,此种写法比 np.diff() 性能高得多
159167
d_xy = np.empty_like(points_array) # 定义变量,预分配内存
160168
# 由于 n 个点差分得到的只有 n-1 个差分结果,所以要在首尾添加重复单元来近似求每个节点的 dx、dy
161169
d_xy[0, :] = d_xy_[:, :][0]
162170
d_xy[-1, :] = d_xy_[:, :][-1]
163171
d_xy[1:-1, :] = (d_xy_[1:, :] + d_xy_[:-1, :]) / 2
164172

165173
# 计算切线方向角 theta
166-
theta = np.arctan2(d_xy[:, 1], d_xy[:, 0]) # np.arctan2 会将角度限制在 (-pi, pi)之间
174+
theta = np.arctan2(
175+
d_xy[:, 1], d_xy[:, 0]
176+
) # np.arctan2 会将角度限制在 (-pi, pi)之间
167177

168178
d_theta_ = theta[1:] - theta[:-1] # 差分,这种写法比np.diff()性能高得多
169179
d_theta = np.empty_like(theta)

0 commit comments

Comments
 (0)