33#include <cameraserver/CameraServer.h>
35#include <frc/apriltag/AprilTagFieldLayout.h>
36#include <frc/apriltag/AprilTagFields.h>
45#include <units/math.h>
46#include <wpi/timestamp.h>
79 const frc::AprilTagFieldLayout& tagLayout =
80 frc::AprilTagFieldLayout::LoadField(
81 frc::AprilTagField::kDefaultField));
98 double minTargetAreaPercent, units::meter_t maxSightRange);
174 minTargetAreaPercent = areaPercent;
213 videoSimWireframeEnabled = enabled;
225 videoSimWireframeResolution = resolution;
234 videoSimProcEnabled = enabled;
237 const frc::Pose3d& cameraPose,
238 std::vector<VisionTargetSim> targets);
242 uint64_t ReceiveTimestamp);
250 int64_t heartbeatCounter{0};
252 uint64_t nextNTEntryTime{wpi::Now()};
254 units::meter_t maxSightRange{std::numeric_limits<double>::max()};
255 static constexpr double kDefaultMinAreaPx{100};
256 double minTargetAreaPercent;
258 frc::AprilTagFieldLayout tagLayout;
260 cs::CvSource videoSimRaw;
261 cv::Mat videoSimFrameRaw{};
262 bool videoSimRawEnabled{
true};
263 bool videoSimWireframeEnabled{
false};
264 double videoSimWireframeResolution{0.1};
265 cs::CvSource videoSimProcessed;
266 cv::Mat videoSimFrameProcessed{};
267 bool videoSimProcEnabled{
true};
Definition NTTopicSet.h:37
Represents a camera that is connected to PhotonVision.
Definition PhotonCamera.h:56
Definition PhotonCameraSim.h:49
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:244
void SetWireframeResolution(double resolution)
Sets the resolution of the drawn wireframe if enabled.
Definition PhotonCameraSim.h:224
const cs::CvSource & GetVideoSimRaw()
Definition PhotonCameraSim.h:132
const cv::Mat & GetVideoSimFrameRaw()
Definition PhotonCameraSim.h:133
PhotonCamera * GetCamera()
Returns the camera being simulated.
Definition PhotonCameraSim.h:105
PhotonCameraSim(PhotonCamera *camera, const SimCameraProperties &props, const frc::AprilTagFieldLayout &tagLayout=frc::AprilTagFieldLayout::LoadField(frc::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:212
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:121
PhotonCameraSim(PhotonCamera *camera, const SimCameraProperties &props, double minTargetAreaPercent, units::meter_t maxSightRange)
Constructs a handle for simulating PhotonCamera values.
void EnabledProcessedStream(double enabled)
Sets whether the processed video stream simulation is enabled.
Definition PhotonCameraSim.h:233
units::meter_t GetMaxSightRange()
Returns the maximum distance at which the target is illuminated to your camera.
Definition PhotonCameraSim.h:131
PhotonPipelineResult Process(units::second_t latency, const frc::Pose3d &cameraPose, std::vector< VisionTargetSim > targets)
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:183
void SubmitProcessedFrame(const PhotonPipelineResult &result, uint64_t ReceiveTimestamp)
void EnableRawStream(bool enabled)
Sets whether the raw video stream simulation is enabled.
Definition PhotonCameraSim.h:202
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:113
void SetMaxSightRange(units::meter_t range)
Sets the maximum distance at which the target is illuminated to your camera.
Definition PhotonCameraSim.h:193
bool CanSeeTargetPose(const frc::Pose3d &camPose, const VisionTargetSim &target)
Determines if this target's pose should be visible to the camera without considering its projected im...
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:173
Represents a pipeline result from a PhotonCamera.
Definition PhotonPipelineResult.h:37
Calibration and performance values for this camera.
Definition SimCameraProperties.h:59
int GetResArea() const
Gets the area of the simulated camera image.
Definition SimCameraProperties.h:144
Definition VisionTargetSim.h:34
Definition TargetModel.h:27