mirror of
https://github.com/YikeStone/ros_arduino_bridge.git
synced 2025-08-03 19:24:09 +05:30
Added missing resetEncoders() function to encoder_driver.ino
This commit is contained in:
parent
97946646d2
commit
d03061ae60
@ -32,6 +32,12 @@
|
|||||||
if (i == LEFT) return encoders.YAxisReset();
|
if (i == LEFT) return encoders.YAxisReset();
|
||||||
else return encoders.XAxisReset();
|
else return encoders.XAxisReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wrap the encoder reset function */
|
||||||
|
void resetEncoders() {
|
||||||
|
resetEncoder(LEFT);
|
||||||
|
resetEncoder(RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(ROBOGAIA_3_AXIS)
|
#elif defined(ROBOGAIA_3_AXIS)
|
||||||
/* Robogaia 3-axis encoder shield */
|
/* Robogaia 3-axis encoder shield */
|
||||||
|
@ -100,10 +100,10 @@ class Arduino:
|
|||||||
attempts = 1
|
attempts = 1
|
||||||
|
|
||||||
self.serial_port.write(cmd + '\r')
|
self.serial_port.write(cmd + '\r')
|
||||||
|
|
||||||
value = self.serial_port.readline().strip('\n')
|
value = self.serial_port.readline().strip('\n')
|
||||||
|
|
||||||
while len(value) == 0 and attempts < max_attempts:
|
while len(value) == 0 and attempts < max_attempts:
|
||||||
|
print "Command", cmd, "failed", attempts, "time(s)"
|
||||||
self.serial_port.write(cmd + '\r')
|
self.serial_port.write(cmd + '\r')
|
||||||
value = self.serial_port.readline().strip('\n')
|
value = self.serial_port.readline().strip('\n')
|
||||||
attempts += 1
|
attempts += 1
|
||||||
@ -141,6 +141,8 @@ class Arduino:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def get_encoder_counts(self):
|
def get_encoder_counts(self):
|
||||||
|
''' Read the current encoder counts
|
||||||
|
'''
|
||||||
values = self.execute_array('e')
|
values = self.execute_array('e')
|
||||||
|
|
||||||
if len(values) != 2:
|
if len(values) != 2:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user