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
|
|
|
|
2024-01-13 22:35:57 -05:00
|
|
|
import edu.wpi.first.util.protobuf.ProtobufSerializable;
|
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
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
2024-08-31 13:44:19 -04:00
|
|
|
import java.util.Optional;
|
2023-12-24 19:56:08 -05:00
|
|
|
import org.photonvision.common.dataflow.structures.PacketSerde;
|
2024-08-31 13:44:19 -04:00
|
|
|
import org.photonvision.struct.PhotonPipelineResultSerde;
|
2023-12-31 00:14:21 -05:00
|
|
|
import org.photonvision.targeting.proto.PhotonPipelineResultProto;
|
2024-08-31 13:44:19 -04:00
|
|
|
import org.photonvision.targeting.serde.PhotonStructSerializable;
|
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
|
|
|
/** Represents a pipeline result from a PhotonCamera. */
|
2024-08-31 13:44:19 -04:00
|
|
|
public class PhotonPipelineResult
|
|
|
|
|
implements ProtobufSerializable, PhotonStructSerializable<PhotonPipelineResult> {
|
2021-01-16 20:41:47 -08:00
|
|
|
private static boolean HAS_WARNED = false;
|
|
|
|
|
|
2024-08-31 13:44:19 -04:00
|
|
|
// Frame capture metadata
|
|
|
|
|
public PhotonPipelineMetadata metadata;
|
2021-01-16 20:41:47 -08:00
|
|
|
|
2024-05-10 14:04:34 -04:00
|
|
|
// Targets to store.
|
2024-08-31 13:44:19 -04:00
|
|
|
public List<PhotonTrackedTarget> targets = new ArrayList<>();
|
2022-11-07 11:09:55 -07:00
|
|
|
|
2023-10-17 10:20:00 -04:00
|
|
|
// Multi-tag result
|
2024-08-31 13:44:19 -04:00
|
|
|
public Optional<MultiTargetPNPResult> multitagResult;
|
2023-10-17 10:20:00 -04:00
|
|
|
|
2024-08-31 13:44:19 -04:00
|
|
|
// HACK: Since we don't trust NT time sync, keep track of when we got this packet into robot code
|
|
|
|
|
public long ntReceiveTimestampMicros = -1;
|
2024-05-10 14:04:34 -04:00
|
|
|
|
2021-01-16 20:41:47 -08:00
|
|
|
/** Constructs an empty pipeline result. */
|
2024-08-31 13:44:19 -04:00
|
|
|
public PhotonPipelineResult() {
|
|
|
|
|
this(new PhotonPipelineMetadata(), List.of(), Optional.empty());
|
|
|
|
|
}
|
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
|
|
|
/**
|
2022-01-10 11:56:45 -08:00
|
|
|
* Constructs a pipeline result.
|
|
|
|
|
*
|
2024-05-10 14:04:34 -04:00
|
|
|
* @param sequenceID The number of frames processed by this camera since boot
|
|
|
|
|
* @param captureTimestamp The time, in uS in the coprocessor's timebase, that the coprocessor
|
|
|
|
|
* captured the image this result contains the targeting info of
|
|
|
|
|
* @param publishTimestamp The time, in uS in the coprocessor's timebase, that the coprocessor
|
|
|
|
|
* published targeting info
|
2022-01-10 11:56:45 -08:00
|
|
|
* @param targets The list of targets identified by the pipeline.
|
|
|
|
|
*/
|
2024-05-10 14:04:34 -04:00
|
|
|
public PhotonPipelineResult(
|
|
|
|
|
long sequenceID,
|
|
|
|
|
long captureTimestamp,
|
|
|
|
|
long publishTimestamp,
|
|
|
|
|
List<PhotonTrackedTarget> targets) {
|
2024-08-31 13:44:19 -04:00
|
|
|
this(
|
|
|
|
|
new PhotonPipelineMetadata(captureTimestamp, publishTimestamp, sequenceID),
|
|
|
|
|
targets,
|
|
|
|
|
Optional.empty());
|
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-10-17 10:20:00 -04:00
|
|
|
/**
|
|
|
|
|
* Constructs a pipeline result.
|
|
|
|
|
*
|
2024-05-10 14:04:34 -04:00
|
|
|
* @param sequenceID The number of frames processed by this camera since boot
|
|
|
|
|
* @param captureTimestamp The time, in uS in the coprocessor's timebase, that the coprocessor
|
|
|
|
|
* captured the image this result contains the targeting info of
|
|
|
|
|
* @param publishTimestamp The time, in uS in the coprocessor's timebase, that the coprocessor
|
|
|
|
|
* published targeting info
|
2023-10-17 10:20:00 -04:00
|
|
|
* @param targets The list of targets identified by the pipeline.
|
|
|
|
|
* @param result Result from multi-target PNP.
|
|
|
|
|
*/
|
|
|
|
|
public PhotonPipelineResult(
|
2024-05-10 14:04:34 -04:00
|
|
|
long sequenceID,
|
|
|
|
|
long captureTimestamp,
|
|
|
|
|
long publishTimestamp,
|
|
|
|
|
List<PhotonTrackedTarget> targets,
|
2024-08-31 13:44:19 -04:00
|
|
|
Optional<MultiTargetPNPResult> result) {
|
|
|
|
|
this(
|
|
|
|
|
new PhotonPipelineMetadata(captureTimestamp, publishTimestamp, sequenceID),
|
|
|
|
|
targets,
|
|
|
|
|
result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PhotonPipelineResult(
|
|
|
|
|
PhotonPipelineMetadata metadata,
|
|
|
|
|
List<PhotonTrackedTarget> targets,
|
|
|
|
|
Optional<MultiTargetPNPResult> result) {
|
|
|
|
|
this.metadata = metadata;
|
2023-10-17 10:20:00 -04:00
|
|
|
this.targets.addAll(targets);
|
2024-08-31 13:44:19 -04:00
|
|
|
this.multitagResult = result;
|
2023-10-17 10:20:00 -04:00
|
|
|
}
|
|
|
|
|
|
2020-07-19 22:42:45 -04:00
|
|
|
/**
|
2022-01-10 11:56:45 -08:00
|
|
|
* Returns the size of the packet needed to store this pipeline result.
|
|
|
|
|
*
|
|
|
|
|
* @return The size of the packet needed to store this pipeline result.
|
|
|
|
|
*/
|
2020-07-19 22:42:45 -04:00
|
|
|
public int getPacketSize() {
|
2024-08-31 13:44:19 -04:00
|
|
|
throw new RuntimeException("TODO");
|
|
|
|
|
// return Double.BYTES // latency
|
|
|
|
|
// + 1 // target count
|
|
|
|
|
// + targets.size() * PhotonTrackedTarget.serde.getMaxByteSize()
|
|
|
|
|
// + MultiTargetPNPResult.serde.getMaxByteSize();
|
2021-01-16 20:41:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2022-01-10 11:56:45 -08:00
|
|
|
* Returns the best target in this pipeline result. If there are no targets, this method will
|
|
|
|
|
* return null. The best target is determined by the target sort mode in the PhotonVision UI.
|
|
|
|
|
*
|
|
|
|
|
* @return The best target of the pipeline result.
|
|
|
|
|
*/
|
2021-01-16 20:41:47 -08:00
|
|
|
public PhotonTrackedTarget getBestTarget() {
|
2021-09-03 19:19:38 -07:00
|
|
|
if (!hasTargets() && !HAS_WARNED) {
|
2021-01-16 20:41:47 -08:00
|
|
|
String errStr =
|
|
|
|
|
"This PhotonPipelineResult object has no targets associated with it! Please check hasTargets() "
|
|
|
|
|
+ "before calling this method. For more information, please review the PhotonLib "
|
2023-12-16 13:14:52 -05:00
|
|
|
+ "documentation at https://docs.photonvision.org";
|
2021-01-16 20:41:47 -08:00
|
|
|
System.err.println(errStr);
|
|
|
|
|
new Exception().printStackTrace();
|
|
|
|
|
HAS_WARNED = true;
|
|
|
|
|
}
|
2021-09-03 19:19:38 -07:00
|
|
|
return hasTargets() ? targets.get(0) : null;
|
2020-07-19 22:42:45 -04:00
|
|
|
}
|
|
|
|
|
|
2021-01-16 20:41:47 -08:00
|
|
|
/**
|
2022-01-10 11:56:45 -08:00
|
|
|
* Returns whether the pipeline has targets.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the pipeline has targets.
|
|
|
|
|
*/
|
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 boolean hasTargets() {
|
2023-11-15 18:28:26 -05:00
|
|
|
return !targets.isEmpty();
|
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
|
|
|
/**
|
2022-01-10 11:56:45 -08:00
|
|
|
* Returns a copy of the vector of targets.
|
|
|
|
|
*
|
2024-08-29 13:20:03 +08:00
|
|
|
* <p>Returned in the order set by target sort mode.
|
|
|
|
|
*
|
2022-01-10 11:56:45 -08:00
|
|
|
* @return A copy of the vector of targets.
|
|
|
|
|
*/
|
2021-01-16 20:41:47 -08:00
|
|
|
public List<PhotonTrackedTarget> getTargets() {
|
|
|
|
|
return new ArrayList<>(targets);
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-17 10:20:00 -04:00
|
|
|
/**
|
2023-11-15 18:28:26 -05:00
|
|
|
* Return the latest multi-target result. Be sure to check
|
2023-10-17 10:20:00 -04:00
|
|
|
* getMultiTagResult().estimatedPose.isPresent before using the pose estimate!
|
|
|
|
|
*/
|
2024-08-31 13:44:19 -04:00
|
|
|
public Optional<MultiTargetPNPResult> getMultiTagResult() {
|
|
|
|
|
return multitagResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the estimated time the frame was taken, in the Received system's time base. This is
|
|
|
|
|
* calculated as (NT Receive time (robot base) - (publish timestamp, coproc timebase - capture
|
|
|
|
|
* timestamp, coproc timebase))
|
|
|
|
|
*
|
|
|
|
|
* @return The timestamp in seconds
|
|
|
|
|
*/
|
|
|
|
|
public double getTimestampSeconds() {
|
|
|
|
|
return (ntReceiveTimestampMicros
|
|
|
|
|
- (metadata.publishTimestampMicros - metadata.captureTimestampMicros))
|
|
|
|
|
/ 1e6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** The time that the robot Received this result, in the FPGA timebase. */
|
|
|
|
|
public long getNtReceiveTimestampMicros() {
|
|
|
|
|
return ntReceiveTimestampMicros;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Sets the FPGA timestamp this result was Received by robot code */
|
|
|
|
|
public void setReceiveTimestampMicros(long timestampMicros) {
|
|
|
|
|
this.ntReceiveTimestampMicros = timestampMicros;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String toString() {
|
|
|
|
|
return "PhotonPipelineResult [metadata="
|
|
|
|
|
+ metadata
|
|
|
|
|
+ ", targets="
|
|
|
|
|
+ targets
|
|
|
|
|
+ ", multitagResult="
|
|
|
|
|
+ multitagResult
|
|
|
|
|
+ ", ntReceiveTimestampMicros="
|
|
|
|
|
+ ntReceiveTimestampMicros
|
|
|
|
|
+ "]";
|
2023-10-17 10:20:00 -04:00
|
|
|
}
|
|
|
|
|
|
2023-02-13 17:57:01 -05:00
|
|
|
@Override
|
|
|
|
|
public int hashCode() {
|
|
|
|
|
final int prime = 31;
|
|
|
|
|
int result = 1;
|
2024-08-31 13:44:19 -04:00
|
|
|
result = prime * result + ((metadata == null) ? 0 : metadata.hashCode());
|
2024-05-10 14:04:34 -04:00
|
|
|
result = prime * result + ((targets == null) ? 0 : targets.hashCode());
|
2024-08-31 13:44:19 -04:00
|
|
|
result = prime * result + ((multitagResult == null) ? 0 : multitagResult.hashCode());
|
|
|
|
|
result = prime * result + (int) (ntReceiveTimestampMicros ^ (ntReceiveTimestampMicros >>> 32));
|
2023-02-13 17:57:01 -05:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
|
if (this == obj) return true;
|
|
|
|
|
if (obj == null) return false;
|
|
|
|
|
if (getClass() != obj.getClass()) return false;
|
|
|
|
|
PhotonPipelineResult other = (PhotonPipelineResult) obj;
|
2024-08-31 13:44:19 -04:00
|
|
|
if (metadata == null) {
|
|
|
|
|
if (other.metadata != null) return false;
|
|
|
|
|
} else if (!metadata.equals(other.metadata)) return false;
|
2024-05-10 14:04:34 -04:00
|
|
|
if (targets == null) {
|
|
|
|
|
if (other.targets != null) return false;
|
|
|
|
|
} else if (!targets.equals(other.targets)) return false;
|
2024-08-31 13:44:19 -04:00
|
|
|
if (multitagResult == null) {
|
|
|
|
|
if (other.multitagResult != null) return false;
|
|
|
|
|
} else if (!multitagResult.equals(other.multitagResult)) return false;
|
|
|
|
|
if (ntReceiveTimestampMicros != other.ntReceiveTimestampMicros) return false;
|
2023-02-13 17:57:01 -05:00
|
|
|
return true;
|
|
|
|
|
}
|
2023-10-17 10:20:00 -04:00
|
|
|
|
2024-08-31 13:44:19 -04:00
|
|
|
public static final PhotonPipelineResultSerde photonStruct = new PhotonPipelineResultSerde();
|
|
|
|
|
public static final PhotonPipelineResultProto proto = new PhotonPipelineResultProto();
|
2023-12-24 19:56:08 -05:00
|
|
|
|
2024-08-31 13:44:19 -04:00
|
|
|
@Override
|
|
|
|
|
public PacketSerde<PhotonPipelineResult> getSerde() {
|
|
|
|
|
return photonStruct;
|
2023-12-24 19:56:08 -05:00
|
|
|
}
|
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
|
|
|
}
|