Skip to content

Ls vision simulation#84

Open
Levercpu wants to merge 4 commits intomainfrom
LS_Vision_Simulation
Open

Ls vision simulation#84
Levercpu wants to merge 4 commits intomainfrom
LS_Vision_Simulation

Conversation

@Levercpu
Copy link
Contributor

No description provided.

private boolean inBounds(Pose2d pose2d) {
return pose2d.getX() > 0 && pose2d.getX() < 20 && pose2d.getY() > 0 && pose2d.getY() < 20;
public static boolean inBounds(Pose2d pose2d) {
return pose2d.getX() > 0 && pose2d.getX() < 16.5 && pose2d.getY() > 0 && pose2d.getY() < 8.1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make constants for FIELD_LENGTH and FIELD_WIDTH

public Pose2d getPose() {
return swerveDrive.getPose();
}
public Pose2d getSimulationPose() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add line spaces around the new method

this.io = io;
estimator = new PoseEstimator(drivebase.getKinematics(), drivebase, 0, this);
estimator = new PoseEstimator(drivebase.getKinematics(), drivebase, 0, this);
robotPoseSupplier = drivebase::getSimulationPose;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we just use drive base.getSimulationPose when we need to? There is no value in hiding it behind a supplier.

double cosIncidenceAngle = (-adjPose.getX() * Math.cos(adjPose.getRotation().getZ()) - adjPose.getY() * Math.sin(adjPose.getRotation().getZ())) / (adjPose.getTranslation().getNorm());
double distance = tag.getTranslation().getDistance(cameraPos.getTranslation());
if (distance / cosIncidenceAngle < Constants.MAX_VISION_DISTANCE_SIMULATION) {
VisionMeasurement measurement = new VisionMeasurement(new Pose2d(), distance, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably give this the right time (e.g. off of the Logger) to allow the filtering algorithms to do their thing.

public abstract class BaseIoImpl<I extends LoggableInputs> implements BaseIo {
// The name of the "folder" where the logs from this IO will be logged
private final String prefix;
protected final String prefix;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed if you call super.periodic from the subclass.

return ordinal();
return ordinal()+1;
}
public TagPose getTagInfo() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used?

THIRTY_ONE(0.32, 147.47, 21.75),//Tower, Blue z rotation:0
THIRTY_TWO(0.32, 164.47, 21.75);//Tower, Blue z rotation:0
*/
public record TagPose(Apriltag tag, Pose3d pose) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used?


public Translation3d getTranslation() {
return new Translation3d(x, y, z);
return translation;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The translation is now returning distances in meters, but I don't think it makes a difference since no one (other than logging) is using this data.

private AutoFactory autoFactory;
private static AutoRoutine straightRoutine;
private static AutoTrajectory straightTrajectory;
private final VisionTruster truster = new ConstantVisionTruster(visionMeasurementStdDevs2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be using this truster or the square one?

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.

2 participants