Skip to content

Commit

Permalink
Merge branch 'RongruiArmSkeleton' of https://github.com/Team488/XBot2024
Browse files Browse the repository at this point in the history
 into RongruiArmSkeleton
  • Loading branch information
Rongrrz committed Jan 20, 2024
2 parents a5552d9 + 1df77e9 commit 6a651d8
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Why are we doing this?

Asana task URL:

# Whats changing?

# Questions/notes for reviewers
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/comment-on-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
pull_request:
types: [opened, closed, reopened, edited, converted_to_draft, ready_for_review]

jobs:
create-comment-in-asana-task-job:
runs-on: ubuntu-latest
name: Create a comment in Asana Task
steps:
- name: Create a comment
uses: Asana/[email protected]
id: createComment
with:
asana-secret: ${{ secrets.ASANA_SECRET }}
comment-text: "{{PR_NAME}} is {{PR_STATE}}: {{PR_URL}}"
- name: Get status
run: echo "Status is ${{ steps.createComment.outputs.status }}"
16 changes: 16 additions & 0 deletions .github/workflows/create-asana-attachment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
pull_request:
types: [opened, reopened, edited, converted_to_draft, ready_for_review]

jobs:
create-asana-attachment-job:
runs-on: ubuntu-latest
name: Create pull request attachments on Asana tasks
steps:
- name: Create pull request attachments
uses: Asana/create-app-attachment-github-action@latest
id: postAttachment
with:
asana-secret: ${{ secrets.ASANA_SECRET }}
- name: Log output status
run: echo "Status is ${{ steps.postAttachment.outputs.status }}"
2 changes: 1 addition & 1 deletion SeriouslyCommonLib
3 changes: 2 additions & 1 deletion src/main/java/competition/subsystems/arm/ArmSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class ArmSubsystem extends BaseSubsystem {

public DoubleProperty extendPower;
public DoubleProperty retractPower;

private DoubleProperty setPowerMax;
private DoubleProperty setPowerMin;

Expand All @@ -37,7 +38,7 @@ public ArmSubsystem(PropertyFactory pf, XCANSparkMax.XCANSparkMaxFactory sparkMa

extendPower = pf.createPersistentProperty("ExtendPower", 0.1);
retractPower = pf.createPersistentProperty("RetractPower", 0.1);

setPowerMax = pf.createPersistentProperty("SetPowerMax", 0.5);
setPowerMin = pf.createPersistentProperty("SetPowerMin", -0.5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class IntakeUntilNoteCollectedCommand extends BaseCommand {
@Inject
public IntakeUntilNoteCollectedCommand(CollectorSubsystem collector) {
this.collector = collector;
addRequirements(collector);
}
@Override
public void initialize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class TankDriveWithJoysticksCommand extends BaseCommand {
public TankDriveWithJoysticksCommand(OperatorInterface oi, DriveSubsystem driveSubsystem) {
this.oi = oi;
this.driveSubsystem = driveSubsystem;
this.addRequirements(this.driveSubsystem);
this.addRequirements(driveSubsystem);
}

@Override
Expand Down
25 changes: 11 additions & 14 deletions src/main/java/competition/subsystems/vision/VisionSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class VisionSubsystem extends BaseSubsystem implements DataFrameRefreshab
public static final String TARGET_POSE = "forwardAprilCamera/targetPose";
public static final String LATENCY_MILLIS = "forwardAprilCamera/latencyMillis";

//final PhotonCamera forwardAprilCamera;
final PhotonCameraExtended forwardAprilCamera;
final PhotonCameraExtended rearAprilCamera;

//final XPhotonCamera akitForwardAprilCamera;
Expand All @@ -62,11 +62,6 @@ public class VisionSubsystem extends BaseSubsystem implements DataFrameRefreshab

@Inject
public VisionSubsystem(PropertyFactory pf, RobotAssertionManager assertionManager) {

// Temporary while waiting for PhotonVision to update and make this plausible
// akitForwardAprilCamera = cameraFactory.create("forwardAprilCamera");
//akitRearAprilCamera = cameraFactory.create("rearAprilCamera");

this.assertionManager = assertionManager;
visionTable = NetworkTableInstance.getDefault().getTable(VISION_TABLE);

Expand All @@ -83,7 +78,7 @@ public VisionSubsystem(PropertyFactory pf, RobotAssertionManager assertionManage
// of errors. Some sort of VisionReady in the ElectricalContract may also make sense. Similarly,
// we need to handle cases like not having the AprilTag data loaded.

//forwardAprilCamera = new PhotonCamera("forwardAprilCamera");
forwardAprilCamera = new PhotonCameraExtended("forwardAprilCamera");
rearAprilCamera = new PhotonCameraExtended("rearAprilCamera");

try {
Expand All @@ -106,12 +101,12 @@ public VisionSubsystem(PropertyFactory pf, RobotAssertionManager assertionManage
16.421 / PoseSubsystem.INCHES_IN_A_METER),
new Rotation3d(0, 0, Math.toRadians(180 + 7.595)));

/*frontPhotonPoseEstimator = new PhotonPoseEstimator(
frontPhotonPoseEstimator = new PhotonPoseEstimator(
aprilTagFieldLayout,
PhotonPoseEstimator.PoseStrategy.MULTI_TAG_PNP_ON_COPROCESSOR,
forwardAprilCamera,
robotToCam
);*/
);
rearPhotonPoseEstimator = new PhotonPoseEstimator(
aprilTagFieldLayout,
PhotonPoseEstimator.PoseStrategy.MULTI_TAG_PNP_ON_COPROCESSOR,
Expand All @@ -122,9 +117,9 @@ public VisionSubsystem(PropertyFactory pf, RobotAssertionManager assertionManage

public Optional<EstimatedRobotPose>[] getPhotonVisionEstimatedPoses(Pose2d previousEstimatedRobotPose) {
if (visionWorking) {
//var frontEstimatedPose = getPhotonVisionEstimatedPose("Front", frontPhotonPoseEstimator, previousEstimatedRobotPose, frontReliablePoseIsStable);
var frontEstimatedPose = getPhotonVisionEstimatedPose("Front", frontPhotonPoseEstimator, previousEstimatedRobotPose, frontReliablePoseIsStable);
var rearEstimatedPose = getPhotonVisionEstimatedPose("Rear", rearPhotonPoseEstimator, previousEstimatedRobotPose, rearReliablePoseIsStable);
return new Optional[] {/*frontEstimatedPose,*/ rearEstimatedPose};
return new Optional[] {frontEstimatedPose, rearEstimatedPose};
} else {
return new Optional[] {Optional.empty()};
}
Expand All @@ -136,9 +131,10 @@ public Optional<EstimatedRobotPose> getPhotonVisionEstimatedPose(
estimator.setReferencePose(previousEstimatedRobotPose);
var estimatedPose = estimator.update();
// Log the estimated pose, and log an insane value if we don't have one (so we don't clutter up the visualization)
Logger.recordOutput(getPrefix()+name+"Estimate", estimatedPose.isPresent()
? estimatedPose.get().estimatedPose.toPose2d() :
new Pose2d(-1000, -1000, new Rotation2d(0)));
if (estimatedPose.isPresent())
{
Logger.recordOutput(getPrefix()+name+"Estimate", estimatedPose.get().estimatedPose.toPose2d());
}

var isReliable = !estimatedPose.isEmpty() && isEstimatedPoseReliable(estimatedPose.get(), previousEstimatedRobotPose);
var isStable = waitForStablePoseTime.get() == 0.0 || poseTimeValidator.checkStable(isReliable);
Expand Down Expand Up @@ -211,6 +207,7 @@ private String getStringFromList(List<Integer> list) {

@Override
public void refreshDataFrame() {
forwardAprilCamera.refreshDataFrame();
rearAprilCamera.refreshDataFrame();
}
}

0 comments on commit 6a651d8

Please sign in to comment.