37 from rosserial_arduino
import SerialClient
38 from serial
import SerialException
39 from time
import sleep
43 if __name__==
"__main__":
45 rospy.init_node(
"serial_node")
46 rospy.loginfo(
"ROS Serial Python Node")
48 port_name = rospy.get_param(
'~port',
'/dev/ttyUSB0')
49 baud = int(rospy.get_param(
'~baud',
'57600'))
53 auto_reset_timeout = int(rospy.get_param(
'~auto_reset_timeout',
'0'))
57 fix_pyserial_for_test = rospy.get_param(
'~fix_pyserial_for_test',
False)
60 sys.argv = rospy.myargv(argv=sys.argv)
61 if len(sys.argv) >= 2 :
62 port_name = sys.argv[1]
64 while not rospy.is_shutdown():
65 rospy.loginfo(
"Connecting to %s at %d baud" % (port_name, baud))
67 client = SerialClient(port_name, baud, fix_pyserial_for_test=fix_pyserial_for_test, auto_reset_timeout=auto_reset_timeout)
69 except KeyboardInterrupt:
71 except SerialException: