-
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
Vision alignment #80
base: main
Are you sure you want to change the base?
Vision alignment #80
Conversation
this.driveSubsystem = driveSubsystem; | ||
|
||
recognitionCamera = new PhotonCamera("Microsoft_LifeCam_HD-3000"); | ||
turnPID = new PIDController(0.2/35, 0.0, 0.0); |
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'd use a ProfiledPIDController
for this; see FollowPathCommand
.
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.
Maybe after #76 gets tuned / merged this can use the setDrivePowersWithHeadingLock()
method and not have to implement its own PID as well.
private final PIDController turnPID; | ||
PhotonCamera recognitionCamera; | ||
|
||
PhotonPipelineResult result; |
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.
Doesn't have to be a state?
PhotonCamera recognitionCamera; | ||
|
||
PhotonPipelineResult result; | ||
boolean hasTargets; |
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.
Also doesn't have to be a state
public void execute() { | ||
result = recognitionCamera.getLatestResult(); | ||
hasTargets = result.hasTargets(); | ||
target = result.getBestTarget(); |
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.
What does this object look like if hasTargets
is false? Does the command end execution at all if that happens?
public class VisionAlignmentCommand extends CommandBase { | ||
private final BaseSwerveSubsystem driveSubsystem; | ||
|
||
private double angularPower; |
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.
Also doesn't have to be a state; you only need to store things in fields if you need to reference them across multiple methods or you need the previous value when rerunning the same method.
@rishay-jain