Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNotTy committed Mar 19, 2024
1 parent 134f000 commit 106d1cc
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 29 deletions.
6 changes: 4 additions & 2 deletions .pathplanner/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
"robotLength": 0.4631436,
"holonomicMode": true,
"pathFolders": [
"Left Paths",
"Middle Paths",
"Left Paths"
"Right Paths"
],
"autoFolders": [
"Left",
"Middle",
"Left"
"Right"
],
"defaultMaxVel": 3.0,
"defaultMaxAccel": 3.0,
Expand Down
4 changes: 2 additions & 2 deletions src/main/deploy/pathplanner/autos/Left 2 Note Auto.auto
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"data": {
"commands": [
{
"type": "named",
"type": "path",
"data": {
"name": "Apriltag Align"
"pathName": "Left-Subwoofer"
}
},
{
Expand Down
18 changes: 18 additions & 0 deletions src/main/deploy/pathplanner/autos/Right Two Note.auto
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 1.0,
"startingPose": {
"position": {
"x": 2,
"y": 2
},
"rotation": 0
},
"command": {
"type": "sequential",
"data": {
"commands": []
}
},
"folder": "Right",
"choreoAuto": false
}
58 changes: 58 additions & 0 deletions src/main/deploy/pathplanner/paths/Leave Right.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"version": 1.0,
"waypoints": [
{
"anchor": {
"x": 0.6699236223008809,
"y": 4.543804579763226
},
"prevControl": null,
"nextControl": {
"x": 1.6699236223008804,
"y": 4.543804579763226
},
"isLocked": false,
"linkedName": null
},
{
"anchor": {
"x": 2.8481392198162414,
"y": 4.098792791023527
},
"prevControl": {
"x": 1.8481392198162414,
"y": 4.098792791023527
},
"nextControl": null,
"isLocked": false,
"linkedName": null
}
],
"rotationTargets": [
{
"waypointRelativePos": 0.45,
"rotationDegrees": 0.0,
"rotateFast": false
}
],
"constraintZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0
},
"goalEndState": {
"velocity": 0,
"rotation": 0,
"rotateFast": false
},
"reversed": false,
"folder": "Right Paths",
"previewStartingState": {
"rotation": -57.0,
"velocity": 0
},
"useDefaultConstraints": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@
"linkedName": null
}
],
"rotationTargets": [
{
"waypointRelativePos": 0.25,
"rotationDegrees": 0,
"rotateFast": false
}
],
"rotationTargets": [],
"constraintZones": [],
"eventMarkers": [],
"globalConstraints": {
Expand All @@ -45,13 +39,13 @@
},
"goalEndState": {
"velocity": 0,
"rotation": 0,
"rotation": 56.0,
"rotateFast": false
},
"reversed": false,
"folder": "Left Paths",
"previewStartingState": {
"rotation": 57.0,
"rotation": 0.0,
"velocity": 0
},
"useDefaultConstraints": false
Expand Down
58 changes: 58 additions & 0 deletions src/main/deploy/pathplanner/paths/Right-Subwoofer.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"version": 1.0,
"waypoints": [
{
"anchor": {
"x": 2.85,
"y": 4.1
},
"prevControl": null,
"nextControl": {
"x": 1.8500000000000005,
"y": 4.1
},
"isLocked": false,
"linkedName": null
},
{
"anchor": {
"x": 0.67,
"y": 4.54
},
"prevControl": {
"x": 1.67,
"y": 4.54
},
"nextControl": null,
"isLocked": false,
"linkedName": null
}
],
"rotationTargets": [
{
"waypointRelativePos": 0.45,
"rotationDegrees": -57.0,
"rotateFast": false
}
],
"constraintZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0
},
"goalEndState": {
"velocity": 0,
"rotation": -57.0,
"rotateFast": false
},
"reversed": false,
"folder": "Right Paths",
"previewStartingState": {
"rotation": 0.0,
"velocity": 0
},
"useDefaultConstraints": true
}
1 change: 1 addition & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ private void configureButtonBindings() {
ControlMap.m_driverController.leftBumper().onTrue(new InstantCommand(() -> m_drivetrain.zeroGyro()));
ControlMap.m_driverController.b().toggleOnTrue(m_defaultDrive);
ControlMap.m_driverController.a().onTrue(m_alignSpeaker);
ControlMap.m_driverController.x().onTrue(m_alignAmp);

// Gunner button bindings
ControlMap.m_gunnerController.a().whileTrue(m_intakeDown);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,25 +173,26 @@ public PathPlannerPath alignAmp(PoseEstimator estimation, Vision vision) {
double tagX = 0;
double tagY = 0;
Rotation2d tagAngle = new Rotation2d();
double xChange = 0;
double yChange = 0;

if(DriverStation.getAlliance().get() == DriverStation.Alliance.Blue) {
tagX = vision.return_tag_pose(6).getX();
tagY = vision.return_tag_pose(6).getY();;
tagAngle = new Rotation2d(90);
} else {
tagX = vision.return_tag_pose(5).getX();
tagY = vision.return_tag_pose(5).getY();;
tagAngle = new Rotation2d(90);
}
double xChange = Constants.SwerveConstants.trackWidth/2;
double yChange = Constants.SwerveConstants.trackWidth/2;

tagX = vision.return_tag_pose(6).getX();
tagY = vision.return_tag_pose(6).getY();
tagAngle = new Rotation2d(3 * Math.PI/2);

double offset = Constants.SwerveConstants.trackWidth / 2;
// double offset = Constants.SwerveConstants.trackWidth / 2;

// List<Translation2d> bezierPoints = PathPlannerPath.bezierFromPoses(
// new Pose2d(x, y, angle),
// new Pose2d(tagX + xChange, tagY + yChange, tagAngle)
// );

System.out.println(tagX + xChange);

List<Translation2d> bezierPoints = PathPlannerPath.bezierFromPoses(
new Pose2d(x, y, angle),
new Pose2d(tagX + xChange, tagY + yChange, tagAngle)
);
new Pose2d(x, y, angle),
new Pose2d(tagX + xChange, tagY - yChange, tagAngle)
);

// Create the path using the bezier points created above
PathPlannerPath path = new PathPlannerPath(
Expand Down

0 comments on commit 106d1cc

Please sign in to comment.