Skip to content
This repository was archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
Finalised code functionality
Browse files Browse the repository at this point in the history
Fixed downwards speed.
Fixed presettting winding up and winding down code.
Changed display to better message.
  • Loading branch information
polypies73 committed Oct 16, 2024
1 parent 9ebccde commit a659c04
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions client/drivers/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class HardwareComponents:
_PLANT_MOVER_PERIOD: float = 1000 * 60 / 55
_BASE_FULL_SPEED = 0.1
_FULL_SPEED_UPWARDS = _BASE_FULL_SPEED * (4 / 7) * (8 / 9) * 2
_FULL_SPEED_DOWNWARDS = (-1) * _BASE_FULL_SPEED * (4 / 5) * 2
_FULL_SPEED_DOWNWARDS = (-1) * _BASE_FULL_SPEED * (6 / 10) * 2

# SECTION: Constructors

Expand Down Expand Up @@ -277,7 +277,7 @@ def get_control_messages(self, user_id: int) -> List[str]:
Returns:
The messages to display to the user during the main application loop.
"""
return ["b0: logout", "id: " + str(user_id)]
return ["Left: logout", "ID: " + str(user_id)]

def initialise_posture_graph(self, user_id: int) -> None:
"""
Expand Down Expand Up @@ -326,22 +326,24 @@ def unwind_plant(self) -> None:
"""
self.plant_mover.speed = self._FULL_SPEED_UPWARDS
time.sleep(16 * self._PLANT_MOVER_PERIOD * self._PLANT_GEAR_RATIO / 1000)
self.plant_height = self._PLANT_SHAFT_TURNS - self._PLANT_SHAFT_SAFETY_BUFFER_TURNS
self.plant_mover.speed = 0

def wind_plant_safe(self) -> None:
"""
Wind the plant down to its minimum (safe) height.
Will also reset the `plant_height` to `0`.
"""
self.plant_mover.speed = self._FULL_SPEED_DOWNWARDS
time.sleep(
(self._PLANT_SHAFT_TURNS - self._PLANT_SHAFT_SAFETY_BUFFER_TURNS)
* self._PLANT_MOVER_PERIOD
* self._PLANT_GEAR_RATIO
/ 1000
)
self.plant_mover.speed = 0
self.plant_height = 0
self.set_plant_height(0)
# self.plant_mover.speed = self._FULL_SPEED_DOWNWARDS
# time.sleep(
# (self._PLANT_SHAFT_TURNS - self._PLANT_SHAFT_SAFETY_BUFFER_TURNS)
# * self._PLANT_MOVER_PERIOD
# * self._PLANT_GEAR_RATIO
# / 1000
# )
# self.plant_mover.speed = 0
# self.plant_height = 0

def set_plant_height(self, new_height: int) -> None:
"""
Expand Down

0 comments on commit a659c04

Please sign in to comment.