Skip to content

Commit 9dc9394

Browse files
committed
fix: lost _last_ack
1 parent 33a98f9 commit 9dc9394

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arduino_alvik.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(self):
6666
self._bottom_tof = None
6767
self._linear_velocity = None
6868
self._angular_velocity = None
69-
self._angular_velocity = ''
69+
self._last_ack = ''
7070
self._version = [None, None, None]
7171

7272
@staticmethod
@@ -191,7 +191,7 @@ def _wait_for_ack(self) -> None:
191191
Waits until receives 0x00 ack from robot
192192
:return:
193193
"""
194-
while self._angular_velocity != 0x00:
194+
while self._last_ack != 0x00:
195195
sleep_ms(20)
196196

197197
@staticmethod
@@ -231,7 +231,7 @@ def is_target_reached(self) -> bool:
231231
It also responds with an ack received message
232232
:return:
233233
"""
234-
if self._angular_velocity != ord('M') and self._angular_velocity != ord('R'):
234+
if self._last_ack != ord('M') and self._last_ack != ord('R'):
235235
sleep_ms(50)
236236
return False
237237
else:
@@ -476,7 +476,7 @@ def get_ack(self):
476476
Returns last acknowledgement
477477
:return:
478478
"""
479-
return self._angular_velocity
479+
return self._last_ack
480480

481481
# def send_ack(self):
482482
# self._packeter.packetC1B(ord('X'), ACK_)
@@ -597,7 +597,7 @@ def _parse_message(self) -> int:
597597
_, self._linear_velocity, self._angular_velocity = self._packeter.unpacketC2F()
598598
elif code == ord('x'):
599599
# robot ack
600-
_, self._angular_velocity = self._packeter.unpacketC1B()
600+
_, self._last_ack = self._packeter.unpacketC1B()
601601
elif code == ord('z'):
602602
# robot ack
603603
_, self._x, self._y, self._theta = self._packeter.unpacketC3F()

0 commit comments

Comments
 (0)