-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swerve Auto + Sim + Commands #10
Conversation
…eed methods and commands to be able to drive robot
@jkleiber sim works now. I changed the apply drive request to the set control used in 2024 robot code and everything works liek, it should. Command scheduler must not like that one command is returning another command maybe. driving works in sim just need to iron out details now for example:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@linglejack06 Just some first pass comments / suggstions. Also would be a good idea to resolve the merge conflicts in this branch
return Commands.print("No autonomous command configured"); | ||
} | ||
private void configureBindings() { | ||
System.out.println("add binding"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove the prints since everything is working now with the setControl update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
private static final double kSteerInertia = 0.00001; | ||
private static final double kDriveInertia = 0.001; | ||
// Simulated voltage necessary to overcome friction | ||
private static final double kSteerFrictionVoltage = 0.25; | ||
private static final double kDriveFrictionVoltage = 0.25; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to make the robot less jittery in sim, you could try increasing these values. In any case it would be interesting to see what they do so we can better match the real bot to the sim
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ill work on that
import frc.robot.constants.PhoenixDriveConstants; | ||
|
||
public class PhoenixDrive extends SwerveDrivetrain implements Subsystem { | ||
private static final double kSimLoopPeriod = 0.005; // 5 ms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this a constant in a separate constants file even though I recognize it will probably only be used here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
SwerveDrivetrainConstants driveConstants, SwerveModuleConstants... modules) { | ||
super(driveConstants, modules); | ||
|
||
System.out.println("create drive"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment about removing prints
if (!hasAppliedOperatorPerspective || DriverStation.isDisabled()) { | ||
DriverStation.getAlliance() | ||
.ifPresent( | ||
(color) -> { | ||
this.setOperatorPerspectiveForward( | ||
color == Alliance.Red | ||
? RedAlliancePerspectiveRotation | ||
: BlueAlliancePerspectiveRotation); | ||
}); | ||
hasAppliedOperatorPerspective = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how did we do this in 2024-Robot-Code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
honzik used a conditional to flip values of joystick, i figured i would try out there way of doing it though to see if it led to performances in odometry and field positioning?
Resolves Issue #9