def get_positions(path):
  """
  Given one path = {positions, actions, best_iou, ordered}, note positions is a list of segment path ,
  we compute:
  - positions = [pos, pos, pos, ...], each is (x, y, z, yaw)
  - actions = [act, act, act, ...] whose last token is <STOP> (3)
  - key_ixs = [ix, ix], where agent at positions[ix] faces the target objects.
  - ordered = True or False
  """
  positions = [pos for seg_path in path['positions'] for pos in seg_path[1:]]
  positions.insert(0, path['positions'][0][0])  # add the spawned point
  actions = [act for seg_path in path['actions'] for act in seg_path[:-1]]
  actions.append(3) # add <STOP> in the end
  key_ixs, key_pos = [], []
  total_len = 0
  for i, seg_path in enumerate(path['positions'][:-1]):
    # last seg_path is toward end, no need being considered for key_ixs
    total_len += len(seg_path)
    key_ixs.append(total_len-i-1)
    key_pos.append(seg_path[-1])
  # check
  for ix, pos in zip(key_ixs, key_pos):
    assert positions[ix] == pos
  return positions, actions, key_ixs, path['ordered']