1
0
Fork 0

return wherami coordinates in preset format

This commit is contained in:
Kevin Matz 2019-08-05 16:47:08 -04:00
parent 7a848e26fc
commit fe41af0c6d
3 changed files with 6 additions and 2 deletions

View File

@ -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):

View File

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

View File

@ -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'}'):