37 import roslib; roslib.load_manifest(
'kobuki_testsuite')
39 import sys, select, termios, tty
41 from datetime
import datetime
43 from kobuki_msgs.msg
import DigitalOutput
46 tty.setraw(sys.stdin.fileno())
47 rlist, _, _ = select.select([sys.stdin], [], [], 0.1)
49 key = sys.stdin.read(1)
64 sys.stdout.write(
'\r ')
65 for idx
in range(0,4):
68 sys.stdout.write(
'[ \033[1mOn\033[0m] ')
71 sys.stdout.write(
'[Off] ')
72 sys.stdout.write(
'\r')
83 settings = termios.tcgetattr(sys.stdin)
86 sys.stdout.write(
'\r\n')
88 termios.tcsetattr(sys.stdin, termios.TCSADRAIN, settings)
90 rospy.init_node(
"test_external_power")
91 rospy.on_shutdown(clearing)
92 pub = rospy.Publisher(
'/mobile_base/commands/external_power',DigitalOutput)
94 digital_output = DigitalOutput()
95 digital_output.values = [
True,
True,
True,
True ]
96 digital_output.mask = [
True,
True,
True,
True ]
100 print "Control External Power" 101 print "----------------------" 102 print "1: Toggle the state of 3.3V" 103 print "2: Toggle the state of 5V" 104 print "3: Toggle the state of 12V5A(arm)" 105 print "4: Toggle the state of 12V1A(kinect)" 110 print " 3.3V 5.0V 12V5A 12V1A" 114 while pub.get_num_connections():
116 pub.publish(digital_output)
118 while not rospy.is_shutdown():
121 if key ==
'':
continue 122 if key ==
'q' or key ==
'Q':
123 rospy.signal_shutdown(
'user request')
124 elif key
in keyBindings.keys():
125 digital_output.values[keyBindings[key]] ^=
True 129 pub.publish(digital_output)