Go to the documentation of this file.00001
00002 import rospy
00003 import struct
00004 import sys
00005 from std_msgs.msg import String
00006 from wheeled_robin_driver import WheeledRobin
00007
00008 def printf(format, *args):
00009 sys.stdout.write(format % args)
00010
00011 def talker():
00012 pub = rospy.Publisher('chatter', String)
00013 rospy.init_node('talker')
00014
00015 robot = WheeledRobin()
00016
00017 robot.start()
00018 rospy.sleep(1)
00019
00020 robot.sci.safe()
00021
00022
00023 rospy.sleep(2)
00024
00025
00026 r = rospy.Rate(10)
00027 while not rospy.is_shutdown():
00028 robot.drive(0,0)
00029 robot.sci.flush_input()
00030 robot.sci.sensors(7)
00031
00032 a = robot.sci.ser.read(2)
00033
00034 (e1) = struct.unpack('>h', a)
00035 printf('res: %r \n',e1)
00036 r.sleep()
00037
00038
00039 if __name__ == '__main__':
00040 try:
00041 talker()
00042 except rospy.ROSInterruptException:
00043 pass