-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/robot state #4
base: main
Are you sure you want to change the base?
Conversation
still need to check the target's pose strategy
commit משמעותי
…for field oriented and target oriented position
private final Joystick leftJoystick = new Joystick(1); | ||
private final Joystick rightJoystick = new Joystick(2); | ||
|
||
private final JoystickButton joystickTrigger = new JoystickButton(leftJoystick, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a CommandJoystick
instead.
AprilTagFieldLayout.loadFromResource("2023field.fmap"), | ||
PhotonPoseEstimator.PoseStrategy.MULTI_TAG_PNP, | ||
AprilTagFields.k2023ChargedUp.loadAprilTagLayoutField(), | ||
// PhotonPoseEstimator.PoseStrategy.MULTI_TAG_PNP, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't commit commented code.
AprilTagFieldLayout.loadFromResource("2023field.fmap"), | ||
PhotonPoseEstimator.PoseStrategy.MULTI_TAG_PNP, | ||
AprilTagFields.k2023ChargedUp.loadAprilTagLayoutField(), | ||
// PhotonPoseEstimator.PoseStrategy.MULTI_TAG_PNP, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't commit commented code.
inputs.hasTargets = latestResult.hasTargets(); | ||
inputs.targetID = latestResult.getBestTarget().getFiducialId(); | ||
for (int i = 0; i < latestResult.targets.size(); i++) { | ||
System.out.println(latestResult.targets.get(i)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You log everything, just look at the data in AdvantageScope instead of printing it.
inputs.hasTargets = latestResult.hasTargets(); | ||
inputs.targetID = latestResult.getBestTarget().getFiducialId(); | ||
for (int i = 0; i < latestResult.targets.size(); i++) { | ||
System.out.println(latestResult.targets.get(i)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You log everything, just look at the data in AdvantageScope instead of printing it.
var latestResult = camera.getLatestResult(); | ||
for (int i = 0; i < latestResult.targets.size(); i++) { | ||
System.out.println(latestResult.targets.get(i)); | ||
} | ||
|
||
if (latestResult != null) { | ||
inputs.latency = (long) latestResult.getLatencyMillis(); | ||
if (latestResult.getBestTarget() != null) { | ||
inputs.area = latestResult.getBestTarget().getArea(); | ||
inputs.pitch = latestResult.getBestTarget().getPitch(); | ||
inputs.yaw = latestResult.getBestTarget().getYaw(); | ||
inputs.targetSkew = latestResult.getBestTarget().getSkew(); | ||
inputs.hasTargets = latestResult.hasTargets(); | ||
inputs.targetID = latestResult.getBestTarget().getFiducialId(); | ||
} | ||
|
||
var estimatedPose = estimator.update(latestResult); | ||
if (estimatedPose.isPresent()) { | ||
var pose = estimatedPose.get().estimatedPose; | ||
inputs.poseFieldOriented = new double[]{ | ||
pose.getX(), | ||
pose.getY(), | ||
pose.getZ(), | ||
pose.getRotation().getX(), | ||
pose.getRotation().getY(), | ||
pose.getRotation().getZ() | ||
}; | ||
|
||
var cameraToTarget = latestResult.getBestTarget().getBestCameraToTarget(); | ||
System.out.println("cameraToTarget: " + cameraToTarget); | ||
inputs.cameraToTarget = new double[]{ | ||
cameraToTarget.getX(), | ||
cameraToTarget.getY(), | ||
cameraToTarget.getZ(), | ||
cameraToTarget.getRotation().getX(), | ||
cameraToTarget.getRotation().getY(), | ||
cameraToTarget.getRotation().getZ() | ||
}; | ||
|
||
result = new Result(latestResult.getTimestampSeconds(), estimatedPose.get().estimatedPose); | ||
} else { | ||
result = null; | ||
} | ||
} else { | ||
result = null; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like latestResult
will never be null
. But:
- You don't
null
-check in the for loop above. - Even if you do need to
null
-check, it's better to check whetherlatestResult == null
and then immediatelyreturn
because it will help you reduce indentation, which helps you reduce indentation. The same can be done with the condition in line 55:
var latestResult = camera.getLatestResult();
for (int i = 0; i < latestResult.targets.size(); i++) {
System.out.println(latestResult.targets.get(i));
}
if (latestResult == null) {
result = null;
return;
}
inputs.latency = (long) latestResult.getLatencyMillis();
if (latestResult.getBestTarget() == null) {
return;
}
inputs.area = latestResult.getBestTarget().getArea();
inputs.pitch = latestResult.getBestTarget().getPitch();
inputs.yaw = latestResult.getBestTarget().getYaw();
inputs.targetSkew = latestResult.getBestTarget().getSkew();
inputs.hasTargets = latestResult.hasTargets();
inputs.targetID = latestResult.getBestTarget().getFiducialId();
var estimatedPose = estimator.update(latestResult);
if (estimatedPose.isEmpty()) {
result = null;
return;
}
var pose = estimatedPose.get().estimatedPose;
inputs.poseFieldOriented = new double[]{
pose.getX(),
pose.getY(),
pose.getZ(),
pose.getRotation().getX(),
pose.getRotation().getY(),
pose.getRotation().getZ()
};
var cameraToTarget = latestResult.getBestTarget().getBestCameraToTarget();
System.out.println("cameraToTarget: " + cameraToTarget);
inputs.cameraToTarget = new double[]{
cameraToTarget.getX(),
cameraToTarget.getY(),
cameraToTarget.getZ(),
cameraToTarget.getRotation().getX(),
cameraToTarget.getRotation().getY(),
cameraToTarget.getRotation().getZ()
};
result = new Result(latestResult.getTimestampSeconds(), estimatedPose.get().estimatedPose);
pose.getRotation().getZ() | ||
}; | ||
var cameraToTarget = latestResult.getBestTarget().getBestCameraToTarget(); | ||
System.out.println("cameraToTarget: " + cameraToTarget); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, no need to print. Use AdvantageScope instead.
VisionModule.photonVisionIO("LeftPie", 0), | ||
VisionModule.photonVisionIO("RightPie", 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Pi", not "Pie" 🙃.
Also, it's better to write "Left Pi" and "Right Pi" -- this is a string, no need to join words.
@@ -3,7 +3,14 @@ | |||
import edu.wpi.first.math.geometry.*; | |||
|
|||
public class VisionConstants { | |||
public static final Transform3d[] ROBOT_TO_CAM = new Transform3d[]{new Transform3d(new Translation3d(0, 0, 0.45), new Rotation3d(0, 0, 180)), new Transform3d(new Translation3d(0, 0, 0.45), new Rotation3d(0, 0, 0))}; | |||
public static final Transform3d[] ROBOT_TO_CAM = new Transform3d[]{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- No need to shorten, use the full form of the word.
- Use the word "cameras" instead of "camera" so it will be clear there are multiple in this constant.
…im-bot-2023 into feature/RobotState
@@ -74,6 +74,8 @@ public void robotPeriodic() { | |||
|
|||
enabledTrigger.update(isEnabled()); | |||
|
|||
RobotState.getInstance().update(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that needed? this is not done for any other system. Perhaps another way is possible (hint: commands)
new Rotation3d(Math.toRadians(0)+0.16, Math.toRadians(-28)-0.085, Math.toRadians(-151)))}; | ||
// new Transform3d( //right cam |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't commit commented code.
import frc.robot.RobotState; | ||
import swerve.SwerveDrive; | ||
|
||
public class GoToPose extends CommandBase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this class? Does PathPlanner lack the functionality you need?
import org.photonvision.SimVisionSystem; | ||
import swerve.SwerveDrive; | ||
|
||
public class SImVisionIO implements VisionIO{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sim
, not SIm
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implements specifically PhotonVision simulation, and its name should emphasize that.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why all that whitespace? One line is enogh.
for (int i = 1; i < VisionConstants.TARGET_POSITION_SIM.length; i++) { | ||
coprocessorSim.addSimVisionTarget(VisionConstants.SIM_VISION_TARGETS[i]); | ||
coprocessorSim.processFrame(SwerveDrive.getInstance(false).getBotPose()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 1; i < VisionConstants.TARGET_POSITION_SIM.length; i++) { | |
coprocessorSim.addSimVisionTarget(VisionConstants.SIM_VISION_TARGETS[i]); | |
coprocessorSim.processFrame(SwerveDrive.getInstance(false).getBotPose()); | |
} | |
for (SimVisionTarget target : VisionConstants.SIM_VISION_TARGETS) { | |
coprocessorSim.addSimVisionTarget(target); | |
coprocessorSim.processFrame(SwerveDrive.getInstance(false).getBotPose()); | |
} | |
if (res.hasTargets()) { | ||
var imageCaptureTime = res.getTimestampSeconds(); | ||
var camToTargetTrans = res.getBestTarget().getBestCameraToTarget(); | ||
var camPose = Constants.kFarTargetPose.transformBy(camToTargetTrans.inverse()); | ||
m_poseEstimator.addVisionMeasurement( | ||
camPose.transformBy(Constants.kCameraToRobot).toPose2d(), imageCaptureTime); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (res.hasTargets()) { | |
var imageCaptureTime = res.getTimestampSeconds(); | |
var camToTargetTrans = res.getBestTarget().getBestCameraToTarget(); | |
var camPose = Constants.kFarTargetPose.transformBy(camToTargetTrans.inverse()); | |
m_poseEstimator.addVisionMeasurement( | |
camPose.transformBy(Constants.kCameraToRobot).toPose2d(), imageCaptureTime); | |
} | |
if (!res.hasTargets()) { | |
// Exit early if there are no targets | |
return; | |
} | |
var imageCaptureTime = res.getTimestampSeconds(); | |
var camToTargetTrans = res.getBestTarget().getBestCameraToTarget(); | |
var camPose = Constants.kFarTargetPose.transformBy(camToTargetTrans.inverse()); | |
m_poseEstimator.addVisionMeasurement( | |
camPose.transformBy(Constants.kCameraToRobot).toPose2d(), imageCaptureTime); |
It's good practice to reduce indentation whenever possible.
@@ -24,6 +25,7 @@ public class VisionConstants { | |||
public static final double TARGET_LENGTH = 0.27; | |||
public static final Pose3d[] TARGET_POSITION_REAL = new Pose3d[]{new Pose3d() ,new Pose3d(new Translation3d( 7.24310, -2.93659, 0.46272), new Rotation3d(0,0,180)),new Pose3d(new Translation3d(7.24310, 1.26019, 0.46272), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.24310, 0.41621, 0.41621), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.90832, 2.74161, 0.695452), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(-7.90832, 2.74161, 0.695452), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 0.41621, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 1.26019, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, -2.93659, 0.46272), new Rotation3d())}; | |||
public static final Pose3d[] TARGET_POSITION_LIME = new Pose3d[]{new Pose3d() ,new Pose3d(new Translation3d( 7.24310, -2.93659, 0.46272), new Rotation3d(0,0,180)),new Pose3d(new Translation3d(7.24310, 1.26019, 0.46272), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.24310, 0.41621, 0.41621), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.90832, 2.74161, 0.695452), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(-7.90832, 2.74161, 0.695452), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 0.41621, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 1.26019, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, -2.93659, 0.46272), new Rotation3d())}; | |||
public static final Pose3d[] TARGET_POSITION_SIM = new Pose3d[]{new Pose3d() ,new Pose3d(new Translation3d( 7.24310, -2.93659, 0.46272), new Rotation3d(0,0,180)),new Pose3d(new Translation3d(7.24310, 1.26019, 0.46272), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.24310, 0.41621, 0.41621), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.90832, 2.74161, 0.695452), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(-7.90832, 2.74161, 0.695452), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 0.41621, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 1.26019, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, -2.93659, 0.46272), new Rotation3d())}; | |||
public static final Pose3d[] TARGET_POSITION_SIM = new Pose3d[]{new Pose3d() ,new Pose3d(new Translation3d( 7.24310, -2.93659, 0.46272), new Rotation3d(0,0,180)),new Pose3d(new Translation3d(7.24310, -1.26019, 0.46272), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.24310, 0.41621, 0.46272), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.90832, 2.74161, 0.695452), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(-7.90832, 2.74161, 0.695452), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 0.41621, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 1.26019, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, -2.93659, 0.46272), new Rotation3d())}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can shorten this line a bit by using this constructor that gets the x,y,z values directly without needing to create a Translation3d
manually, so new Pose3d(new Translation3d(7.24310, -2.93659, 0.46272), new Rotation3d(0,0,180))
is the same as new Pose3d(7.24310, -2.93659, 0.46272, new Rotation3d(0,0,180))
.
@@ -24,6 +25,7 @@ public class VisionConstants { | |||
public static final double TARGET_LENGTH = 0.27; | |||
public static final Pose3d[] TARGET_POSITION_REAL = new Pose3d[]{new Pose3d() ,new Pose3d(new Translation3d( 7.24310, -2.93659, 0.46272), new Rotation3d(0,0,180)),new Pose3d(new Translation3d(7.24310, 1.26019, 0.46272), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.24310, 0.41621, 0.41621), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.90832, 2.74161, 0.695452), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(-7.90832, 2.74161, 0.695452), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 0.41621, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 1.26019, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, -2.93659, 0.46272), new Rotation3d())}; | |||
public static final Pose3d[] TARGET_POSITION_LIME = new Pose3d[]{new Pose3d() ,new Pose3d(new Translation3d( 7.24310, -2.93659, 0.46272), new Rotation3d(0,0,180)),new Pose3d(new Translation3d(7.24310, 1.26019, 0.46272), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.24310, 0.41621, 0.41621), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.90832, 2.74161, 0.695452), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(-7.90832, 2.74161, 0.695452), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 0.41621, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 1.26019, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, -2.93659, 0.46272), new Rotation3d())}; | |||
public static final Pose3d[] TARGET_POSITION_SIM = new Pose3d[]{new Pose3d() ,new Pose3d(new Translation3d( 7.24310, -2.93659, 0.46272), new Rotation3d(0,0,180)),new Pose3d(new Translation3d(7.24310, 1.26019, 0.46272), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.24310, 0.41621, 0.41621), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.90832, 2.74161, 0.695452), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(-7.90832, 2.74161, 0.695452), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 0.41621, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 1.26019, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, -2.93659, 0.46272), new Rotation3d())}; | |||
public static final Pose3d[] TARGET_POSITION_SIM = new Pose3d[]{new Pose3d() ,new Pose3d(new Translation3d( 7.24310, -2.93659, 0.46272), new Rotation3d(0,0,180)),new Pose3d(new Translation3d(7.24310, -1.26019, 0.46272), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.24310, 0.41621, 0.46272), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(7.90832, 2.74161, 0.695452), new Rotation3d(0,0,180)), new Pose3d(new Translation3d(-7.90832, 2.74161, 0.695452), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 0.41621, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, 1.26019, 0.46272), new Rotation3d()), new Pose3d(new Translation3d(-7.24310, -2.93659, 0.46272), new Rotation3d())}; | |||
public static final SimVisionTarget[] SIM_VISION_TARGETS = new SimVisionTarget[]{new SimVisionTarget(new Pose3d().toPose2d(), 0,0, 0), new SimVisionTarget(TARGET_POSITION_SIM[1].toPose2d(), TARGET_WIDTH,TARGET_LENGTH, 1), new SimVisionTarget(TARGET_POSITION_SIM[2].toPose2d(), TARGET_WIDTH,TARGET_LENGTH, 2), new SimVisionTarget(TARGET_POSITION_SIM[3].toPose2d(), TARGET_WIDTH,TARGET_LENGTH, 3), new SimVisionTarget(TARGET_POSITION_SIM[4].toPose2d(), TARGET_WIDTH,TARGET_LENGTH, 4), new SimVisionTarget(TARGET_POSITION_SIM[5].toPose2d(), TARGET_WIDTH,TARGET_LENGTH, 5), new SimVisionTarget(TARGET_POSITION_SIM[6].toPose2d(), TARGET_WIDTH,TARGET_LENGTH, 6), new SimVisionTarget(TARGET_POSITION_SIM[7].toPose2d(), TARGET_WIDTH,TARGET_LENGTH, 7), new SimVisionTarget(TARGET_POSITION_SIM[8].toPose2d(), TARGET_WIDTH,TARGET_LENGTH, 8), new SimVisionTarget(new Pose3d().toPose2d(),0,0,0)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you cast to Pose2d
? This class accepts Pose3d
.
@Override | ||
public void setPipeLine(int pipeLineIndex) { | ||
simCamera.getCamera().setPipelineIndex(pipeLineIndex); | ||
} | ||
|
||
@Override | ||
public Result getLatestResult() { | ||
return new Result(simCamera.getCamera().getLatestResult().getTimestampSeconds(), new Pose3d(simCamera.getCamera().getLatestResult().getBestTarget().getBestCameraToTarget().getTranslation(),simCamera.getCamera().getLatestResult().getBestTarget().getBestCameraToTarget().getRotation())); | ||
return new Result(simCamera.getCamera().getLatestResult().getTimestampSeconds(), new Pose3d(simCamera.getCamera().getLatestResult().getBestTarget().getBestCameraToTarget().getTranslation(), simCamera.getCamera().getLatestResult().getBestTarget().getBestCameraToTarget().getRotation())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simCamera.getCamera().getLatestResult()
should be extracted into a variable, for two reasons:
- Reduce code repittion.
- It's possible that between the first and the second/third call of
getLatestResult()
another result will come in. This is problematic because the returnedResult
should have data from exactly one measurement -- we don't want theResult
to have a coordinate oft1
but timestamp oft2
.
But I must ask, why is this function even needed? Why not just use getLatestResult()
directly? All your function does is remove information from the value returned from that function.
inputs.hasTargets = simCamera.getCamera().getLatestResult().hasTargets(); | ||
inputs.yaw = simCamera.getCamera().getLatestResult().getBestTarget().getYaw(); | ||
inputs.pitch = simCamera.getCamera().getLatestResult().getBestTarget().getPitch(); | ||
inputs.area = simCamera.getCamera().getLatestResult().getBestTarget().getArea(); | ||
inputs.targetSkew = simCamera.getCamera().getLatestResult().getBestTarget().getSkew(); | ||
inputs.targetID = simCamera.getCamera().getLatestResult().getBestTarget().getFiducialId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too simCamera.getCamera().getLatestResult().getBestTarget()
needs to be extracted in a variable. In IntelliJ IDEA, you can select this text and use Ctrl+Alt+V to replace all usages with the new variable.
inputs.cameraToTarget = new double[]{bestCameraToTarget.getX(), bestCameraToTarget.getY(), bestCameraToTarget.getZ(), bestCameraToTarget.getRotation().getX(), bestCameraToTarget.getRotation().getY(), bestCameraToTarget.getRotation().getZ()}; | ||
inputs.poseFieldOriented = new double[]{estimatedPose.getX(), estimatedPose.getY(), estimatedPose.getZ(), estimatedPose.getRotation().getQuaternion().getW(), estimatedPose.getRotation().getQuaternion().getX(), estimatedPose.getRotation().getQuaternion().getY(), estimatedPose.getRotation().getQuaternion().getZ()}; | ||
inputs.fieldOrientedRotationRad = new double[]{estimatedPose.getRotation().getX(), estimatedPose.getRotation().getY(), estimatedPose.getRotation().getZ()}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pose3d
and Transform3d
have struct support, so you can just log them directly without needing to convert them to an array.
@@ -18,7 +18,6 @@ public PhotonVisionIO(PhotonCamera camera, Transform3d robotToCamera) { | |||
try { | |||
estimator = new PhotonPoseEstimator( | |||
AprilTagFields.k2023ChargedUp.loadAprilTagLayoutField(), | |||
// PhotonPoseEstimator.PoseStrategy.MULTI_TAG_PNP, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't commit commented commit.
@@ -7,21 +7,8 @@ public interface VisionIO { | |||
|
|||
void setPipeLine(int pipeLineIndex); | |||
|
|||
void updateInputs(VisionInputsAutoLogged inputs); | |||
void updateInputs(VisionInputsLogged inputs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove @AutoLog
?
Hello, I am having trouble figuring whether the calculations for the robot pose Vision subsystem in simulation are correct.
please help me.
thanks.
Yim Yum