This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlowering_platform.py
62 lines (51 loc) · 2.07 KB
/
lowering_platform.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from science_clients.stepper_motor_client import StepperMotorClient
from science_clients.flashlight_client import FlashlightClient
from science_clients.uv_light_client import UVLightClient
from science_clients.brush_client import BrushClient
class Platform:
def __init__(self):
self.uv_light_on = False
self.flashlight_on = False
self.brush_on = False
self.stepper_motor_client = StepperMotorClient()
self.brush_client = BrushClient()
self.flashlight_client = FlashlightClient()
self.uv_light_client = UVLightClient()
def set_platform_height(self, height):
self.stepper_motor_client.send_request(height)
self.stepper_motor_client.run()
def turn_brush_on(self):
if self.brush_on:
self.brush_on = True
self.brush_client.send_request(self.brush_on)
self.brush_client.run()
def turn_brush_off(self):
if self.brush_on:
self.brush_on = False
self.brush_client.send_request(self.brush_on)
self.brush_client.run()
def turn_flashlight_on(self):
if not self.flashlight_on:
self.flashlight_on = True
self.flashlight_cli.send_request(self.flashlight_on)
self.flashlight_cli.run()
def turn_flashlight_off(self):
if self.flashlight_on:
self.flashlight_on = False
self.flashlight_cli.send_request(self.flashlight_on)
self.flashlight_cli.run()
def turn_uv_light_on(self):
if not self.uv_light_on:
self.uv_light_on = True
self.uv_light_client.send_request(self.uv_light_on)
self.uv_light_client.run()
def turn_uv_light_off(self):
if self.uv_light_on:
self.uv_light_on = False
self.uv_light_client.send_request(self.uv_light_on)
self.uv_light_client.run()
def close(self):
self.stepper_motor_client.destroy_node()
self.flashlight_client.destroy_node()
self.brush_client.destroy_node()
self.uv_light_client.destroy_node()