Skip to content

Commit 87df848

Browse files
committed
Add try-except to key_teleop.py takeOff and land services
1 parent b02a198 commit 87df848

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ual_teleop/scripts/key_teleop.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ def execute(self):
223223
self.console.set_footer('')
224224
self.console.reset_box()
225225
# time.sleep(2)
226-
self.take_off(z_takeoff, True) # TODO: Non-blocking?
226+
try:
227+
self.take_off(z_takeoff, True) # TODO: Non-blocking?
228+
except rospy.ServiceException as exc:
229+
print("Service takeOff not process request: " + str(exc))
227230
return 'quit'
228231

229232
class LandState(State):
@@ -240,7 +243,10 @@ def execute(self):
240243
self.console.set_footer('')
241244
self.console.reset_box()
242245
# time.sleep(2)
243-
self.land(True) # TODO: Non-blocking?
246+
try:
247+
self.land(True) # TODO: Non-blocking?
248+
except rospy.ServiceException as exc:
249+
print("Service takeOff not process request: " + str(exc))
244250
return 'quit'
245251

246252
class VelState(State):

0 commit comments

Comments
 (0)