7 from std_msgs.msg
import UInt16
11 rospy.wait_for_service(
'/switch_motors')
13 p = rospy.ServiceProxy(
'/switch_motors', SwitchMotors)
16 except rospy.ServiceException, e:
17 print "Service call failed: %s"%e
22 pub = rospy.Publisher(
'/motor_raw', MotorFreqs, queue_size=10)
24 if not rospy.is_shutdown():
31 pub = rospy.Publisher(
'/buzzer', UInt16, queue_size=10)
32 rospy.init_node(
'operation_checker', anonymous=
True)
34 if not rospy.is_shutdown():
38 print "lightsensors:", data.left_forward, data.left_side, data.right_side, data.right_forward
41 print "switches:",data.front, data.center, data.rear
44 subls = rospy.Subscriber(
'/lightsensors', LightSensorValues, lightsensor_callback)
45 subsw = rospy.Subscriber(
'/switches', Switches, switch_callback)
49 rospy.wait_for_service(
'/put_motor_freqs')
51 p = rospy.ServiceProxy(
'/put_motor_freqs', PutMotorFreqs)
52 res = p(left_hz,right_hz,time_ms)
54 except rospy.ServiceException, e:
55 print "Service call failed: %s"%e
59 if __name__ ==
"__main__":
61 print >> sys.stderr,
"test of the buzzer" 67 print >> sys.stderr,
"test of raw control of the motors" 69 print "[check failed]: motors are not empowered" 82 print >> sys.stderr,
"test of position control of the motors" 87 print "[check failed]: motors are not turned off" 90 print >> sys.stderr,
"test of sensors" def raw_control(left_hz, right_hz)
def lightsensor_callback(data)
def pos_control(left_hz, right_hz, time_ms)
def switch_callback(data)