35 import roslib; roslib.load_manifest(
'kobuki_testsuite')
38 from kobuki_msgs.msg
import DigitalOutput
40 rospy.init_node(
"test_digital_output")
41 pub = rospy.Publisher(
'/mobile_base/commands/digital_output',DigitalOutput)
43 digital_output = DigitalOutput()
44 digital_output.values = [
False,
False,
False,
False]
45 digital_output.mask = [
True,
True,
False,
True ]
47 print "This program will start sending a variety of digital io signals to the robot." 48 print "It will set all output signals to false, then iteratively turn each one to True" 49 print "In doing so, it will cycle through a mask that will negate the setting for one" 50 print "of the outputs. The process then repeats itself masking the next output in the" 51 print "sequence instead." 53 while not rospy.is_shutdown():
56 index = digital_output.values.index(
False)
58 if not digital_output.values[i]:
59 digital_output.values[i] =
True 62 digital_output.values = [
False,
False,
False,
False]
63 index = digital_output.mask.index(
False)
64 digital_output.mask[index] =
True 68 next_index = index + 1
69 digital_output.mask[next_index] =
False 71 pub.publish(digital_output)