return wherami coordinates in preset format
This commit is contained in:
parent
7a848e26fc
commit
fe41af0c6d
|
@ -85,7 +85,7 @@ class ArmCtlListener(ArmControlListener):
|
|||
|
||||
# Exit a parse tree produced by ArmControlParser#WhereAmI.
|
||||
def exitWhereAmI(self, ctx: ArmControlParser.WhereAmIContext):
|
||||
print(self.r.target)
|
||||
print(self.r.to_preset_string(self.r.target))
|
||||
|
||||
# Enter a parse tree produced by ArmControlParser#coords.
|
||||
def enterCoords(self, ctx: ArmControlParser.CoordsContext):
|
||||
|
|
|
@ -90,7 +90,7 @@ Wait for the arm to stop moving.
|
|||
If time is given, pause for that amount of time after movement has completed. If time is omitted, do the next command immediately after movement stops.
|
||||
#### pass
|
||||
Do nothing.
|
||||
#### wherami
|
||||
#### whereami
|
||||
Print out the current coordinates of the arm.
|
||||
|
||||
### Shell Commands
|
||||
|
|
|
@ -61,6 +61,10 @@ class Robot:
|
|||
data = str.split(',')
|
||||
return [int(val) for val in data]
|
||||
|
||||
@staticmethod
|
||||
def to_preset_string(list):
|
||||
return "{" + ",".join([str(val) for val in list]) + "}"
|
||||
|
||||
def serial_read_handler(self, data):
|
||||
data = data.strip()
|
||||
if data.startswith(b'{') and data.endswith(b'}'):
|
||||
|
|
Loading…
Reference in New Issue