Fix action smoothing history and viewer timing control
This commit is contained in:
@@ -201,6 +201,10 @@ def parse_args():
|
||||
)
|
||||
parser.add_argument("--timeout", type=float, default=30.0, help="validation timeout in simulation seconds")
|
||||
parser.add_argument("--log-interval", type=float, default=0.5, help="pose log interval in simulation seconds")
|
||||
parser.add_argument(
|
||||
"--realtime-factor", type=float, default=1.0,
|
||||
help="viewer playback speed relative to wall time (default: 1.0)",
|
||||
)
|
||||
parser.add_argument("--manual", action="store_true", help="start with zero velocity and use keyboard commands")
|
||||
parser.add_argument("--headless", action="store_true", help="run validation without viewer or real-time delay")
|
||||
parser.add_argument("--no-validation", action="store_true", help="do not stop with automatic PASS/FAIL")
|
||||
@@ -217,6 +221,9 @@ def main():
|
||||
if args.headless and args.no_validation:
|
||||
print("[ERROR] --headless requires automatic validation", file=sys.stderr)
|
||||
return 2
|
||||
if args.realtime_factor <= 0.0:
|
||||
print("[ERROR] --realtime-factor must be positive", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
terrain_map = {
|
||||
"flat": "scene_dreamwaq_flat.xml",
|
||||
@@ -292,6 +299,7 @@ def main():
|
||||
"down={platform_end:.2f}->{down_end:.2f}m pass_x={pass_x:.2f}m".format(**course)
|
||||
)
|
||||
if not args.headless:
|
||||
print(f"[Viewer] realtime_factor={args.realtime_factor:.2f}x")
|
||||
print("[CTRL] W/S forward/back, Q/E lateral, A/D yaw, Space stop, R reset, Esc quit")
|
||||
|
||||
keyboard = None
|
||||
@@ -423,7 +431,7 @@ def main():
|
||||
|
||||
if view is not None:
|
||||
view.sync()
|
||||
deadline = wall_start + data.time
|
||||
deadline = wall_start + data.time / args.realtime_factor
|
||||
remaining = deadline - time.monotonic()
|
||||
if remaining > 0:
|
||||
time.sleep(remaining)
|
||||
|
||||
Reference in New Issue
Block a user