001/* 002 * MIT License 003 * 004 * Copyright (c) PhotonVision 005 * 006 * Permission is hereby granted, free of charge, to any person obtaining a copy 007 * of this software and associated documentation files (the "Software"), to deal 008 * in the Software without restriction, including without limitation the rights 009 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 010 * copies of the Software, and to permit persons to whom the Software is 011 * furnished to do so, subject to the following conditions: 012 * 013 * The above copyright notice and this permission notice shall be included in all 014 * copies or substantial portions of the Software. 015 * 016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 019 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 022 * SOFTWARE. 023 */ 024 025package org.photonvision; 026 027import edu.wpi.first.math.geometry.Pose3d; 028import java.util.List; 029import org.photonvision.PhotonPoseEstimator.PoseStrategy; 030import org.photonvision.targeting.PhotonTrackedTarget; 031 032/** An estimated pose based on pipeline result */ 033public class EstimatedRobotPose { 034 /** The estimated pose */ 035 public final Pose3d estimatedPose; 036 037 /** The estimated time the frame used to derive the robot pose was taken */ 038 public final double timestampSeconds; 039 040 /** A list of the targets used to compute this pose */ 041 public final List<PhotonTrackedTarget> targetsUsed; 042 043 /** The strategy actually used to produce this pose */ 044 public final PoseStrategy strategy; 045 046 /** 047 * Constructs an EstimatedRobotPose 048 * 049 * @param estimatedPose estimated pose 050 * @param timestampSeconds timestamp of the estimate 051 * @param targetsUsed list of targets used 052 */ 053 public EstimatedRobotPose( 054 Pose3d estimatedPose, double timestampSeconds, List<PhotonTrackedTarget> targetsUsed) { 055 this.estimatedPose = estimatedPose; 056 this.timestampSeconds = timestampSeconds; 057 this.targetsUsed = targetsUsed; 058 this.strategy = null; 059 } 060 061 /** 062 * Constructs an EstimatedRobotPose 063 * 064 * @param estimatedPose estimated pose 065 * @param timestampSeconds timestamp of the estimate 066 * @param targetsUsed targets used to compute the pose 067 * @param strategy the strategy used to compute the pose 068 */ 069 public EstimatedRobotPose( 070 Pose3d estimatedPose, 071 double timestampSeconds, 072 List<PhotonTrackedTarget> targetsUsed, 073 PoseStrategy strategy) { 074 this.estimatedPose = estimatedPose; 075 this.timestampSeconds = timestampSeconds; 076 this.targetsUsed = targetsUsed; 077 this.strategy = strategy; 078 } 079}