From 42a75f27f2f7a3904980a9660f85ce78fa6a99ec Mon Sep 17 00:00:00 2001 From: Peter Corke Date: Sun, 5 Jul 2026 22:17:03 +1000 Subject: [PATCH] fix(mobile): gate driveto()'s per-step print behind verbose flag VehicleDriverBase.driveto() printed an unconditional status line on every call, unlike RandomPath._new_goal() right below it which correctly gates its print behind self._veh.verbose or self._verbose. Any simulation of more than a few steps floods stdout -- found while building a runblock example for docs/source/intro.rst's planned Mobile Robots section. Co-Authored-By: Claude Sonnet 5 --- src/roboticstoolbox/mobile/drivers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/roboticstoolbox/mobile/drivers.py b/src/roboticstoolbox/mobile/drivers.py index c4251d61..2f2e321f 100644 --- a/src/roboticstoolbox/mobile/drivers.py +++ b/src/roboticstoolbox/mobile/drivers.py @@ -147,10 +147,11 @@ def driveto(self, goal): goal_heading = atan2(goal[1] - self._veh._x[1], goal[0] - self._veh._x[0]) delta_heading = base.angdiff(goal_heading, self._veh._x[2]) - print( - f"t={self._veh._t:.1f}, pos=({self._veh._x[0]:.1f}, {self._veh._x[1]:.1f}), ", - f"goal_heading={goal_heading * 180 / pi:.1f}, delta_heading={delta_heading * 180 / pi:.1f}", - ) + if self._veh.verbose or self._verbose: + print( + f"t={self._veh._t:.1f}, pos=({self._veh._x[0]:.1f}, {self._veh._x[1]:.1f}), ", + f"goal_heading={goal_heading * 180 / pi:.1f}, delta_heading={delta_heading * 180 / pi:.1f}", + ) return np.r_[self._speed, self._headinggain * delta_heading]