Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Note map #20

Merged
merged 6 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class Robot extends TimedRobot {
new LightsSubsystem(
new CANdle(RobotConfig.get().lights().deviceID(), "rio"), robotManager, vision, intake);
private final NoteTrackingManager noteTrackingManager =
new NoteTrackingManager(localization, swerve, actions, robotManager);
new NoteTrackingManager(localization, swerve, actions, robotManager, imu);

public Robot() {
System.out.println("roboRIO serial number: " + RobotConfig.SERIAL_NUMBER);
Expand Down Expand Up @@ -239,7 +239,7 @@ private void configureBindings() {
.onFalse(actions.stowCommand());
operatorController
.povRight()
.whileTrue(noteTrackingManager.intakeDetectedNote())
.whileTrue(noteTrackingManager.intakeNearestMapNote())
.onFalse(actions.stowCommand());
operatorController
.rightTrigger()
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/frc/robot/config/CompConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,14 @@ class CompConfig {
0.4,
0.4,
tyToNoteDistance -> {
tyToNoteDistance.put(3.0, Units.inchesToMeters(0 + 20.5));
tyToNoteDistance.put(10.5, Units.inchesToMeters(10.5 + 20.5));
tyToNoteDistance.put(20.0, Units.inchesToMeters(18.5 + 20.5));
tyToNoteDistance.put(30.0, Units.inchesToMeters(29.5 + 20.5));
tyToNoteDistance.put(35.0, Units.inchesToMeters(40.0 + 20.5));
tyToNoteDistance.put(40.0, Units.inchesToMeters(58.5 + 20.5));
tyToNoteDistance.put(45.0, Units.inchesToMeters(90 + 20.5));
tyToNoteDistance.put(47.0, Units.inchesToMeters(114.0 + 20.5));
tyToNoteDistance.put(3.0 - 24.5, Units.inchesToMeters(0 + 20.5));
tyToNoteDistance.put(10.5 - 24.5, Units.inchesToMeters(10.5 + 20.5));
tyToNoteDistance.put(20.0 - 24.5, Units.inchesToMeters(18.5 + 20.5));
tyToNoteDistance.put(30.0 - 24.5, Units.inchesToMeters(29.5 + 20.5));
tyToNoteDistance.put(35.0 - 24.5, Units.inchesToMeters(40.0 + 20.5));
tyToNoteDistance.put(40.0 - 24.5, Units.inchesToMeters(58.5 + 20.5));
tyToNoteDistance.put(45.0 - 24.5, Units.inchesToMeters(90 + 20.5));
tyToNoteDistance.put(47.0 - 24.5, Units.inchesToMeters(114.0 + 20.5));
},
// x=right, y= forward, z=up
new Translation3d(-0.025, Units.inchesToMeters(-1), Units.inchesToMeters(23.25)),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/imu/ImuSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private boolean atAngle(Rotation2d angle, Rotation2d tolerance) {
return Math.abs(getRobotHeading().minus(angle).getDegrees()) < tolerance.getDegrees();
}

public boolean belowVelocityForSpeaker(double distance) {
public boolean belowVelocityForVision(double distance) {
return getRobotAngularVelocity().getDegrees() < 10;
}

Expand Down
9 changes: 9 additions & 0 deletions src/main/java/frc/robot/note_tracking/NoteMapElement.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot.note_tracking;

import edu.wpi.first.math.geometry.Pose2d;

public record NoteMapElement(double expiresAt, Pose2d notePose) {}
Loading