Skip to content

Commit 89d424e

Browse files
made the chassis heading PID controller used in autobase
1 parent 3182cf8 commit 89d424e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

autonomous/auto_base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@
1818

1919
x_controller = PIDController(0.5, 0.0, 0.0)
2020
y_controller = PIDController(0.5, 0.0, 0.0)
21-
heading_controller = PIDController(3.0, 0, 0)
22-
heading_controller.enableContinuousInput(-math.pi, math.pi)
2321

2422
wpilib.SmartDashboard.putData("Auto X PID", x_controller)
2523
wpilib.SmartDashboard.putData("Auto Y PID", y_controller)
26-
wpilib.SmartDashboard.putData("Auto Heading PID", heading_controller)
2724

2825

2926
class AutoBase(AutonomousStateMachine):
@@ -129,7 +126,9 @@ def follow_trajectory(self, sample: SwerveSample):
129126
sample.vx + x_controller.calculate(pose.X(), sample.x),
130127
sample.vy + y_controller.calculate(pose.Y(), sample.y),
131128
sample.omega
132-
+ heading_controller.calculate(pose.rotation().radians(), sample.heading),
129+
+ self.chassis.heading_controller.calculate(
130+
pose.rotation().radians(), sample.heading
131+
),
133132
)
134133

135134
# Apply the generated speeds

components/chassis.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ class ChassisComponent:
245245
swerve_lock = magicbot.tunable(False)
246246

247247
# TODO: Read from positions.py once autonomous is finished
248-
249248
def __init__(
250249
self, track_width: float, wheel_base: float, swerve_config: SwerveConfig
251250
) -> None:

0 commit comments

Comments
 (0)