get list of values from preset string
This commit is contained in:
parent
14a11fc277
commit
f17f2c0a1f
9
robot.py
9
robot.py
|
@ -54,6 +54,15 @@ class Robot:
|
|||
return self.angle != values
|
||||
return self.angle != self.target
|
||||
|
||||
@staticmethod
|
||||
def read_preset(str):
|
||||
if str.startswith('{') and str.endswith('}'):
|
||||
str = str.lstrip('{').rstrip('}')
|
||||
else:
|
||||
return None # malformed packet
|
||||
data = str.split(',')
|
||||
return [int(val) for val in data]
|
||||
|
||||
def serial_read_handler(self, data):
|
||||
data = data.strip()
|
||||
if data.startswith(b'{') and data.endswith(b'}'):
|
||||
|
|
Loading…
Reference in New Issue