-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass.py
52 lines (42 loc) · 1.18 KB
/
class.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
from hal import set_angle
import time
class Glass:
""" the current glass object"""
def __init__(self,level,position)
self.level = level # Pourcent of fill
self.position = position
class Ingredient:
def __init__(self,name, position, category):
self.name = name
self.position = position
self.category = category
class Dose:
def __init__(self,ingredient,quantity):
self.ingredient = ingredient
self.quantity = quantity
Coca = Ingredient('Coca',1,'Soft')
Eau = Ingredient('Eau',2,'Soft')
Orange = Ingredient('Orange',3,'Soft')
Whiskey = Ingredient('Whiskey',4,'Hard')
D_Whiskey = Dose(Whiskey,1)
D_Coca = Dose(Coca,7)
R_Whiskey_Coca = [D_Whiskey,D_Coca]
MyCup = Glass(0,0)
def fetch_position(Dose):
""" Check wich sens is faster (in step)"""
if (MyCup.position - Dose.ingredient.position)>100:
sens = 1
else :
sens = 0
set_angle(sens,MyCup.position - Dose.ingredient.position)
MyCup.position = Dose.ingredient.position;
if Dose.ingredient.category == 'Soft':
## Enable Soft Pump
time.sleep(Dose.quantity)
## Disable Soft Pump
else:
""" Grow up glass """
time.sleep(Dose.quantity)
""" Grow down glass """
MyCup.level += Dose.quantity
def make_cocktail(receipe):