-
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
Phoenix 6 drivetrain #7
base: main
Are you sure you want to change the base?
Conversation
…5-Robot-Code into phoenix-6-drivetrain
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.
A first high level pass.
I think we will need to show this working in simulation (both auto and teleop) before merging
src/main/java/frc/robot/subsystems/CommandSwerveDrivetrain.java
Outdated
Show resolved
Hide resolved
@jkleiber Format is failing because of an incorrect Java version (I think). # This grabs the WPILib docker container
container: wpilib/roborio-cross-ubuntu:2024-22.04 |
@aidnem I haven't checked the docs so take my input with a grain of salt. But I would expect wpilib to update to require 2024 ubuntu. If we have been building against 2022 then a version promotion probably would work fine |
@sleepyghost-zzz fyi the drive with joysticks command in copper core is on latest version of beta, so you can try integrating that as well. Otherwise, I can do it when I go to add vision |
@linglejack06 Epic, I tried to use the DriveWithJoysticks.java and it didn't quite do what I wanted with the AK project. I'll give it another try, when you start implementing vision if you could walk me through it that would be great. |
@sleepyghost-zzz Yeah I'll show you, it's just a matter of creating a method in the Ak drive |
@jkleiber @sleepyghost-zzz check out the new template for talon fx swerve on advantage kit release, several changes due to 2025 release differences from beta. heres a link to release: https://github.com/Mechanical-Advantage/AdvantageKit/releases |
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.
Some review comments. I think we should push to get this merged without worrying about photonvision release. We can get auto testing going with just dead reckoning and also figure out how to get TorqueCurrentFOC working while we wait for vision
cc: @aidnem and @linglejack06
? getRotation().plus(new Rotation2d(Math.PI)) // Flip orientation for Red Alliance | ||
: getRotation(); | ||
|
||
ChassisSpeeds fieldRelativeSpeeds = |
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.
@jkleiber @sleepyghost-zzz does this assume that run velocity is being given a field centric speed already? if so, how would this work with auto?
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.
I think the auto builder is given setGoalSpeeds which is robot-centric rather than runVelocity which is field-centric.
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.
This makes sense - @linglejack as long as we are commanding the field centric function in coppercore then I'm fine. I am not sure that is the case though, we may need to use runVelocity with drive with joysticks
@sleepyghost-zzz if there's any way we can comment / docstring these two functions to make it obvious that one is field centric and the other is robot centric, that would be good. It may already be commented as such and I just missed it (I'm on my phone)
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 the auto builder is given set goal speeds, it still runs through run velocity, which is converting to field centric?
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.
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.
This makes sense - @linglejack as long as we are commanding the field centric function in coppercore then I'm fine. I am not sure that is the case though, we may need to use runVelocity with drive with joysticks
@sleepyghost-zzz if there's any way we can comment / docstring these two functions to make it obvious that one is field centric and the other is robot centric, that would be good. It may already be commented as such and I just missed it (I'm on my phone)
@jkleiber coppercore just calls the set goal speeds function from drive. Everything else currently handled by the drive subsystem
@jkleiber it looks like on josh's most recent commit, the run velocity command was updated to work with the existing drive with josysticks command in coppercore, do i still need to adjust anything for coppercore command @sleepyghost-zzz ? |
Hi there guys, TLDR: Setgoalspeeds = robot-centric. Runvelocity = field-centric. So:
SetGoalSpeeds
to get the speeds we want.
Doing all that means that auto uses setgoalspeeds and teleop uses runvelocity to actually control. Hope this all makes sense, its kind of a long explanation I just wanted to try and make it as clear as possible. |
But run velocity is still getting called in auto right? Otherwise how is robot being commanded to move, as set goal speeds doesn’t actually tell motors to go?Sent from my iPhoneOn Jan 12, 2025, at 8:48 PM, sleepyghost ***@***.***> wrote:
Hi there guys,
TLDR: Setgoalspeeds = robot-centric. Runvelocity = field-centric.
So:
Autobuilder is just using the setgoalspeeds method:
AutoBuilder:
AutoBuilder.configure(
this::getPose,
this::setPose,
this::getChassisSpeeds,
this::setGoalSpeeds,
new PPHolonomicDriveController(
new PIDConstants(5.0, 0.0, 0.0), new PIDConstants(5.0, 0.0, 0.0)),
PP_CONFIG,
() -> DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Red,
this);
SetGoalSpeeds
public void setGoalSpeeds(ChassisSpeeds speeds) {
this.goalSpeeds = speeds;
}
to get the speeds we want.
The runVelocity method calls the setgoalspeeds method but also does a conversion to turn those values into field centric control. We moved this to runVelocity so that we could use the DriveWithJoysticks command in coppercore, and be able to actually use it right.
Conversion of robot relative to field relative:
boolean isFlipped =
DriverStation.getAlliance().isPresent()
&& DriverStation.getAlliance().get() == Alliance.Red;
Rotation2d robotRotation =
isFlipped
? getRotation().plus(new Rotation2d(Math.PI)) // Flip orientation for Red Alliance
: getRotation();
ChassisSpeeds fieldRelativeSpeeds =
ChassisSpeeds.fromFieldRelativeSpeeds(speeds, robotRotation);
Doing all that means that auto uses setgoalspeeds and teleop uses runvelocity to actually control. Hope this all makes sense, its kind of a long explanation I just wanted to try and make it as clear as possible.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
jack, now that you say that I think you are correct. This is my fault for not actually knowing how to sim autos, but right now it probably wont do anything because I am using setgoalspeeds which doesn't move motors. I will have to create either a boolean or another method that doesn't do those translations, Thanks for making me see this. |
You’re welcome, if you want I can help during shop today. Probably the easiest thing to do is move that conversion logic over to drive with joysticks in copper core. OR we could move that conversion logic over to set goal speeds and five a Boolean back to set goal speeds. I feel like copper core would be the better option here though, what do you think @sleepyghost-zzz?Sent from my iPhoneOn Jan 12, 2025, at 9:40 PM, sleepyghost ***@***.***> wrote:
jack, now that you say that I think you are correct. This is my fault for not actually knowing how to sim autos, but right now it probably wont do anything because I am using setgoalspeeds which doesn't move motors. I will have to create either a boolean or another method that doesn't do those translations, Thanks for making me see this.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@sleepyghost-zzz @jkleiber it looks like the field relative speed conversion will have to be done in set goal speeds like last year. We could move it to the command but that would require a supplier for robot rotation. I feel it would be easier to just implement set goal speeds with boolean and conditional to convert to field relative. Are you good with that justin and @aidnem? basically it would either be
or
|
@linglejack06 let's do the boolean approach we've done in the past. I agree that it's weird to supply rotation to the command. |
@jkleiber got it, i can help josh do that tonight or go ahead and do it now. either way, i think we need to get this pr merged by the end of today so we can move on to integrating vision |
If you can do it now, I'd recommend going ahead and doing it. I'd like to see the robot moving in shop today if possible |
ok ill add that now |
@jkleiber setGoalSpeeds adjusted in coppercore + 2025-robot-code here. Build will fail though until we get the pull request merged in coppercore and release updated (had to add back boolean to the DriveTemplate class in coppercore) |
@linglejack06 I agree |
@jkleiber it looks like pathplanner has changed the parameters of their AutoBuilder.config method a bit, i think that might be why build is failing |
@linglejack06 sorry i cant do anything at school, whats been happening? is there a problem rn? |
I can fill you in more at shop, I’ve fixed the main problem, I think now there’s just a tiny error relating to the path planner config that we can look at. Sent from my iPhoneOn Jan 13, 2025, at 3:59 PM, sleepyghost ***@***.***> wrote:
@linglejack06 sorry i cant do anything at school, whats been happening? is there a problem rn?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Did we ever make Highkey move? |
@sleepyghost-zzz no, we had to leave at 8. Im going to try to get it moving tonight while im there |
Purpose
The purpose of this addition is to create a phoenix 6 swerve drivetrain.
Project Scope