39 from std_srvs.srv
import Empty, EmptyResponse
41 from serial
import Serial
43 from rosserial_python
import SerialClient
as _SerialClient
45 MINIMUM_RESET_TIME = 30
54 rospy.Service(
'~reset_arduino', Empty, self.
resetArduino)
55 super(SerialClient, self).
__init__(*args, **kwargs)
59 Forces the Arduino to perform a reset, as though its reset button was pressed. 61 with self.read_lock, self.write_lock:
62 rospy.loginfo(
'Beginning Arduino reset on port %s. Closing serial port...' % self.port.portstr)
64 with Serial(self.port.portstr)
as arduino:
70 rospy.loginfo(
'Reopening serial port...')
72 rospy.loginfo(
'Arduino reset complete.')
75 return EmptyResponse()
81 if (rospy.Time.now() - self.
lastsync_reset).secs < MINIMUM_RESET_TIME:
82 rospy.loginfo(
'Sync has failed, but waiting for last reset to complete.')
84 rospy.loginfo(
'Sync has failed for over %s seconds. Initiating automatic reset.' % self.
auto_reset_timeout)
def __init__(self, args, kwargs)
def resetArduino(self, args, kwargs)
def sendDiagnostics(self, level, msg_text)