Skip to content

Commit

Permalink
Improve chassis control
Browse files Browse the repository at this point in the history
  • Loading branch information
Blue-Flag-666 committed Oct 9, 2024
1 parent f762b00 commit 23e040e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/frc/libzodiac
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Commands/Auto.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public AutoCommand init() {
private static final Timer timer = new Timer();
private static AutoCommand command;
private static Chassis chassis;
ZPath path = new ZPath("");
ZPath path = new ZPath(""); //todo

public Auto(RobotContainer robot, AutoCommand cmd) {
chassis = require(robot.chassis);
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@

import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import frc.robot.subsystems.Chassis;

public class Robot extends TimedRobot {
private RobotContainer robotContainer;

protected Robot() {
addPeriodic(() -> {
robotContainer.chassis.update();
}, 0.05, 0.02);
}

@Override
public void robotInit() {
robotContainer = new RobotContainer();
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ public class RobotContainer {
/**
* The command to drive the robot.
*/
public final Command drive = this.chassis.drive(driver.ly().inverted().threshold(0.02).map(Axis.ATAN_FILTER), driver.lx().inverted().threshold(0.02).map(Axis.ATAN_FILTER), driver.rx().inverted().threshold(0.02), driver.ry().inverted().threshold(0.02), driver.rt().as_button(0.2), driver.lt().as_button(0.2), driver.lb());
public final Command drive = this.chassis.drive(
driver.l().inverted().threshold(0.02).map(Axis.ATAN_FILTER),
driver.r().inverted().threshold(0.02).map(Axis.ATAN_FILTER),
driver.lx().inverted().threshold(0.02).map(Axis.ATAN_FILTER),
driver.ly().inverted().threshold(0.02).map(Axis.ATAN_FILTER),
driver.rx().inverted().threshold(0.02).map(Axis.ATAN_FILTER),
driver.ry().inverted().threshold(0.02).map(Axis.ATAN_FILTER),
driver.rt().as_button(0.2),
driver.lt().as_button(0.2),
driver.lb());

public RobotContainer() {
this.configureBindings();
Expand Down

0 comments on commit 23e040e

Please sign in to comment.