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

Commit 51beb69

Browse files
Implem goto_stop dans les tâches du robot
1 parent 1bf1ed8 commit 51beb69

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

raspberrypi/robots/team2024/PanneauxSolaires.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
from behaviours.robot_behaviour import RobotBehavior
55
from robots.team2024.barriere import Barriere
66
from daughter_cards.wheeledbase import WheeledBase
7+
from daughter_cards.sensors import Sensors
78

89
from tunings.tunings_robeur import POSITIONCONTROL_LINVELMAX_VALUE, POSITIONCONTROL_LINVELMAX_ID
910
from common.serialtypes import FLOAT, STRING, INT
1011

1112
class PanneauxSolaires:
12-
def __init__(self, wheeledbase: WheeledBase, barriere:Barriere, robot, side, middle) -> None:
13+
def __init__(self, wheeledbase: WheeledBase, barriere:Barriere, robot, side, middle,sensors:Sensors) -> None:
1314
self.wb=wheeledbase
1415

1516
self.radiusRobot=400
@@ -22,6 +23,7 @@ def __init__(self, wheeledbase: WheeledBase, barriere:Barriere, robot, side, mid
2223
self.get_side = side
2324
self.middle=middle
2425
self.robot=robot
26+
self.sensors=sensors
2527

2628
"""
2729
def calc_point_approche(self, pos_plante, theta_normal):
@@ -65,8 +67,8 @@ def procedure(self):
6567
self.barriere.ferme_gauche()
6668
############################################ Avance
6769
pos =self.wb.get_position()
68-
self.wb.goto_stop(pos[0],pos[1],theta=ang_approche)
69-
self.wb.goto_stop(fin[0],fin[1],theta=ang_approche, linvelmax=POSITIONCONTROL_LINVELMAX_VALUE*0.2)
70+
self.wb.goto_stop(pos[0],pos[1],self.sensors,theta=ang_approche)
71+
self.wb.goto_stop(fin[0],fin[1],self.sensors,theta=ang_approche, linvelmax=POSITIONCONTROL_LINVELMAX_VALUE*0.2)
7072

7173
self.wb.set_parameter_value(POSITIONCONTROL_LINVELMAX_ID, POSITIONCONTROL_LINVELMAX_VALUE, FLOAT)
7274

raspberrypi/robots/team2024/RecupPlante.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from common.serialtypes import FLOAT, STRING, INT
99

1010
class RecupPlante:
11-
def __init__(self, wheeledbase: WheeledBase, barriere:Barriere, robot, pos_depose, pos_plante, final) -> None:
11+
def __init__(self, wheeledbase: WheeledBase, barriere:Barriere, robot, pos_depose, pos_plante, final,sensors) -> None:
1212
self.wb=wheeledbase
1313
self.robot=robot
1414
self.pos=np.flip(np.array(pos_plante))
@@ -20,6 +20,7 @@ def __init__(self, wheeledbase: WheeledBase, barriere:Barriere, robot, pos_depos
2020
self.actionpoint_precision=None
2121
self.endPoint=np.flip(np.array(pos_depose))
2222
self.final= final
23+
self.sensors=sensors
2324

2425
"""
2526
def calc_point_approche(self, pos_plante, theta_normal):
@@ -50,13 +51,13 @@ def procedure(self):
5051
print(length-self.radiusRobot)
5152
#print(self.wb.wheeledbase.getuuid())
5253
if(length-self.radiusRobot>0):
53-
self.wb.goto_stop(stop[0],stop[1],theta=ang)
54+
self.wb.goto_stop(stop[0],stop[1],self.sensors,theta=ang)
5455

5556
######On prends
5657
self.barriere.nicole_oouuuuuvre()
5758

5859
stop=vecPos/length*(length-self.radiusPince)+rPos
59-
self.wb.goto_stop(stop[0],stop[1], theta=ang, linvelmax=POSITIONCONTROL_LINVELMAX_VALUE*0.15)
60+
self.wb.goto_stop(stop[0],stop[1],self.sensors, theta=ang, linvelmax=POSITIONCONTROL_LINVELMAX_VALUE*0.15)
6061

6162
self.wb.set_parameter_value(POSITIONCONTROL_LINVELMAX_ID, POSITIONCONTROL_LINVELMAX_VALUE, FLOAT)
6263

@@ -77,19 +78,19 @@ def procedure(self):
7778
print(theta)
7879
print(ang)
7980

80-
self.wb.goto_stop(rPos[0],rPos[1], theta=ang, angvelmax=POSITIONCONTROL_ANGVELMAX_VALUE*0.05)
81-
self.wb.goto_stop(stop[0],stop[1],theta=ang, angvelmax=POSITIONCONTROL_ANGVELMAX_VALUE, linvelmax=POSITIONCONTROL_LINVELMAX_VALUE*0.3)
81+
self.wb.goto_stop(rPos[0],rPos[1],self.sensors, theta=ang, angvelmax=POSITIONCONTROL_ANGVELMAX_VALUE*0.05)
82+
self.wb.goto_stop(stop[0],stop[1],self.sensors,theta=ang, angvelmax=POSITIONCONTROL_ANGVELMAX_VALUE, linvelmax=POSITIONCONTROL_LINVELMAX_VALUE*0.3)
8283

8384
#On recule pour le prochains
8485
if(not self.final):
8586
self.barriere.nicole_oouuuuuvre()
8687
stop[0]=stop[0]-150*np.cos(ang)
8788
stop[1]=stop[1]-150*np.sin(ang)
88-
self.wb.goto_stop(stop[0],stop[1],theta=ang+np.pi)
89+
self.wb.goto_stop(stop[0],stop[1],self.sensors,theta=ang+np.pi)
8990
else:
9091
stop[0]=stop[0]-50*np.cos(ang)
9192
stop[1]=stop[1]-50*np.sin(ang)
92-
self.wb.goto_stop(stop[0],stop[1],theta=ang)
93+
self.wb.goto_stop(stop[0],stop[1],self.sensors,theta=ang)
9394
self.barriere.nicole_oouuuuuvre()
9495

9596

raspberrypi/robots/team2024/team2024Robot.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ def set_position(self):
146146

147147
self.blue=self.side==RobotBehavior.BLUE_SIDE
148148
if(self.blue):#couleur impaire
149-
self.automate.append(PanneauxSolaires(self.wheeledbase,self.barriere,self, self.get_side, False))
150-
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseB1'), self.geo.get('PlanteB1'), False))
151-
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseB2'), self.geo.get('PlanteB2'), False))
152-
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseB3'), self.geo.get('PlantePAMI'), True))
149+
self.automate.append(PanneauxSolaires(self.wheeledbase,self.barriere,self, self.get_side, False,self.sensors))
150+
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseB1'), self.geo.get('PlanteB1'), False,self.sensors))
151+
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseB2'), self.geo.get('PlanteB2'), False,self.sensors))
152+
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseB3'), self.geo.get('PlantePAMI'), True,self.sensors))
153153
else:#couleur paire
154-
self.automate.append(PanneauxSolaires(self.wheeledbase,self.barriere,self, self.get_side, False))
155-
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseJ1'), self.geo.get('PlanteJ1'), False))
156-
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseJ2'), self.geo.get('PlanteJ2'), False))
157-
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseJ3'), self.geo.get('PlantePAMI'), True))
154+
self.automate.append(PanneauxSolaires(self.wheeledbase,self.barriere,self, self.get_side, False,self.sensors))
155+
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseJ1'), self.geo.get('PlanteJ1'), False,self.sensors))
156+
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseJ2'), self.geo.get('PlanteJ2'), False,self.sensors))
157+
self.automate.append(RecupPlante(self.wheeledbase, self.barriere, self, self.geo.get('BaseJ3'), self.geo.get('PlantePAMI'), True,self.sensors))
158158

159159
def positioning(self):
160160
"""This optionnal function can be useful to do a small move after setting up the postion during the preparation phase

0 commit comments

Comments
 (0)