Skip to content

Comments

Apply linear filter#93

Open
Murat65536 wants to merge 3 commits intomainfrom
linearfilter-being-overwritten
Open

Apply linear filter#93
Murat65536 wants to merge 3 commits intomainfrom
linearfilter-being-overwritten

Conversation

@Murat65536
Copy link
Contributor

Pull Request


Issue Number

Closes #91

Comments

@Murat65536 Murat65536 changed the title Cube joystick values. Apply linear filter Aug 27, 2025
@Murat65536
Copy link
Contributor Author

Tested on robot. Driving seems smoother but auton is acting up. But looking at the code AutoConstants has a different set of PID values. And P is set to 8... Maybe it's for something else? How would I edit auton to make it work?

public static final double kPXController = 8;
public static final double kIXController = 0.02;
public static final double kDController = 0.0;

AutoBuilder.configure(
() -> this.getState().Pose,
this::resetPose,
() -> this.getState().Speeds,
(ChassisSpeeds speeds, DriveFeedforwards feedForwards) -> {
this.setControl(
new SwerveRequest.ApplyRobotSpeeds().withSpeeds(speeds)
.withWheelForceFeedforwardsX(feedForwards.robotRelativeForcesXNewtons())
.withWheelForceFeedforwardsY(feedForwards.robotRelativeForcesYNewtons()));
},
new PPHolonomicDriveController(
new PIDConstants(AutoConstants.kPXController, AutoConstants.kIXController,
AutoConstants.kDController),
new PIDConstants(AutoConstants.kPThetaController,
AutoConstants.kIThetaController,
AutoConstants.kDThetaController)),
AutoConstants.kRobotConfig.get(),
() -> DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Red,
this);

Also we set AutoBuilder but don't use it and instead create a new FollowPathCommand with the values in AutoBuilder every time...
return new FollowPathCommand(
path,
// Robot pose supplier
() -> this.driveTrain.getState().Pose,
// ChassisSpeeds supplier. MUST BE ROBOT RELATIVE
() -> this.driveTrain.getState().Speeds,
// Method that will drive the robot given ROBOT RELATIVE ChassisSpeeds
(speeds, feedforwards) -> this.driveTrain.setControl(
new SwerveRequest.ApplyRobotSpeeds().withSpeeds(speeds)
.withWheelForceFeedforwardsX(feedforwards.robotRelativeForcesXNewtons())
.withWheelForceFeedforwardsY(feedforwards.robotRelativeForcesYNewtons())),
new PPHolonomicDriveController(
// Translation PIDconstants
new PIDConstants(AutoConstants.kPXController, AutoConstants.kIXController, 0.0),
// Rotation PID constants
new PIDConstants(AutoConstants.kPThetaController, AutoConstants.kIThetaController, 0.0)),
AutoConstants.kRobotConfig.get(),
() -> DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Red,
this.driveTrain // Reference to this subsystem to set requirements
);

@reediculous456
Copy link
Member

It makes sense that you would need to change the PID constants for auto if you change the module constants. Pathplanner should have docs on how to modify those values.
As for why we aren't using auto builder, we chose to build the auto routines in Java rather than in PathPlanner. The only reason we have an AutoBuilder is for the on the fly path stuff

@reediculous456
Copy link
Member

The linear filter stuff in the driver joystick won't affect auto

@Murat65536
Copy link
Contributor Author

So does that mean this is good to merge?

@reediculous456
Copy link
Member

If the PID changes made to SwerveConstants are affecting Auto, then no. We need to fix the PID Constants in Auto to account for the change or revert the change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LinearFilter being overwritten

2 participants