Commit ultra solide !
This commit is contained in:
parent
1b624c0bae
commit
30b7b81041
@ -1,4 +0,0 @@
|
|||||||
[Dolphin]
|
|
||||||
PreviewsShown=true
|
|
||||||
Timestamp=2017,1,18,16,56,50
|
|
||||||
Version=3
|
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -47,3 +47,6 @@ pyvenv.cfg
|
|||||||
.venv
|
.venv
|
||||||
*.egg
|
*.egg
|
||||||
pip-selfcheck.json
|
pip-selfcheck.json
|
||||||
|
|
||||||
|
# dolphin de merde
|
||||||
|
.directory
|
@ -1,6 +0,0 @@
|
|||||||
[Dolphin]
|
|
||||||
Timestamp=2017,1,18,15,21,34
|
|
||||||
Version=3
|
|
||||||
|
|
||||||
[Settings]
|
|
||||||
HiddenFilesShown=true
|
|
@ -27,11 +27,11 @@ class automate:
|
|||||||
self.form = larg[0]
|
self.form = larg[0]
|
||||||
self.state = 1
|
self.state = 1
|
||||||
|
|
||||||
elif larg[0] == "Z":
|
elif larg[0] == "TRAIT":
|
||||||
self.__reinit_timer()
|
self.__reinit_timer()
|
||||||
self.state = 4
|
self.state = 4
|
||||||
|
|
||||||
elif larg[0] == "TRAIT":
|
elif larg[0] == "Z":
|
||||||
self.__reinit_timer()
|
self.__reinit_timer()
|
||||||
self.state = 7
|
self.state = 7
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class automate:
|
|||||||
self.__maybe_send_create()
|
self.__maybe_send_create()
|
||||||
self.state = 1
|
self.state = 1
|
||||||
|
|
||||||
elif self.state == 4 and larg[0].split(" ")[0] == "la" and int(larg[0].split(",")[1][0:2]) > 85:
|
elif self.state == 4 and larg[0].split(" ")[0] == "là" and int(larg[0].split(",")[1][0:2]) > 85:
|
||||||
self.__reinit_timer()
|
self.__reinit_timer()
|
||||||
self.la_xy = self.xy
|
self.la_xy = self.xy
|
||||||
self.state = 6
|
self.state = 6
|
||||||
@ -118,12 +118,18 @@ class automate:
|
|||||||
self.ca_xy = self.xy
|
self.ca_xy = self.xy
|
||||||
self.state = 5
|
self.state = 5
|
||||||
|
|
||||||
elif self.state == 5 and larg[0].split(" ")[0] == "la" and int(larg[0].split(",")[1][0:2]) > 85:
|
elif self.state == 5 and larg[0].split(" ")[0] == "là" and int(larg[0].split(",")[1][0:2]) > 85:
|
||||||
self.__reinit_timer()
|
self.__reinit_timer()
|
||||||
self.la_xy = self.xy
|
self.la_xy = self.xy
|
||||||
self.__maybe_send_deplacer()
|
self.__maybe_send_deplacer()
|
||||||
self.state = 4
|
self.state = 4
|
||||||
|
|
||||||
|
elif self.state == 6 and larg[0].split(" ")[0] == "ça" and int(larg[0].split(",")[1][0:2]) > 85:
|
||||||
|
self.__reinit_timer()
|
||||||
|
self.ca_xy = self.xy
|
||||||
|
self.__maybe_send_deplacer()
|
||||||
|
self.state = 4
|
||||||
|
|
||||||
elif self.state == 7 and ("ce rectangle" in larg[0] or "ce rond" in larg[0]) and int(larg[0].split(",")[1][0:2]) > 85:
|
elif self.state == 7 and ("ce rectangle" in larg[0] or "ce rond" in larg[0]) and int(larg[0].split(",")[1][0:2]) > 85:
|
||||||
self.__reinit_timer()
|
self.__reinit_timer()
|
||||||
if "ce rectangle" in larg[0]:
|
if "ce rectangle" in larg[0]:
|
||||||
@ -139,7 +145,9 @@ class automate:
|
|||||||
print("all " + str(larg))
|
print("all " + str(larg))
|
||||||
|
|
||||||
def __timeout(self):
|
def __timeout(self):
|
||||||
if self.state in [1, 4]:
|
print("timeout")
|
||||||
|
print("state = " + str(self.state))
|
||||||
|
if self.state in [1, 4, 7]:
|
||||||
self.form = None
|
self.form = None
|
||||||
self.state = 0
|
self.state = 0
|
||||||
|
|
||||||
@ -155,8 +163,14 @@ class automate:
|
|||||||
self.color = None
|
self.color = None
|
||||||
self.state = 4
|
self.state = 4
|
||||||
|
|
||||||
|
elif self.state == 8:
|
||||||
|
self.form = None
|
||||||
|
self.state = 4
|
||||||
|
|
||||||
|
|
||||||
|
print("endstate = " + str(self.state))
|
||||||
|
|
||||||
def __reinit_timer(self):
|
def __reinit_timer(self):
|
||||||
pass
|
|
||||||
if self.timer:
|
if self.timer:
|
||||||
self.timer.cancel()
|
self.timer.cancel()
|
||||||
self.timer = Timer(5, self.__timeout)
|
self.timer = Timer(5, self.__timeout)
|
||||||
@ -174,7 +188,7 @@ class automate:
|
|||||||
print("Send Deplacer")
|
print("Send Deplacer")
|
||||||
IvySendMsg("MULTIMODAL:deplacer ca_x={} ca_y={} la_x={} la_y={} couleur={}"
|
IvySendMsg("MULTIMODAL:deplacer ca_x={} ca_y={} la_x={} la_y={} couleur={}"
|
||||||
.format(self.ca_xy[0], self.ca_xy[1], self.la_xy[0], self.la_xy[1],
|
.format(self.ca_xy[0], self.ca_xy[1], self.la_xy[0], self.la_xy[1],
|
||||||
self.color if not None else ""))
|
self.color))
|
||||||
self.ca_xy = None
|
self.ca_xy = None
|
||||||
self.la_xy = None
|
self.la_xy = None
|
||||||
self.xy = None
|
self.xy = None
|
||||||
@ -186,7 +200,7 @@ class automate:
|
|||||||
print("Send Delete")
|
print("Send Delete")
|
||||||
IvySendMsg("MULTIMODAL:supprimer forme={} x={} y={} couleur={}"
|
IvySendMsg("MULTIMODAL:supprimer forme={} x={} y={} couleur={}"
|
||||||
.format(self.form, self.xy[0], self.xy[1],
|
.format(self.form, self.xy[0], self.xy[1],
|
||||||
self.color if not None else ""))
|
self.color))
|
||||||
self.xy = None
|
self.xy = None
|
||||||
self.color = None
|
self.color = None
|
||||||
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
[Dolphin]
|
|
||||||
Timestamp=2017,1,18,15,21,46
|
|
||||||
Version=3
|
|
||||||
|
|
||||||
[Settings]
|
|
||||||
HiddenFilesShown=true
|
|
@ -43,7 +43,7 @@ class Form:
|
|||||||
def aim_delete(l_form, type_form, x, y, color=""):
|
def aim_delete(l_form, type_form, x, y, color=""):
|
||||||
for form in l_form:
|
for form in l_form:
|
||||||
if form.__class__.__name__.upper() == type_form.upper() and form.is_in(x, y) \
|
if form.__class__.__name__.upper() == type_form.upper() and form.is_in(x, y) \
|
||||||
and color in ("", form.color):
|
and color in ("None", form.color):
|
||||||
form.delete()
|
form.delete()
|
||||||
l_form.remove(form)
|
l_form.remove(form)
|
||||||
break
|
break
|
||||||
@ -57,7 +57,7 @@ class Form:
|
|||||||
def aim_move(l_form, x, y, tx, ty, color=""):
|
def aim_move(l_form, x, y, tx, ty, color=""):
|
||||||
for form in l_form:
|
for form in l_form:
|
||||||
if form.is_in(x, y)\
|
if form.is_in(x, y)\
|
||||||
and color in ("", form.color):
|
and color in ("None", form.color):
|
||||||
form.delete()
|
form.delete()
|
||||||
form.x = tx
|
form.x = tx
|
||||||
form.y = ty
|
form.y = ty
|
||||||
@ -72,7 +72,7 @@ class Rond(Form):
|
|||||||
self.radius = radius
|
self.radius = radius
|
||||||
|
|
||||||
def is_in(self, x, y):
|
def is_in(self, x, y):
|
||||||
return (x - self.x) ** 2 + (y - self.y) ** 2 < self.radius ** 2
|
return (x - self.x) ** 2 + (y - self.y - self.radius) ** 2 < self.radius ** 2
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
self._setup_draw(self.x, self.y, self.color)
|
self._setup_draw(self.x, self.y, self.color)
|
||||||
@ -123,6 +123,7 @@ class MyTurtle(turtle.Turtle):
|
|||||||
IvySendMsg("PALETTE x={} y={}".format(x, y))
|
IvySendMsg("PALETTE x={} y={}".format(x, y))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MyIvyPalette(myIvy.MyIvy):
|
class MyIvyPalette(myIvy.MyIvy):
|
||||||
LIST_FORM = []
|
LIST_FORM = []
|
||||||
def _createbind(self):
|
def _createbind(self):
|
||||||
@ -131,6 +132,7 @@ class MyIvyPalette(myIvy.MyIvy):
|
|||||||
IvyBindMsg(self.delete, '^MULTIMODAL:supprimer forme=(.*) x=(.*) y=(.*) couleur=(.*)')
|
IvyBindMsg(self.delete, '^MULTIMODAL:supprimer forme=(.*) x=(.*) y=(.*) couleur=(.*)')
|
||||||
|
|
||||||
def create(self, agent, *larg):
|
def create(self, agent, *larg):
|
||||||
|
print("create " + str(larg))
|
||||||
if larg[0] == "RECTANGLE":
|
if larg[0] == "RECTANGLE":
|
||||||
r = Rectangle(myturtle, self.__my_int(larg[1]), self.__my_int(larg[2]), color=larg[3])
|
r = Rectangle(myturtle, self.__my_int(larg[1]), self.__my_int(larg[2]), color=larg[3])
|
||||||
r.draw()
|
r.draw()
|
||||||
@ -141,11 +143,13 @@ class MyIvyPalette(myIvy.MyIvy):
|
|||||||
self.LIST_FORM.append(c)
|
self.LIST_FORM.append(c)
|
||||||
|
|
||||||
def move(self, agent, *larg):
|
def move(self, agent, *larg):
|
||||||
self.LIST_FORM = Form.aim_move(self.LIST_FORM, larg[0],
|
print("move " + str(larg))
|
||||||
|
self.LIST_FORM = Form.aim_move(self.LIST_FORM, self.__my_int(larg[0]),
|
||||||
self.__my_int(larg[1]), self.__my_int(larg[2]),
|
self.__my_int(larg[1]), self.__my_int(larg[2]),
|
||||||
self.__my_int(larg[3]), color=larg[4])
|
self.__my_int(larg[3]), color=larg[4])
|
||||||
|
|
||||||
def delete(self, agent, *larg):
|
def delete(self, agent, *larg):
|
||||||
|
print("delete " + str(larg))
|
||||||
self.LIST_FORM = Form.aim_delete(self.LIST_FORM, larg[0],
|
self.LIST_FORM = Form.aim_delete(self.LIST_FORM, larg[0],
|
||||||
self.__my_int(larg[1]), self.__my_int(larg[2]), color=larg[3])
|
self.__my_int(larg[1]), self.__my_int(larg[2]), color=larg[3])
|
||||||
|
|
||||||
|
38
Simu/Simu.py
38
Simu/Simu.py
@ -8,39 +8,65 @@ ivy = myIvy.MyIvy("Simu", "127.255.255.255:2010")
|
|||||||
|
|
||||||
list_cmds = [
|
list_cmds = [
|
||||||
(
|
(
|
||||||
# Test création RECTANGLE xy en premier -> REC1
|
# Test création RECTANGLE, xy en premier -> REC1
|
||||||
"Geste forme={}".format("RECTANGLE"),
|
"Geste forme={}".format("RECTANGLE"),
|
||||||
"PALETTE x={} y={}".format(25, 70),
|
"PALETTE x={} y={}".format(25, 70),
|
||||||
"sra5 Parsed=VOCAL couleur={} confiance=0,99".format("rouge"),
|
"sra5 Parsed=VOCAL couleur={} confiance=0,99".format("rouge"),
|
||||||
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ici"),
|
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ici"),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
# Test création ROND xy en premier -> RON1
|
# Test création ROND, xy en premier -> RON1
|
||||||
"Geste forme={}".format("ROND"),
|
"Geste forme={}".format("ROND"),
|
||||||
"PALETTE x={} y={}".format(250, 300),
|
"PALETTE x={} y={}".format(250, 300),
|
||||||
"sra5 Parsed=VOCAL couleur={} confiance=0,99".format("bleu"),
|
"sra5 Parsed=VOCAL couleur={} confiance=0,99".format("bleu"),
|
||||||
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ici"),
|
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ici"),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
# Test création RECTANGLE couleur en premier REC2
|
# Test création RECTANGLE, couleur en premier REC2
|
||||||
"Geste forme={}".format("RECTANGLE"),
|
"Geste forme={}".format("RECTANGLE"),
|
||||||
"PALETTE x={} y={}".format(10, 425),
|
"PALETTE x={} y={}".format(10, 425),
|
||||||
"sra5 Parsed=VOCAL couleur={} confiance=0,99".format("jaune"),
|
"sra5 Parsed=VOCAL couleur={} confiance=0,99".format("jaune"),
|
||||||
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ici"),
|
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ici"),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
# Test création ROND couleur en premier RON2
|
# Test création ROND, couleur en premier RON2
|
||||||
"Geste forme={}".format("ROND"),
|
"Geste forme={}".format("ROND"),
|
||||||
"PALETTE x={} y={}".format(300, 400),
|
"PALETTE x={} y={}".format(300, 400),
|
||||||
"sra5 Parsed=VOCAL couleur={} confiance=0,99".format("vert"),
|
"sra5 Parsed=VOCAL couleur={} confiance=0,99".format("vert"),
|
||||||
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ici"),
|
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ici"),
|
||||||
),
|
),
|
||||||
|
########################################################################################################################
|
||||||
(
|
(
|
||||||
# Test supression Rond couleur en premier REC2
|
# Test supression RECTANGLE, sans couleur annonce REC2
|
||||||
"Geste forme={}".format("TRAIT"),
|
"Geste forme={}".format("Z"),
|
||||||
|
"sra5 Parsed=VOCAL couleur={} confiance=0,99".format("jaune"),
|
||||||
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ce rectangle"),
|
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ce rectangle"),
|
||||||
"PALETTE x={} y={}".format(15, 435),
|
"PALETTE x={} y={}".format(15, 435),
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
# Test supression ROND, avec couleur annonce RON2
|
||||||
|
"Geste forme={}".format("Z"),
|
||||||
|
"sra5 Parsed=VOCAL couleur={} confiance=0,99".format("vert"),
|
||||||
|
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ce rond"),
|
||||||
|
"PALETTE x={} y={}".format(300, 450),
|
||||||
|
),
|
||||||
|
########################################################################################################################
|
||||||
|
(
|
||||||
|
# Test deplacement RECTANGLE, ça d'abord -> REC1
|
||||||
|
"Geste forme={}".format("TRAIT"),
|
||||||
|
"PALETTE x={} y={}".format(30, 80),
|
||||||
|
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ça"),
|
||||||
|
"PALETTE x={} y={}".format(600, 450),
|
||||||
|
"sra5 Parsed=VOCAL action={} confiance=0,99".format("là"),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
# Test deplacement RECTANGLE, la d'abord -> REC1
|
||||||
|
"Geste forme={}".format("TRAIT"),
|
||||||
|
"PALETTE x={} y={}".format(610, 460),
|
||||||
|
"sra5 Parsed=VOCAL action={} confiance=0,99".format("ça"),
|
||||||
|
"PALETTE x={} y={}".format(600, 100),
|
||||||
|
"sra5 Parsed=VOCAL action={} confiance=0,99".format("là"),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
for cmds in list_cmds:
|
for cmds in list_cmds:
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
[Dolphin]
|
|
||||||
Timestamp=2017,1,18,15,39,7
|
|
||||||
Version=3
|
|
Reference in New Issue
Block a user