Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
/*
|
2020-12-31 19:57:51 -08:00
|
|
|
|
* Copyright (C) Photon Vision.
|
Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
*
|
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
*/
|
2022-01-20 19:35:28 -08:00
|
|
|
|
|
2021-01-16 20:41:47 -08:00
|
|
|
|
package org.photonvision.targeting;
|
Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
|
2022-09-28 18:21:41 -07:00
|
|
|
|
import edu.wpi.first.math.geometry.Transform3d;
|
2022-01-10 20:31:36 -08:00
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
import java.util.List;
|
2020-07-19 22:42:45 -04:00
|
|
|
|
import org.photonvision.common.dataflow.structures.Packet;
|
2023-12-24 19:56:08 -05:00
|
|
|
|
import org.photonvision.common.dataflow.structures.PacketSerde;
|
2023-10-17 10:20:00 -04:00
|
|
|
|
import org.photonvision.utils.PacketUtils;
|
Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
|
2021-01-16 20:41:47 -08:00
|
|
|
|
public class PhotonTrackedTarget {
|
2023-01-06 19:20:27 -08:00
|
|
|
|
private static final int MAX_CORNERS = 8;
|
Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
|
2023-12-24 19:56:08 -05:00
|
|
|
|
private final double yaw;
|
|
|
|
|
|
private final double pitch;
|
|
|
|
|
|
private final double area;
|
|
|
|
|
|
private final double skew;
|
|
|
|
|
|
private final int fiducialId;
|
|
|
|
|
|
private final Transform3d bestCameraToTarget;
|
|
|
|
|
|
private final Transform3d altCameraToTarget;
|
|
|
|
|
|
private final double poseAmbiguity;
|
2023-01-06 19:20:27 -08:00
|
|
|
|
|
|
|
|
|
|
// Corners from the min-area rectangle bounding the target
|
2023-12-24 19:56:08 -05:00
|
|
|
|
private final List<TargetCorner> minAreaRectCorners;
|
2023-01-06 19:20:27 -08:00
|
|
|
|
|
|
|
|
|
|
// Corners from whatever corner detection method was used
|
2023-12-24 19:56:08 -05:00
|
|
|
|
private final List<TargetCorner> detectedCorners;
|
Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
|
2022-01-10 20:31:36 -08:00
|
|
|
|
/** Construct a tracked target, given exactly 4 corners */
|
|
|
|
|
|
public PhotonTrackedTarget(
|
|
|
|
|
|
double yaw,
|
|
|
|
|
|
double pitch,
|
|
|
|
|
|
double area,
|
|
|
|
|
|
double skew,
|
2022-09-28 18:21:41 -07:00
|
|
|
|
int id,
|
|
|
|
|
|
Transform3d pose,
|
2022-10-22 07:42:45 -04:00
|
|
|
|
Transform3d altPose,
|
2022-10-08 09:27:00 -04:00
|
|
|
|
double ambiguity,
|
2023-01-06 19:20:27 -08:00
|
|
|
|
List<TargetCorner> minAreaRectCorners,
|
|
|
|
|
|
List<TargetCorner> detectedCorners) {
|
|
|
|
|
|
assert minAreaRectCorners.size() == 4;
|
|
|
|
|
|
|
|
|
|
|
|
if (detectedCorners.size() > MAX_CORNERS) {
|
|
|
|
|
|
detectedCorners = detectedCorners.subList(0, MAX_CORNERS);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
this.yaw = yaw;
|
|
|
|
|
|
this.pitch = pitch;
|
|
|
|
|
|
this.area = area;
|
2020-07-16 17:50:40 -07:00
|
|
|
|
this.skew = skew;
|
2022-09-28 18:21:41 -07:00
|
|
|
|
this.fiducialId = id;
|
2022-10-22 07:42:45 -04:00
|
|
|
|
this.bestCameraToTarget = pose;
|
|
|
|
|
|
this.altCameraToTarget = altPose;
|
2023-01-06 19:20:27 -08:00
|
|
|
|
this.minAreaRectCorners = minAreaRectCorners;
|
|
|
|
|
|
this.detectedCorners = detectedCorners;
|
2022-10-08 09:27:00 -04:00
|
|
|
|
this.poseAmbiguity = ambiguity;
|
Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public double getYaw() {
|
|
|
|
|
|
return yaw;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public double getPitch() {
|
|
|
|
|
|
return pitch;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public double getArea() {
|
|
|
|
|
|
return area;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-03-23 12:47:26 -04:00
|
|
|
|
public double getSkew() {
|
|
|
|
|
|
return skew;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-28 18:21:41 -07:00
|
|
|
|
/** Get the Fiducial ID, or -1 if not set. */
|
|
|
|
|
|
public int getFiducialId() {
|
|
|
|
|
|
return fiducialId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-08 09:27:00 -04:00
|
|
|
|
/**
|
2023-11-25 14:06:22 -05:00
|
|
|
|
* Get the ratio of best:alternate pose reprojection errors, called ambiguity. This is betweeen 0
|
|
|
|
|
|
* and 1 (0 being no ambiguity, and 1 meaning both have the same reprojection error). Numbers
|
|
|
|
|
|
* above 0.2 are likely to be ambiguous. -1 if invalid.
|
2022-10-08 09:27:00 -04:00
|
|
|
|
*/
|
|
|
|
|
|
public double getPoseAmbiguity() {
|
|
|
|
|
|
return poseAmbiguity;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-01-10 20:31:36 -08:00
|
|
|
|
/**
|
2023-01-06 19:20:27 -08:00
|
|
|
|
* Return a list of the 4 corners in image space (origin top left, x right, y down), in no
|
2022-01-10 20:31:36 -08:00
|
|
|
|
* particular order, of the minimum area bounding rectangle of this target
|
|
|
|
|
|
*/
|
2023-01-06 19:20:27 -08:00
|
|
|
|
public List<TargetCorner> getMinAreaRectCorners() {
|
|
|
|
|
|
return minAreaRectCorners;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Return a list of the n corners in image space (origin top left, x right, y down), in no
|
|
|
|
|
|
* particular order, detected for this target.
|
|
|
|
|
|
*
|
2023-06-18 15:54:12 -07:00
|
|
|
|
* <p>For fiducials, the order is known and is always counter-clock wise around the tag, like so:
|
2023-01-06 19:20:27 -08:00
|
|
|
|
*
|
2023-06-18 15:54:12 -07:00
|
|
|
|
* <pre>
|
|
|
|
|
|
* ⟶ +X 3 ----- 2
|
2023-01-06 19:20:27 -08:00
|
|
|
|
* | | |
|
|
|
|
|
|
* V | |
|
|
|
|
|
|
* +Y 0 ----- 1
|
2023-06-18 15:54:12 -07:00
|
|
|
|
* </pre>
|
2023-01-06 19:20:27 -08:00
|
|
|
|
*/
|
|
|
|
|
|
public List<TargetCorner> getDetectedCorners() {
|
|
|
|
|
|
return detectedCorners;
|
2022-01-10 20:31:36 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-28 18:21:41 -07:00
|
|
|
|
/**
|
|
|
|
|
|
* Get the transform that maps camera space (X = forward, Y = left, Z = up) to object/fiducial tag
|
2022-10-22 07:42:45 -04:00
|
|
|
|
* space (X forward, Y left, Z up) with the lowest reprojection error
|
2022-09-28 18:21:41 -07:00
|
|
|
|
*/
|
2022-10-22 07:42:45 -04:00
|
|
|
|
public Transform3d getBestCameraToTarget() {
|
|
|
|
|
|
return bestCameraToTarget;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Get the transform that maps camera space (X = forward, Y = left, Z = up) to object/fiducial tag
|
|
|
|
|
|
* space (X forward, Y left, Z up) with the highest reprojection error
|
|
|
|
|
|
*/
|
|
|
|
|
|
public Transform3d getAlternateCameraToTarget() {
|
|
|
|
|
|
return altCameraToTarget;
|
Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2023-01-06 19:20:27 -08:00
|
|
|
|
public int hashCode() {
|
|
|
|
|
|
final int prime = 31;
|
|
|
|
|
|
int result = 1;
|
|
|
|
|
|
long temp;
|
|
|
|
|
|
temp = Double.doubleToLongBits(yaw);
|
|
|
|
|
|
result = prime * result + (int) (temp ^ (temp >>> 32));
|
|
|
|
|
|
temp = Double.doubleToLongBits(pitch);
|
|
|
|
|
|
result = prime * result + (int) (temp ^ (temp >>> 32));
|
|
|
|
|
|
temp = Double.doubleToLongBits(area);
|
|
|
|
|
|
result = prime * result + (int) (temp ^ (temp >>> 32));
|
|
|
|
|
|
temp = Double.doubleToLongBits(skew);
|
|
|
|
|
|
result = prime * result + (int) (temp ^ (temp >>> 32));
|
|
|
|
|
|
result = prime * result + fiducialId;
|
|
|
|
|
|
result = prime * result + ((bestCameraToTarget == null) ? 0 : bestCameraToTarget.hashCode());
|
|
|
|
|
|
result = prime * result + ((altCameraToTarget == null) ? 0 : altCameraToTarget.hashCode());
|
|
|
|
|
|
temp = Double.doubleToLongBits(poseAmbiguity);
|
|
|
|
|
|
result = prime * result + (int) (temp ^ (temp >>> 32));
|
|
|
|
|
|
result = prime * result + ((minAreaRectCorners == null) ? 0 : minAreaRectCorners.hashCode());
|
|
|
|
|
|
result = prime * result + ((detectedCorners == null) ? 0 : detectedCorners.hashCode());
|
|
|
|
|
|
return result;
|
Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2023-01-06 19:20:27 -08:00
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
|
|
if (this == obj) return true;
|
|
|
|
|
|
if (obj == null) return false;
|
|
|
|
|
|
if (getClass() != obj.getClass()) return false;
|
|
|
|
|
|
PhotonTrackedTarget other = (PhotonTrackedTarget) obj;
|
|
|
|
|
|
if (Double.doubleToLongBits(yaw) != Double.doubleToLongBits(other.yaw)) return false;
|
|
|
|
|
|
if (Double.doubleToLongBits(pitch) != Double.doubleToLongBits(other.pitch)) return false;
|
|
|
|
|
|
if (Double.doubleToLongBits(area) != Double.doubleToLongBits(other.area)) return false;
|
|
|
|
|
|
if (Double.doubleToLongBits(skew) != Double.doubleToLongBits(other.skew)) return false;
|
|
|
|
|
|
if (fiducialId != other.fiducialId) return false;
|
|
|
|
|
|
if (bestCameraToTarget == null) {
|
|
|
|
|
|
if (other.bestCameraToTarget != null) return false;
|
|
|
|
|
|
} else if (!bestCameraToTarget.equals(other.bestCameraToTarget)) return false;
|
|
|
|
|
|
if (altCameraToTarget == null) {
|
|
|
|
|
|
if (other.altCameraToTarget != null) return false;
|
|
|
|
|
|
} else if (!altCameraToTarget.equals(other.altCameraToTarget)) return false;
|
|
|
|
|
|
if (Double.doubleToLongBits(poseAmbiguity) != Double.doubleToLongBits(other.poseAmbiguity))
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (minAreaRectCorners == null) {
|
|
|
|
|
|
if (other.minAreaRectCorners != null) return false;
|
|
|
|
|
|
} else if (!minAreaRectCorners.equals(other.minAreaRectCorners)) return false;
|
|
|
|
|
|
if (detectedCorners == null) {
|
|
|
|
|
|
if (other.detectedCorners != null) return false;
|
|
|
|
|
|
} else if (!detectedCorners.equals(other.detectedCorners)) return false;
|
|
|
|
|
|
return true;
|
2022-10-22 07:42:45 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-28 18:21:41 -07:00
|
|
|
|
@Override
|
|
|
|
|
|
public String toString() {
|
|
|
|
|
|
return "PhotonTrackedTarget{"
|
|
|
|
|
|
+ "yaw="
|
|
|
|
|
|
+ yaw
|
|
|
|
|
|
+ ", pitch="
|
|
|
|
|
|
+ pitch
|
|
|
|
|
|
+ ", area="
|
|
|
|
|
|
+ area
|
|
|
|
|
|
+ ", skew="
|
|
|
|
|
|
+ skew
|
|
|
|
|
|
+ ", fiducialId="
|
|
|
|
|
|
+ fiducialId
|
|
|
|
|
|
+ ", cameraToTarget="
|
2022-10-22 07:42:45 -04:00
|
|
|
|
+ bestCameraToTarget
|
2022-09-28 18:21:41 -07:00
|
|
|
|
+ ", targetCorners="
|
2023-01-06 19:20:27 -08:00
|
|
|
|
+ minAreaRectCorners
|
2022-09-28 18:21:41 -07:00
|
|
|
|
+ '}';
|
|
|
|
|
|
}
|
2023-12-24 19:56:08 -05:00
|
|
|
|
|
|
|
|
|
|
public static final class APacketSerde implements PacketSerde<PhotonTrackedTarget> {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public int getMaxByteSize() {
|
|
|
|
|
|
return Double.BYTES * (5 + 7 + 2 * 4 + 1 + 7 + 2 * MAX_CORNERS);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void pack(Packet packet, PhotonTrackedTarget value) {
|
|
|
|
|
|
packet.encode(value.yaw);
|
|
|
|
|
|
packet.encode(value.pitch);
|
|
|
|
|
|
packet.encode(value.area);
|
|
|
|
|
|
packet.encode(value.skew);
|
|
|
|
|
|
packet.encode(value.fiducialId);
|
2023-12-27 10:38:41 -05:00
|
|
|
|
PacketUtils.packTransform3d(packet, value.bestCameraToTarget);
|
|
|
|
|
|
PacketUtils.packTransform3d(packet, value.altCameraToTarget);
|
|
|
|
|
|
packet.encode(value.poseAmbiguity);
|
2023-12-24 19:56:08 -05:00
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
|
TargetCorner.serde.pack(packet, value.minAreaRectCorners.get(i));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
packet.encode((byte) Math.min(value.detectedCorners.size(), Byte.MAX_VALUE));
|
|
|
|
|
|
for (TargetCorner targetCorner : value.detectedCorners) {
|
|
|
|
|
|
TargetCorner.serde.pack(packet, targetCorner);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public PhotonTrackedTarget unpack(Packet packet) {
|
|
|
|
|
|
var yaw = packet.decodeDouble();
|
|
|
|
|
|
var pitch = packet.decodeDouble();
|
|
|
|
|
|
var area = packet.decodeDouble();
|
|
|
|
|
|
var skew = packet.decodeDouble();
|
|
|
|
|
|
var fiducialId = packet.decodeInt();
|
2023-12-27 10:38:41 -05:00
|
|
|
|
Transform3d best = PacketUtils.unpackTransform3d(packet);
|
|
|
|
|
|
Transform3d alt = PacketUtils.unpackTransform3d(packet);
|
|
|
|
|
|
double ambiguity = packet.decodeDouble();
|
2023-12-24 19:56:08 -05:00
|
|
|
|
|
|
|
|
|
|
var minAreaRectCorners = new ArrayList<TargetCorner>(4);
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
|
minAreaRectCorners.add(TargetCorner.serde.unpack(packet));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var len = packet.decodeByte();
|
|
|
|
|
|
var detectedCorners = new ArrayList<TargetCorner>(len);
|
|
|
|
|
|
for (int i = 0; i < len; i++) {
|
|
|
|
|
|
detectedCorners.add(TargetCorner.serde.unpack(packet));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new PhotonTrackedTarget(
|
|
|
|
|
|
yaw,
|
|
|
|
|
|
pitch,
|
|
|
|
|
|
area,
|
|
|
|
|
|
skew,
|
|
|
|
|
|
fiducialId,
|
|
|
|
|
|
best,
|
|
|
|
|
|
alt,
|
|
|
|
|
|
ambiguity,
|
|
|
|
|
|
minAreaRectCorners,
|
|
|
|
|
|
detectedCorners);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static final APacketSerde serde = new APacketSerde();
|
Bootup sprint (#18)
* Did some stuff
* Fix gradle, start implementing mjpeg frame consumer
* Did some stuff
* bade changes
* rename camera config to USBCameraConfiguration, add name
* unrename cameraconfiguration
* Add pub/sub framework
* Add setResolution to mjpeg frame consumer
* add NTDataConsumer
* Add some totally broken hsv hacks
* Start refactoring UI data
* Update index.js
* Commit and push, he says
* Fix up some errors
* Fix input tab
* Fix fps
* Update index.js
* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables
* Change v-model to point to data()
* update hsv to use mutations
* Work on saving, fix hsv
* Rename shouldErode/shouldDilate to erode and dilate
* Hook all the tabs up to the Store
* Change handleData to handlePipelineData
* camera quirk redo, add ICCSub to SocketHandler
* Fix some property names
* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums
* change pipeline type to an int in store
* Fix mutation naming
* Attempt threshold fix
* Update SocketHandler.java
* Add truthy data sending
* Start adding logging support
* [UI] Add delay to slider input boxes (#1)
* [UI] [Backend] potentially fix camera settings, various logging tweaks
* Don't release raw input mat
* add setVideoModeIndex to vision settables
* Implement pipeline index in socket handler, add framework for renaming/changing pipes
* (ish) get pipeline change working
* Create index.html
* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)
* Refactor UI to use mutatePipeline, send pipeline results
* Update NetworkConfig.java
* Change double to number
* Run spotless
* Fix reversal of large/small comparators
* Fix left/right
* Fix pitch/yaw calculation bug, fix area bug
* Use Vue.set instead of assignment
This fixes {{ }}
* Update App.vue
* run spotless
* Actually add pipelines and reassign indecies
* Delete old pipeline configs
Fixes duplication on renaming pipeline
* Start working on deleting pipes
* Fix camera nickname change
* run spotless
* Fix some test stuff
* Update VisionModuleManagerTest.java
* vision source manager test is still broken
* Fix VisionSourceManager test
* Apply spotless 2 electric boogaloo
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
2020-07-07 01:01:58 -07:00
|
|
|
|
}
|