|
@@ -83,16 +83,8 @@ class Arduino:
|
|
|
#使用IIC总线进行数据通信
|
|
|
def i2c_connect(self):
|
|
|
try:
|
|
|
- rospy.loginfo("Connecting to Arduino on IIC addr:"+str(self.i2c_slave_addr))
|
|
|
+ rospy.loginfo("Connecting to Arduino on IIC addr: "+str(self.i2c_slave_addr))
|
|
|
test = self.i2c_get_baud()
|
|
|
- #test2 = self.getCurrentValue()
|
|
|
- #test3 = self.getBatPercent()
|
|
|
- #test4 = self.detect_distance()
|
|
|
- #test5 = self.analog_read(1)
|
|
|
- #test6 = self.digital_read(10)
|
|
|
- #test7 = self.i2c_get_pidin()
|
|
|
- #test8 = self.i2c_get_encoder_counts()
|
|
|
- #print test8
|
|
|
if test != self.baudrate:
|
|
|
time.sleep(1)
|
|
|
test = self.i2c_get_baud()
|
|
@@ -333,7 +325,6 @@ class Arduino:
|
|
|
|
|
|
def i2c_get_encoder_counts(self):
|
|
|
#print "IIC Get Encoder count !"
|
|
|
-
|
|
|
try:
|
|
|
self.i2c_bus.write_byte(self.i2c_slave_addr, int(ord('e')))
|
|
|
self.i2c_bus.write_byte(self.i2c_slave_addr, ord('\r'))
|
|
@@ -357,7 +348,6 @@ class Arduino:
|
|
|
traceback.print_exc(file=sys.stdout)
|
|
|
return None
|
|
|
|
|
|
-
|
|
|
def reset_encoders(self):
|
|
|
''' Reset the encoder counts to 0 by serial port
|
|
|
'''
|
|
@@ -529,7 +519,6 @@ class Arduino:
|
|
|
except:
|
|
|
return None
|
|
|
|
|
|
-
|
|
|
def getBatPercent(self):
|
|
|
'''get the remaining power percentage
|
|
|
'''
|