From ef49e180895b48bf5c0d0d848000ecce6ad6a040 Mon Sep 17 00:00:00 2001 From: Arend-Jan van Hilten Date: Tue, 30 Apr 2024 14:10:37 +0000 Subject: [PATCH] try multiple oleds shutdown service --- .../scripts/ROS_telemetrix_aio_api.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/mirte_telemetrix/scripts/ROS_telemetrix_aio_api.py b/mirte_telemetrix/scripts/ROS_telemetrix_aio_api.py index 6983e5d6..9857a631 100755 --- a/mirte_telemetrix/scripts/ROS_telemetrix_aio_api.py +++ b/mirte_telemetrix/scripts/ROS_telemetrix_aio_api.py @@ -1645,14 +1645,15 @@ async def shutdown_robot(self): f"bash -c \"wall 'Shutting down.'\"", shell=True, ) - try: - set_image = rospy.ServiceProxy('/mirte/set_middle_image', SetOLEDImage) - set_image("text", "Shutting down") - - except rospy.ServiceException as e: - print("Service call failed: %s"%e) - except Exception as e: - print("shutdown image err", e) + for oled_name in ["right", "middle", "left"]: # TODO: use the oled obj directly without hard-coded names + try: + set_image = rospy.ServiceProxy(f'/mirte/set_{oled_name}_image', SetOLEDImage) + set_image("text", "Shutting down") + + except rospy.ServiceException as e: + print("Service call failed: %s"%e) + except Exception as e: + print("shutdown image err", e) rospy.logerr("Triggering shutdown, shutting down in 10s") # This will make the pico unresponsive after the delay, so ping errors are expected. Need to restart telemetrix to continue. if hasattr(self, "trigger_shutdown_relay"):