repository to manage all files related to the makeathon farm bot project (Software + Documentation).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

robot.py 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. class Robot:
  2. """
  3. This class contains the features of the robot. It is used as an interface for the main to avoid global variables and
  4. store them instead in an instance of this robot object
  5. """
  6. def __init__(self):
  7. self.robot_ready = True
  8. self.order_handler = []
  9. self.battery = 0
  10. self.position = ""
  11. self.last_error = ""
  12. def change_robot_status(self, status: bool):
  13. self.robot_ready = status
  14. def add_order(self, drivedata):
  15. self.order_handler.append(drivedata)
  16. def delete_order(self, drivedata):
  17. self.order_handler.remove(drivedata)
  18. def get_next_order(self):
  19. return self.order_handler[0]
  20. def get_order_number(self):
  21. return len(self.order_handler)
  22. def store_battery(self, battery):
  23. self.battery = battery
  24. def store_position(self, position):
  25. self.position = position
  26. def store_last_error(self, error):
  27. self.last_error = error
  28. def get_battery(self):
  29. return self.battery
  30. def get_position(self):
  31. return self.position
  32. def get_last_error(self):
  33. return self.last_error
  34. def get_robot_status(self):
  35. return self.robot_ready