From 4ee99578cfec12d57859dd24b50efa85c74e1513 Mon Sep 17 00:00:00 2001 From: Daniel Pike Date: Wed, 22 Jul 2026 02:29:20 -0400 Subject: [PATCH] fix(sim): reject non-finite wind components in gz_wind Fail closed on NaN/Inf west/south components before publishing Wind. Signed-off-by: Daniel Pike --- simulation/simulation_resources/scripts/gz_wind.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/simulation/simulation_resources/scripts/gz_wind.py b/simulation/simulation_resources/scripts/gz_wind.py index b70163a9..eb209b9e 100644 --- a/simulation/simulation_resources/scripts/gz_wind.py +++ b/simulation/simulation_resources/scripts/gz_wind.py @@ -4,6 +4,7 @@ python3 gz_wind.py --stop_wind """ import os +import math import time import argparse import gz.transport13 @@ -16,7 +17,10 @@ def main(): parser.add_argument('--from_south', type=float, default=0.0, help='Wind velocity from south toward north (m/s, Gazebo +Y)') parser.add_argument('--stop_wind', dest='stop_wind', action='store_true', help='Disable WindEffects (stop wind)') args = parser.parse_args() - + for name, val in (('from_west', args.from_west), ('from_south', args.from_south)): + if not math.isfinite(val): + parser.error(f'--{name} must be a finite number (got {val!r})') + world_name = os.environ.get('WORLD', 'default') gz_node = gz.transport13.Node()