test_cyclic.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
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     #robot.control()
00020     robot.sci.safe()
00021     #rospy.sleep(2)
00022     #robot.sci.full()
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         #a = robot.sci.ser.read(17)
00032         a = robot.sci.ser.read(2)
00033         #(e1,e2,e3,e4,e5,e6,e7,e8,e9) = struct.unpack('>8hB', a[0:17])
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


wheeled_robin_node
Author(s): Johannes Mayr , Klemens Springer
autogenerated on Fri Aug 28 2015 13:39:00