Browse Source

更新arduino_node.py

corvin_zhang 4 years ago
parent
commit
0ad69e1027

+ 0 - 2
src/ros_arduino_bridge/ros_arduino_python/nodes/arduino_node.py

@@ -103,8 +103,6 @@ class ArduinoROS():
 
             if params['type'] == "GP2Y0A41":
                 sensor = GP2Y0A41(self.controller, name, params['pin'], params['rate'], self.base_frame)
-            elif params['type'] == "IR2Y0A02":
-                sensor = IR2Y0A02(self.controller, name, params['pin'], params['rate'], self.base_frame)
             elif params['type'] == 'Digital':
                 sensor = DigitalSensor(self.controller, name, params['pin'], params['rate'], self.base_frame, direction=params['direction'])
             elif params['type'] == 'Analog':

+ 1 - 12
src/ros_arduino_bridge/ros_arduino_python/src/ros_arduino_python/arduino_driver.py

@@ -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
         '''