Skip to content

Commit aa16499

Browse files
authored
Merge pull request #227 from thedropbears/choreo-algae-loop
2 parents 11bf416 + b5cc33a commit aa16499

26 files changed

+3634
-353
lines changed

autonomous/auto_base.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
from controllers.reef_intake import ReefIntake
1717
from utilities import game
1818

19-
x_controller = PIDController(1.0, 0.0, 0.0)
20-
y_controller = PIDController(1.0, 0.0, 0.0)
21-
heading_controller = PIDController(1.0, 0, 0)
19+
x_controller = PIDController(0.5, 0.0, 0.0)
20+
y_controller = PIDController(0.5, 0.0, 0.0)
21+
heading_controller = PIDController(3.0, 0, 0)
2222
heading_controller.enableContinuousInput(-math.pi, math.pi)
2323

2424
wpilib.SmartDashboard.putData("Auto X PID", x_controller)
@@ -34,7 +34,7 @@ class AutoBase(AutonomousStateMachine):
3434
injector_component: InjectorComponent
3535
chassis: ChassisComponent
3636

37-
DISTANCE_TOLERANCE = 0.05 # metres
37+
DISTANCE_TOLERANCE = 0.2 # metres
3838
ANGLE_TOLERANCE = math.radians(3)
3939

4040
def __init__(self, trajectory_names: list[str]) -> None:
@@ -101,8 +101,10 @@ def tracking_trajectory(self, initial_call, state_tm) -> None:
101101
if self.current_leg > 0 and not self.injector_component.has_algae():
102102
self.reef_intake.intake()
103103

104-
if distance < self.DISTANCE_TOLERANCE and math.isclose(
105-
angle_error, 0.0, abs_tol=self.ANGLE_TOLERANCE
104+
if (
105+
distance < self.DISTANCE_TOLERANCE
106+
and math.isclose(angle_error, 0.0, abs_tol=self.ANGLE_TOLERANCE)
107+
and state_tm > self.trajectories[self.current_leg].get_total_time() / 2.0
106108
):
107109
# First leg is to score coral, then we run cycles of pick up -> shoot
108110
if self.current_leg == 0:

autonomous/coral_auto.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

autonomous/multi_algae_auto.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from autonomous.auto_base import AutoBase
2+
3+
4+
class CentreAuto(AutoBase):
5+
MODE_NAME = "Centre G>GH>IJ>EF"
6+
7+
def __init__(self):
8+
super().__init__(
9+
[
10+
"StartToBranchG",
11+
"BranchGToAlgaeGH",
12+
"AlgaeGHToShoot",
13+
"ShootToAlgaeIJ",
14+
"AlgaeIJToShoot",
15+
"ShootToAlgaeEF",
16+
"AlgaeEFToShoot",
17+
]
18+
)
19+
20+
21+
class AllianceSideAuto(AutoBase):
22+
MODE_NAME = "Alliance Side L>KL>AB"
23+
24+
def __init__(self):
25+
super().__init__(
26+
[
27+
"StartToBranchL",
28+
"BranchLToAlgaeKL",
29+
"AlgaeKLToShoot",
30+
"ShootToAlgaeAB",
31+
"AlgaeABToShoot",
32+
]
33+
)
34+
35+
36+
class OppositionSideAuto(AutoBase):
37+
MODE_NAME = "Opposition Side C>CD>KL"
38+
39+
def __init__(self):
40+
super().__init__(
41+
[
42+
"StartToBranchC",
43+
"BranchCToAlgaeCD",
44+
"AlgaeCDToShoot",
45+
"ShootToAlgaeKL",
46+
"AlgaeKLToShoot",
47+
]
48+
)

deploy/choreo/AlgaeABToShoot.traj

Lines changed: 201 additions & 0 deletions
Large diffs are not rendered by default.

deploy/choreo/AlgaeCDToShoot.traj

Lines changed: 264 additions & 0 deletions
Large diffs are not rendered by default.

deploy/choreo/AlgaeEFToShoot.traj

Lines changed: 160 additions & 0 deletions
Large diffs are not rendered by default.

deploy/choreo/AlgaeGHToShoot.traj

Lines changed: 74 additions & 75 deletions
Large diffs are not rendered by default.

deploy/choreo/AlgaeIJToShoot.traj

Lines changed: 106 additions & 0 deletions
Large diffs are not rendered by default.

deploy/choreo/AlgaeKLToShoot.traj

Lines changed: 179 additions & 0 deletions
Large diffs are not rendered by default.

deploy/choreo/BranchCToAlgaeCD.traj

Lines changed: 131 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)