Conversation
src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java
Outdated
Show resolved
Hide resolved
| Constants.SET_MODULE_ENCODER_AUTO_SYNCHRONIZE_DEADBAND); // Enable if you want to resynchronize your absolute encoders and motor encoders periodically when they are not moving. | ||
| // swerveDrive.pushOffsetsToEncoders(); // Set the absolute encoder to be used over the internal encoder and push the offsets onto it. Throws warning if not possible | ||
|
|
||
| rawOdometry = new SwerveDriveOdometry( |
There was a problem hiding this comment.
Looking more closely at what we need to do, I am not certain we want raw odometry without vision. The YAGSL maintains a SwerveDrivePoseEstimator which wraps around a SwerveDriveOdometry which extends PoseEstimator which has support for vision measurements.
So it seems to me that when we are processing a vision input from the camera, we should be comparing it against the latest known position, including all the previous vision adjustments, to help us filter them odd ones out.
So I am no longer sure we need getOdom that only considers odometry from the swerve, certainly YAGSL does not maintain one.
Also, maintaining an extra odometry calculation seems expensive.
Am I missing something?
There was a problem hiding this comment.
our vision filter would need to be refactored then
There was a problem hiding this comment.
I don't see why. Maybe we should discuss so we can plan.
There was a problem hiding this comment.
maybe put in sim wrapper (with utility class)
|
|
||
| @Override | ||
| public void processQueue() { | ||
| double currentTime = Logger.getTimestamp()/1000000.0; |
There was a problem hiding this comment.
I don't see what these changes amount to: Other than more log entries, what is the purpose?
With all the details being change like variable names and locations, it's really hard to distill the semantics of what changed.
There was a problem hiding this comment.
easier to count how many tags we saw over the last second, allowing us to know if we had steady vision in the last second. (one thing that batchen said she wanted to be able to know)
There was a problem hiding this comment.
So we should ask BatChen what she asked for. Can you ping us both on Discord so we can discuss?
src/main/java/frc/robot/subsystems/swervedrive/vision/estimation/PoseManager.java
Outdated
Show resolved
Hide resolved
| FilterResult r = entry.getValue(); | ||
| for (Map.Entry<VisionMeasurement, FilterResult> filterEntry : filteredData.entrySet()) { | ||
| VisionMeasurement v = filterEntry.getKey(); | ||
| Apriltag tag = v.tag().tag(); |
There was a problem hiding this comment.
If I'm not mistaken, this is the only place where the TagPose class is used. I believe everything this class could be achieved by the AprilTag itself since it already has its own pose.
Also, since the pose is fixed per tag, logging the pose is not that interesting since it will always be the same.
There was a problem hiding this comment.
batchen said she wanted to be able to see the tag poses and tag ids together in one logging for easier lookup
There was a problem hiding this comment.
Lets discuss with her...
…ision_Simulation
…a_2026 into LS_Vision_Simulation_+Logging # Conflicts: # src/main/java/frc/robot/apriltags/SimApriltagIO.java # src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java
…a_2026 into LS_Vision_Simulation_+Logging # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
…ision_Simulation
…ision_Simulation
…a_2026 into LS_Vision_Simulation_+Logging
…ision_Simulation_+Logging # Conflicts: # src/main/java/frc/robot/Robot.java # src/main/java/frc/robot/apriltags/SimApriltagIO.java # src/main/java/frc/robot/constants/GameConstants.java # src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java
|
|
||
| //Debugs | ||
| public static final boolean DEBUG = false; | ||
| public static final boolean DEBUG = true; |
There was a problem hiding this comment.
This should be reverted
| Logger.recordOutput("Apriltag/acceptedMeasurements", validMeasurements.toArray(Pose2d[]::new)); | ||
| Logger.recordOutput( | ||
| "Apriltag/rejectedMeasurements", invalidMeasurements.toArray(Pose2d[]::new)); | ||
| // Logger.recordOutput("Apriltag/acceptedMeasurementsPose", validMeasurementsPose.toArray(Pose2d[]::new)); |
| Logger.recordOutput("OdomPose", robotContainer.getDriveBase().getOdom()); | ||
| } | ||
| } | ||
|
|
| Constants.SET_MODULE_ENCODER_AUTO_SYNCHRONIZE_DEADBAND); // Enable if you want to resynchronize your absolute encoders and motor encoders periodically when they are not moving. | ||
| // swerveDrive.pushOffsetsToEncoders(); // Set the absolute encoder to be used over the internal encoder and push the offsets onto it. Throws warning if not possible | ||
|
|
||
| if (Constants.currentMode==Constants.simMode) { |
There was a problem hiding this comment.
I think this was meant to be
| if (Constants.currentMode==Constants.simMode) { | |
| if (Constants.currentMode==Mode.SIM) { |
| // might be broken | ||
| public void resetOdometry(Pose2d initialHolonomicPose) { | ||
| swerveDrive.resetOdometry(initialHolonomicPose); | ||
| if (Constants.currentMode==Constants.simMode) { |
There was a problem hiding this comment.
| if (Constants.currentMode==Constants.simMode) { | |
| if (Constants.currentMode==Mode.SIM) { |
| */ | ||
| private final SwerveDrive swerveDrive; | ||
| private Vector<N3> variance = VecBuilder.fill(0.1,0.1,0.1); | ||
| private SwerveDriveOdometry rawOdometry; |
There was a problem hiding this comment.
I Think that the rawOdometry should be pulled into a separate class, like RawOdometry, that we can instantiate in SIM and update via periodic. Then all the state can be kept in it and not in the subsystem and we can clearly identify where It is used (and for what, since it be documented).
| public Pose2d getPose() { | ||
| return swerveDrive.getPose(); | ||
| } | ||
| public double getError() { |
There was a problem hiding this comment.
This can be moved into the new RawOdometry class and then it can be used to calculate error from subsystem pose, and log if necessary.
| // Todo: fix to only get odomtry | ||
| public Pose2d getOdom() { | ||
| return swerveDrive.getPose(); | ||
| if (Constants.currentMode==Constants.simMode) { |
There was a problem hiding this comment.
This can be reverted, and the rawOdometry.getPose can be used directly by the SimAprilTagIo if needed.
No description provided.