admin-dashboard-backend/groupTasks/libs/robots/rex.py

32 lines
809 B
Python

import requests
class Rex:
"""
This class represents a rex robot.
"""
def __init__(self, rexName, jobName):
self.rexName = rexName
self.jobName = jobName
self.x = 0
self.y = 0
self.z = 0
def move(self, x, y, z):
"""
Move the robot to a new position.
"""
self.x = x
self.y = y
self.z = z
print("Robot: " + self.rexName + " moved to (" + str(self.x) + ", " + str(self.y) + ")")
requests.post("http://localhost:50055/v1/control/move", json={"x": self.x, "y": self.y, "z": self.z})
def finish():
"""
Finish the robot.
"""
print("Robot finished")
# TODO: request to the server to finish the robot and update the robot status to free