1919app = typer .Typer (help = "Replay recorded MuJoCo trajectories from a parquet dataset." )
2020
2121DATASET_ARGUMENT = typer .Argument (..., exists = True , file_okay = False , dir_okay = True )
22- ENV_ID_OPTION = typer .Option ("rcs/FR3SimplePickUpSim-v0" , help = "Gymnasium env id used for replay." )
23- TRAJECTORY_UUID_OPTION = typer .Option (None , help = "UUID of the recorded trajectory to replay." )
24- CAMERA_OPTION = typer .Option ([], "--camera" , help = "Camera names to enable on the replay env." )
25- RESOLUTION_OPTION = typer .Option ((256 , 256 ), help = "Replay camera resolution as WIDTH HEIGHT." )
26- FRAME_RATE_OPTION = typer .Option (0 , help = "Replay camera frame rate." )
27- RENDER_MODE_OPTION = typer .Option ("human" , help = "Gym render mode for the replay env." )
28- CONTROL_MODE_OPTION = typer .Option (ControlMode .CARTESIAN_TRPY .name , help = "Control mode name for env creation." )
29- SLEEP_OPTION = typer .Option (0.0 , help = "Optional delay between restored states." )
30- OUTPUT_DIR_OPTION = typer .Option (None , help = "Optional directory for re-rendered RGB frames." )
31- PREFER_DUCKDB_OPTION = typer .Option (True , help = "Use duckdb for parquet loading when it is available." )
22+
23+ ENV_ID_OPTION = typer .Option (help = "Gymnasium env id used for replay." )
24+ TRAJECTORY_UUID_OPTION = typer .Option (help = "UUID of the recorded trajectory to replay." )
25+ CAMERA_OPTION = typer .Option ("--camera" , help = "Camera names to enable on the replay env." )
26+ RESOLUTION_OPTION = typer .Option (help = "Replay camera resolution as WIDTH HEIGHT." )
27+ FRAME_RATE_OPTION = typer .Option (help = "Replay camera frame rate." )
28+ RENDER_MODE_OPTION = typer .Option (help = "Gym render mode for the replay env." )
29+ CONTROL_MODE_OPTION = typer .Option (help = "Control mode name for env creation." )
30+ SLEEP_OPTION = typer .Option (help = "Optional delay between restored states." )
31+ OUTPUT_DIR_OPTION = typer .Option (help = "Optional directory for re-rendered RGB frames." )
32+ PREFER_DUCKDB_OPTION = typer .Option (help = "Use duckdb for parquet loading when it is available." )
3233
3334
3435@dataclass (frozen = True )
@@ -193,6 +194,7 @@ def replay_trajectory(
193194 env .reset ()
194195 for recorded_step in recorded_steps :
195196 restore_sim_step (env , recorded_step )
197+ env .get_wrapper_attr ("sim" ).step (1 )
196198 if output_dir is not None :
197199 save_rgb_frames (output_dir , recorded_step , collect_rgb_frames (env ))
198200 if sleep_s > 0 :
@@ -202,17 +204,19 @@ def replay_trajectory(
202204@app .command ()
203205def replay (
204206 dataset : Annotated [Path , DATASET_ARGUMENT ],
205- env_id : Annotated [str , ENV_ID_OPTION ],
206- trajectory_uuid : Annotated [str | None , TRAJECTORY_UUID_OPTION ],
207- camera : Annotated [list [str ], CAMERA_OPTION ],
208- resolution : Annotated [tuple [int , int ], RESOLUTION_OPTION ],
209- frame_rate : Annotated [int , FRAME_RATE_OPTION ],
210- render_mode : Annotated [str , RENDER_MODE_OPTION ],
211- control_mode : Annotated [str , CONTROL_MODE_OPTION ],
212- sleep_s : Annotated [float , SLEEP_OPTION ],
213- output_dir : Annotated [Path | None , OUTPUT_DIR_OPTION ],
214- prefer_duckdb : Annotated [bool , PREFER_DUCKDB_OPTION ],
207+ env_id : Annotated [str , ENV_ID_OPTION ] = "rcs/FR3SimplePickUpSim-v0" ,
208+ trajectory_uuid : Annotated [str | None , TRAJECTORY_UUID_OPTION ] = None ,
209+ camera : Annotated [list [str ] | None , CAMERA_OPTION ] = None ,
210+ resolution : Annotated [tuple [int , int ], RESOLUTION_OPTION ] = ( 256 , 256 ) ,
211+ frame_rate : Annotated [int , FRAME_RATE_OPTION ] = 0 ,
212+ render_mode : Annotated [str , RENDER_MODE_OPTION ] = "human" ,
213+ control_mode : Annotated [str , CONTROL_MODE_OPTION ] = ControlMode . CARTESIAN_TRPY . name ,
214+ sleep_s : Annotated [float , SLEEP_OPTION ] = 0.0 ,
215+ output_dir : Annotated [Path | None , OUTPUT_DIR_OPTION ] = None ,
216+ prefer_duckdb : Annotated [bool , PREFER_DUCKDB_OPTION ] = True ,
215217):
218+ if camera is None :
219+ camera = []
216220 resolved_uuid = resolve_trajectory_uuid (dataset , trajectory_uuid , prefer_duckdb = prefer_duckdb )
217221 env = gym .make (
218222 env_id ,
0 commit comments