mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-10-04 14:23:42 +08:00
nan-nan-nan
This commit is contained in:
@@ -187,10 +187,7 @@ def generate_queues_and_npy(input_shapes: dict, frame_skip: int, device: str = D
|
||||
queues['feat_q'] = Tensor(np.zeros((feat_q_len, features_buffer[0], feat_dim),
|
||||
dtype=np.float32), device=device).contiguous().realize()
|
||||
|
||||
for key in ('tfm', 'big_tfm'):
|
||||
if key not in npy_arrays:
|
||||
npy_arrays[key] = np.eye(3, dtype=np.float32)
|
||||
queues[key] = Tensor(npy_arrays[key], device='NPY').realize()
|
||||
queues.update({key: Tensor(value, device='NPY').realize() for key, value in npy_arrays.items() if key in ('tfm', 'big_tfm')})
|
||||
|
||||
return queues, npy_arrays
|
||||
|
||||
|
||||
@@ -209,13 +209,13 @@ def plan_x_idxs_helper(constants, plan, model_output) -> list[float]:
|
||||
while tidx < constants.IDX_N - 1 and plan_x[tidx + 1] < constants.X_IDXS[xidx]:
|
||||
tidx += 1
|
||||
if tidx == constants.IDX_N - 1:
|
||||
# if the plan doesn't extend far enough, set plan_t to the max value (10s), then break
|
||||
LINE_T_IDXS[xidx] = constants.T_IDXS[constants.IDX_N - 1]
|
||||
for rem_idx in range(xidx, constants.IDX_N):
|
||||
LINE_T_IDXS[rem_idx] = constants.T_IDXS[constants.IDX_N - 1]
|
||||
break
|
||||
# interpolate to find `t` for the current xidx
|
||||
current_x_val = plan_x[tidx]
|
||||
next_x_val = plan_x[tidx + 1]
|
||||
p = (constants.X_IDXS[xidx] - current_x_val) / (next_x_val - current_x_val) if abs(
|
||||
next_x_val - current_x_val) > 1e-9 else float('nan')
|
||||
next_x_val - current_x_val) > 1e-9 else 0.0
|
||||
LINE_T_IDXS[xidx] = p * constants.T_IDXS[tidx + 1] + (1 - p) * constants.T_IDXS[tidx]
|
||||
return LINE_T_IDXS
|
||||
|
||||
Reference in New Issue
Block a user