Skip to content

Commit adb4e99

Browse files
committed
Fix transpose error of the rotation matrix
1 parent 0ec5681 commit adb4e99

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
@@ -166,9 +166,10 @@ def calc_obstacle_cost(trajectory, ob, config):
166166
if config.robot_type == RobotType.rectangle:
167167
yaw = trajectory[:, 2]
168168
rot = np.array([[np.cos(yaw), -np.sin(yaw)], [np.sin(yaw), np.cos(yaw)]])
169+
rot = np.transpose(rot, [2, 0, 1])
169170
local_ob = ob[:, None] - trajectory[:, 0:2]
170171
local_ob = local_ob.reshape(-1, local_ob.shape[-1])
171-
local_ob = np.array([local_ob @ -x for x in rot.T])
172+
local_ob = np.array([local_ob @ -x for x in rot])
172173
local_ob = local_ob.reshape(-1, local_ob.shape[-1])
173174
upper_check = local_ob[:, 0] <= config.robot_length/2
174175
right_check = local_ob[:, 1] <= config.robot_width/2

0 commit comments

Comments
 (0)