Skip to content

Commit 6a31368

Browse files
authored
Merge pull request AtsushiSakai#231 from sszwfy/master
fix error for goal cost angle
2 parents b7f6c1c + b942c43 commit 6a31368

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

PathPlanning/DynamicWindowApproach/dynamic_window_approach.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ def calc_to_goal_cost(traj, goal, config):
167167
dx = goal[0] - traj[-1, 0]
168168
dy = goal[1] - traj[-1, 1]
169169
error_angle = math.atan2(dy, dx)
170-
cost = abs(error_angle - traj[-1, 2])
170+
cost_angle = error_angle - traj[-1, 2]
171+
cost = abs(math.atan2(math.sin(cost_angle), math.cos(cost_angle)))
171172

172173
return cost
173174

0 commit comments

Comments
 (0)