mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Fix PhotonCamera typestring checks (#1480)
Previously NT would quietly drop readQueue changes.
This commit is contained in:
@@ -18,15 +18,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <frc/geometry/Transform3d.h>
|
||||
#include <networktables/BooleanTopic.h>
|
||||
#include <networktables/DoubleArrayTopic.h>
|
||||
#include <networktables/DoubleTopic.h>
|
||||
#include <networktables/IntegerTopic.h>
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <networktables/RawTopic.h>
|
||||
#include <networktables/StructTopic.h>
|
||||
|
||||
namespace photon {
|
||||
const std::string PhotonPipelineResult_TYPE_STRING =
|
||||
std::string{"photonstruct:PhotonPipelineResult:"} +
|
||||
std::string{SerdeType<PhotonPipelineResult>::GetSchemaHash()};
|
||||
|
||||
class NTTopicSet {
|
||||
public:
|
||||
std::shared_ptr<nt::NetworkTable> subTable;
|
||||
@@ -44,7 +51,7 @@ class NTTopicSet {
|
||||
nt::DoublePublisher targetPitchEntry;
|
||||
nt::DoublePublisher targetYawEntry;
|
||||
nt::DoublePublisher targetAreaEntry;
|
||||
nt::DoubleArrayPublisher targetPoseEntry;
|
||||
nt::StructPublisher<frc::Transform3d> targetPoseEntry;
|
||||
nt::DoublePublisher targetSkewEntry;
|
||||
|
||||
nt::DoublePublisher bestTargetPosX;
|
||||
@@ -60,8 +67,8 @@ class NTTopicSet {
|
||||
nt::PubSubOptions options;
|
||||
options.periodic = 0.01;
|
||||
options.sendAll = true;
|
||||
rawBytesEntry =
|
||||
subTable->GetRawTopic("rawBytes").Publish("rawBytes", options);
|
||||
rawBytesEntry = subTable->GetRawTopic("rawBytes")
|
||||
.Publish(PhotonPipelineResult_TYPE_STRING, options);
|
||||
|
||||
pipelineIndexPublisher =
|
||||
subTable->GetIntegerTopic("pipelineIndexState").Publish();
|
||||
@@ -80,7 +87,8 @@ class NTTopicSet {
|
||||
targetPitchEntry = subTable->GetDoubleTopic("targetPitch").Publish();
|
||||
targetAreaEntry = subTable->GetDoubleTopic("targetArea").Publish();
|
||||
targetYawEntry = subTable->GetDoubleTopic("targetYaw").Publish();
|
||||
targetPoseEntry = subTable->GetDoubleArrayTopic("targetPose").Publish();
|
||||
targetPoseEntry =
|
||||
subTable->GetStructTopic<frc::Transform3d>("targetPose").Publish();
|
||||
targetSkewEntry = subTable->GetDoubleTopic("targetSkew").Publish();
|
||||
|
||||
bestTargetPosX = subTable->GetDoubleTopic("targetPixelsX").Publish();
|
||||
|
||||
Reference in New Issue
Block a user