Skip to content

Commit

Permalink
Disable motors on until Crazyflie has rebooted.
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerfolk committed Dec 17, 2024
1 parent 485fa00 commit ef7c92f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rqt_mav_manager/src/rqt_mav_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ef7c92f

Please sign in to comment.