1
1
"""
2
- Post-process a session and generate a smoothed trajectory
2
+ Post-process a session and generate a smoothed trajectory with all frames
3
3
"""
4
4
import json
5
- from process .process import parse_input_dir , auto_config
6
5
7
- # --- The following mechanism allows using this both as a stand-alone
8
- # script and as a subcommand in sai-cli.
6
+ try :
7
+ from process .process import parse_input_dir , auto_config
8
+ except ImportError :
9
+ # hacky: The following mechanism allows using this both as a stand-alone
10
+ # script and as a subcommand in sai-cli.
11
+ from .process .process import parse_input_dir , auto_config
9
12
10
13
def define_args (parser ):
11
14
parser .add_argument ("input" , help = "Path to folder with session to process" )
@@ -14,6 +17,8 @@ def define_args(parser):
14
17
parser .add_argument ("--key_frame_distance" , help = "Minimum distance between keyframes (meters)" , type = float , default = 0.15 )
15
18
parser .add_argument ('--fast' , action = 'store_true' , help = 'Fast but lower quality settings' )
16
19
parser .add_argument ('--internal' , action = 'append' , type = str , help = 'Internal override parameters in the form --internal=name:value' )
20
+ parser .add_argument ('-t0' , '--start_time' , type = float , default = None , help = 'Start time in seconds' )
21
+ parser .add_argument ('-t1' , '--stop_time' , type = float , default = None , help = 'Stop time in seconds' )
17
22
parser .add_argument ("--preview" , help = "Show current key frame" , action = "store_true" )
18
23
parser .add_argument ("--preview3d" , help = "Show 3D visualization" , action = "store_true" )
19
24
return parser
@@ -187,7 +192,20 @@ def on_mapping_output(output):
187
192
188
193
print (config )
189
194
190
- replay = spectacularAI .Replay (args .input , mapperCallback = on_mapping_output , configuration = config , ignoreFolderConfiguration = True )
195
+ replayArgs = dict (
196
+ mapperCallback = on_mapping_output ,
197
+ configuration = config ,
198
+ ignoreFolderConfiguration = True
199
+ )
200
+
201
+ # Requires SDK 1.35+
202
+ if args .start_time is not None :
203
+ replayArgs ['startTime' ] = args .start_time
204
+ if args .stop_time is not None :
205
+ replayArgs ['stopTime' ] = args .stop_time
206
+
207
+ replay = spectacularAI .Replay (args .input , ** replayArgs )
208
+ replay .setPlaybackSpeed (- 1 ) # full speed
191
209
replay .setOutputCallback (on_vio_output )
192
210
193
211
try :
0 commit comments