34#include <wpi/apriltag/AprilTagFieldLayout.hpp>
35#include <wpi/apriltag/AprilTagFields.hpp>
36#include <wpi/cameraserver/CameraServer.hpp>
37#include <wpi/system/Timer.hpp>
38#include <wpi/units/math.hpp>
39#include <wpi/util/timestamp.h>
72 const wpi::apriltag::AprilTagFieldLayout& tagLayout =
73 wpi::apriltag::AprilTagFieldLayout::LoadField(
74 wpi::apriltag::AprilTagField::kDefaultField));
91 double minTargetAreaPercent,
92 wpi::units::meter_t maxSightRange);
168 minTargetAreaPercent = areaPercent;
188 maxSightRange = range;
209 videoSimWireframeEnabled = enabled;
221 videoSimWireframeResolution = resolution;
230 videoSimProcEnabled = enabled;
233 const wpi::math::Pose3d& cameraPose,
234 std::vector<VisionTargetSim> targets);
238 uint64_t ReceiveTimestamp);
246 int64_t heartbeatCounter{0};
248 int64_t nextNTEntryTime{wpi::nt::Now()};
250 wpi::units::meter_t maxSightRange{std::numeric_limits<double>::max()};
251 static constexpr double kDefaultMinAreaPx{100};
252 double minTargetAreaPercent;
254 wpi::apriltag::AprilTagFieldLayout tagLayout;
256 wpi::cs::CvSource videoSimRaw;
257 cv::Mat videoSimFrameRaw{};
258 bool videoSimRawEnabled{
true};
259 bool videoSimWireframeEnabled{
false};
260 double videoSimWireframeResolution{0.1};
261 wpi::cs::CvSource videoSimProcessed;
262 cv::Mat videoSimFrameProcessed{};
263 bool videoSimProcEnabled{
true};
Definition NTTopicSet.h:37
Represents a camera that is connected to PhotonVision.
Definition PhotonCamera.h:56
Definition PhotonCameraSim.h:42
std::optional< uint64_t > ConsumeNextEntryTime()
Determine if this camera should process a new frame based on performance metrics and the time since t...
SimCameraProperties prop
Definition PhotonCameraSim.h:240
void SetWireframeResolution(double resolution)
Sets the resolution of the drawn wireframe if enabled.
Definition PhotonCameraSim.h:220
const cv::Mat & GetVideoSimFrameRaw()
Definition PhotonCameraSim.h:127
PhotonCamera * GetCamera()
Returns the camera being simulated.
Definition PhotonCameraSim.h:99
PhotonCameraSim(PhotonCamera *camera, const SimCameraProperties &props, const wpi::apriltag::AprilTagFieldLayout &tagLayout=wpi::apriltag::AprilTagFieldLayout::LoadField(wpi::apriltag::AprilTagField::kDefaultField))
Constructs a handle for simulating PhotonCamera values.
void EnableDrawWireframe(bool enabled)
Sets whether a wireframe of the field is drawn to the raw video stream.
Definition PhotonCameraSim.h:208
double GetMinTargetAreaPixels()
Returns the minimum number of pixels a detected target must take up in the camera's image to be proce...
Definition PhotonCameraSim.h:115
void EnabledProcessedStream(double enabled)
Sets whether the processed video stream simulation is enabled.
Definition PhotonCameraSim.h:229
wpi::units::meter_t GetMaxSightRange()
Returns the maximum distance at which the target is illuminated to your camera.
Definition PhotonCameraSim.h:125
bool CanSeeTargetPose(const wpi::math::Pose3d &camPose, const VisionTargetSim &target)
Determines if this target's pose should be visible to the camera without considering its projected im...
void SubmitProcessedFrame(const PhotonPipelineResult &result)
bool CanSeeCorner(const std::vector< cv::Point2f > &points)
Determines if all target points are inside the camera's image.
void SetMinTargetAreaPixels(double areaPx)
Sets the minimum number of pixels a detected target must take up in the camera's image to be processe...
Definition PhotonCameraSim.h:177
PhotonCameraSim(PhotonCamera *camera, const SimCameraProperties &props, double minTargetAreaPercent, wpi::units::meter_t maxSightRange)
Constructs a handle for simulating PhotonCamera values.
void SubmitProcessedFrame(const PhotonPipelineResult &result, uint64_t ReceiveTimestamp)
void EnableRawStream(bool enabled)
Sets whether the raw video stream simulation is enabled.
Definition PhotonCameraSim.h:198
void SetMaxSightRange(wpi::units::meter_t range)
Sets the maximum distance at which the target is illuminated to your camera.
Definition PhotonCameraSim.h:187
double GetMinTargetAreaPercent()
Returns the minimum percentage (0 - 100) a detected target must take up of the camera's image to be p...
Definition PhotonCameraSim.h:107
PhotonPipelineResult Process(wpi::units::second_t latency, const wpi::math::Pose3d &cameraPose, std::vector< VisionTargetSim > targets)
const wpi::cs::CvSource & GetVideoSimRaw()
Definition PhotonCameraSim.h:126
PhotonCameraSim(PhotonCamera *camera)
Constructs a handle for simulating PhotonCamera values.
void SetMinTargetAreaPercent(double areaPercent)
Sets the minimum percentage (0 - 100) a detected target must take up of the camera's image to be proc...
Definition PhotonCameraSim.h:167
Represents a pipeline result from a PhotonCamera.
Definition PhotonPipelineResult.h:34
Calibration and performance values for this camera.
Definition SimCameraProperties.h:56
int GetResArea() const
Gets the area of the simulated camera image.
Definition SimCameraProperties.h:143
Describes a vision target located somewhere on the field that your vision system can detect.
Definition VisionTargetSim.h:36
Definition VisionEstimation.h:30