From ef7c92fd271a3d41a44a64d2458616a07e79cf74 Mon Sep 17 00:00:00 2001 From: spencerfolk Date: Tue, 17 Dec 2024 14:33:32 -0500 Subject: [PATCH] Disable motors on until Crazyflie has rebooted. --- rqt_mav_manager/src/rqt_mav_manager/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rqt_mav_manager/src/rqt_mav_manager/__init__.py b/rqt_mav_manager/src/rqt_mav_manager/__init__.py index 85665c2a..12c0fdd7 100644 --- a/rqt_mav_manager/src/rqt_mav_manager/__init__.py +++ b/rqt_mav_manager/src/rqt_mav_manager/__init__.py @@ -6,6 +6,7 @@ import rospy from python_qt_binding import loadUi from python_qt_binding.QtWidgets import QWidget +from PyQt5.QtCore import QTimer from rqt_gui_py.plugin import Plugin import kr_mav_manager.srv @@ -66,11 +67,15 @@ def _on_motors_on_pressed(self): def _on_motors_off_pressed(self): try: + self._widget.motors_on_push_button.setEnabled(False) motors_topic = '/'+self.robot_name+'/'+self.mav_node_name+'/motors' rospy.wait_for_service(motors_topic, timeout=1.0) motors_off = rospy.ServiceProxy(motors_topic, std_srvs.srv.SetBool) resp = motors_off(False) print(resp.success) + + QTimer.singleShot(3000, lambda: self._widget.motors_on_push_button.setEnabled(True)) + except rospy.ServiceException as e: print("Service call failed: %s"%e) except(rospy.ROSException) as e: