Spaces:
Paused
Paused
support predicted orientation
Browse files
code/sim/utils/sim_utils.py
CHANGED
|
@@ -57,10 +57,13 @@ def traj2control(plan_traj, info):
|
|
| 57 |
"""
|
| 58 |
plan_traj_stats = np.zeros((plan_traj.shape[0]+1, 5))
|
| 59 |
plan_traj_stats[1:, :2] = plan_traj[:, [1,0]]
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
| 64 |
curr_stat = np.array(
|
| 65 |
[0, 0, 0, info['ego_velo'], info['ego_steer']]
|
| 66 |
)
|
|
|
|
| 57 |
"""
|
| 58 |
plan_traj_stats = np.zeros((plan_traj.shape[0]+1, 5))
|
| 59 |
plan_traj_stats[1:, :2] = plan_traj[:, [1,0]]
|
| 60 |
+
if plan_traj.shape[1] == 4:
|
| 61 |
+
plan_traj_stats[1:, 2] = plan_traj[:, 2]
|
| 62 |
+
else:
|
| 63 |
+
prev_a, prev_b = 0, 0
|
| 64 |
+
for i, (a, b) in enumerate(plan_traj):
|
| 65 |
+
rot = np.arctan((b - prev_b)/(a - prev_a))
|
| 66 |
+
plan_traj_stats[i+1, 2] = rot
|
| 67 |
curr_stat = np.array(
|
| 68 |
[0, 0, 0, info['ego_velo'], info['ego_steer']]
|
| 69 |
)
|