Question about frame serialization semantics in closed_loop.py
I am trying to understand the intended meaning of each saved frame in data.pkl.
In the original implementation of closed_loop.py, the code does:
acc, steer_rate = traj2control(plan_traj, info)
obs, reward, terminated, truncated, info = env.step(action)
imu_plan_traj = plan_traj[:, [1, 0]]
imu_plan_traj[:, 1] *= -1
global_traj = traj_transform_to_global(imu_plan_traj, info['ego_box'])
save_data['frames'].append({
'time_stamp': info['timestamp'],
'ego_box': info['ego_box'],
'obj_boxes': info['obj_boxes'],
'planned_traj': {
'traj': global_traj,
'timestep': 0.5
},
'collision': info['collision'],
'rc': info['rc']
})
My understanding
This means the saved frame uses post-step info for everything:
time_stamp
ego_box
obj_boxes
planned_traj
collision
rc
But the plan_traj itself was generated from the observation/info before env.step().
So semantically, this looks like:
- generate
plan_t from obs_t
- convert
plan_t to control
- execute one step to get
info_{t+dt}
- save the frame using
info_{t+dt} and also transform the original plan using info['ego_box']
What confuses me
This seems to make the saved trajectory no longer correspond exactly to the state from which it was generated.
In other words, the recorded frame is not a pure planning-time snapshot, but rather something like:
- plan generated at time
t
- saved together with state/outcome at time
t+dt
I want to confirm whether this is intentional.
Specific questions
-
Is this the intended semantics of a frame in data.pkl?
- a post-step frame that stores the previous plan aligned to the new ego state?
-
Was it intentional to transform plan_traj using info['ego_box'] after env.step(), instead of the ego pose at planning time?
-
Is collision / rc supposed to be interpreted as:
- labels for the saved frame after execution, or
- labels for the state when the plan was generated?
-
If this is intentional, what is the reasoning behind this choice?
- for example, is the goal to evaluate the plan after one control interval has been consumed?
Why I am asking
I noticed that using post-step info for the saved frame can change evaluation behavior noticeably, and I want to make sure I follow the original intended protocol rather than reinterpreting it incorrectly.
if plan_traj is not None:
current_info = info # info before env.step()
acc, steer_rate = traj2control(plan_traj, info, wheelbase=wheelbase)
action = {'acc': acc, 'steer_rate': steer_rate}
obs, reward, terminated, truncated, info = env.step(action) # info after env.step()
imu_plan_traj = plan_traj[:, [1, 0]]
imu_plan_traj[:, 1] *= -1
global_traj = traj_transform_to_global(imu_plan_traj, current_info['ego_box'])
save_data['frames'].append({
'time_stamp': current_info['timestamp'],
'ego_box': current_info['ego_box'],
'obj_boxes': current_info['obj_boxes'],
'planned_traj': {
'traj': global_traj,
'timestep': 0.5
},
'collision': info['collision'],
'rc': info['rc']
})
’’’
if this change is right?
Thanks.
Question about frame serialization semantics in
closed_loop.pyI am trying to understand the intended meaning of each saved frame in
data.pkl.In the original implementation of
closed_loop.py, the code does:My understanding
This means the saved frame uses post-step
infofor everything:time_stampego_boxobj_boxesplanned_trajcollisionrcBut the
plan_trajitself was generated from the observation/info beforeenv.step().So semantically, this looks like:
plan_tfromobs_tplan_tto controlinfo_{t+dt}info_{t+dt}and also transform the original plan usinginfo['ego_box']What confuses me
This seems to make the saved trajectory no longer correspond exactly to the state from which it was generated.
In other words, the recorded frame is not a pure planning-time snapshot, but rather something like:
tt+dtI want to confirm whether this is intentional.
Specific questions
Is this the intended semantics of a frame in
data.pkl?Was it intentional to transform
plan_trajusinginfo['ego_box']afterenv.step(), instead of the ego pose at planning time?Is
collision/rcsupposed to be interpreted as:If this is intentional, what is the reasoning behind this choice?
Why I am asking
I noticed that using post-step
infofor the saved frame can change evaluation behavior noticeably, and I want to make sure I follow the original intended protocol rather than reinterpreting it incorrectly.