forked from vinismarques/butia_navigation_system
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
khaledhazime
committed
Oct 23, 2019
1 parent
dec420b
commit ee3799b
Showing
2 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python | ||
import rospy | ||
from std_msgs.msg import Bool | ||
|
||
flag = False | ||
|
||
def callBackEM(response): | ||
global flag | ||
if response.data: | ||
flag = True | ||
else: | ||
flag = False | ||
|
||
|
||
if __name__ == "__main__": | ||
rospy.init_node("enable_motors") | ||
motors_sub = rospy.Subscriber("/RosAria/motors_state", Bool, callBackEM, queue_size=1) | ||
rospy.wait_for_service("/RosAria/enable_motors") | ||
try: | ||
enable_motors = rospy.ServiceProxy("/RosAria/enable_motors", Bool) | ||
except rospy.ServiceException, e: | ||
print "Service call failed %s"%e | ||
while not rospy.is_shutdown(): | ||
if not flag: | ||
enable_motors(True) |