![]() |
PhotonVision C++ v2026.2.2
|
A simulated vision system involving a camera(s) and coprocessor(s) mounted on a mobile robot running PhotonVision, detecting targets placed on the field. More...
#include <photon/simulation/VisionSystemSim.h>
Public Member Functions | |
| VisionSystemSim (std::string visionSystemName) | |
| A simulated vision system involving a camera(s) and coprocessor(s) mounted on a mobile robot running PhotonVision, detecting targets placed on the field. | |
| std::optional< PhotonCameraSim * > | GetCameraSim (std::string name) |
| Get one of the simulated cameras. | |
| std::vector< PhotonCameraSim * > | GetCameraSims () |
| Get all the simulated cameras. | |
| void | AddCamera (PhotonCameraSim *cameraSim, const frc::Transform3d &robotToCamera) |
| Adds a simulated camera to this vision system with a specified robot-to-camera transformation. | |
| void | ClearCameras () |
| Remove all simulated cameras from this vision system. | |
| bool | RemoveCamera (PhotonCameraSim *cameraSim) |
| Remove a simulated camera from this vision system. | |
| std::optional< frc::Transform3d > | GetRobotToCamera (PhotonCameraSim *cameraSim) |
| Get a simulated camera's position relative to the robot. | |
| std::optional< frc::Transform3d > | GetRobotToCamera (PhotonCameraSim *cameraSim, units::second_t time) |
| Get a simulated camera's position relative to the robot. | |
| std::optional< frc::Pose3d > | GetCameraPose (PhotonCameraSim *cameraSim) |
| Get a simulated camera's position on the field. | |
| std::optional< frc::Pose3d > | GetCameraPose (PhotonCameraSim *cameraSim, units::second_t time) |
| Get a simulated camera's position on the field. | |
| bool | AdjustCamera (PhotonCameraSim *cameraSim, const frc::Transform3d &robotToCamera) |
| Adjust a camera's position relative to the robot. | |
| void | ResetCameraTransforms () |
| Reset the previous transforms for all cameras to their current transform. | |
| bool | ResetCameraTransforms (PhotonCameraSim *cameraSim) |
| Reset the transform history for this camera to just the current transform. | |
| std::vector< VisionTargetSim > | GetVisionTargets () |
| Returns all the vision targets on the field. | |
| std::vector< VisionTargetSim > | GetVisionTargets (std::string type) |
| Returns all the vision targets of the specified type on the field. | |
| void | AddVisionTargets (const std::vector< VisionTargetSim > &targets) |
| Adds targets on the field which your vision system is designed to detect. | |
| void | AddVisionTargets (std::string type, const std::vector< VisionTargetSim > &targets) |
| Adds targets on the field which your vision system is designed to detect. | |
| void | AddAprilTags (const frc::AprilTagFieldLayout &layout) |
| Adds targets on the field which your vision system is designed to detect. | |
| void | ClearVisionTargets () |
| Removes every VisionTargetSim from the simulated field. | |
| void | ClearAprilTags () |
| Removes all simulated AprilTag targets from the simulated field. | |
| void | RemoveVisionTargets (std::string type) |
| Removes every VisionTargetSim of the specified type from the simulated field. | |
| std::vector< VisionTargetSim > | RemoveVisionTargets (const std::vector< VisionTargetSim > &targets) |
| Removes the specified VisionTargetSims from the simulated field. | |
| frc::Pose3d | GetRobotPose () |
| Get the latest robot pose in meters saved by the vision system. | |
| frc::Pose3d | GetRobotPose (units::second_t timestamp) |
| Get the robot pose in meters saved by the vision system at this timestamp. | |
| void | ResetRobotPose (const frc::Pose2d &robotPose) |
| Clears all previous robot poses and sets robotPose at current time. | |
| void | ResetRobotPose (const frc::Pose3d &robotPose) |
| Clears all previous robot poses and sets robotPose at current time. | |
| frc::Field2d & | GetDebugField () |
| void | Update (const frc::Pose2d &robotPose) |
| Periodic update. | |
| void | Update (const frc::Pose3d &robotPose) |
| Periodic update. | |
A simulated vision system involving a camera(s) and coprocessor(s) mounted on a mobile robot running PhotonVision, detecting targets placed on the field.
VisionTargetSims added to this class will be detected by the PhotonCameraSim added to this class. This class should be updated periodically with the robot's current pose in order to publish the simulated camera target info.
|
inlineexplicit |
A simulated vision system involving a camera(s) and coprocessor(s) mounted on a mobile robot running PhotonVision, detecting targets placed on the field.
VisionTargetSims added to this class will be detected by the PhotonCameraSims added to this class. This class should be updated periodically with the robot's current pose in order to publish the simulated camera target info.
| visionSystemName | The specific identifier for this vision system in NetworkTables. |
|
inline |
Adds targets on the field which your vision system is designed to detect.
The PhotonCameras simulated from this system will report the location of the camera relative to the subset of these targets which are visible from the given camera position.
The AprilTags from this layout will be added as vision targets under the type "apriltag". The poses added preserve the tag layout's current alliance origin. If the tag layout's alliance origin is changed, these added tags will have to be cleared and re-added.
| layout | The field tag layout to get Apriltag poses and IDs from |
|
inline |
Adds a simulated camera to this vision system with a specified robot-to-camera transformation.
The vision targets registered with this vision system simulation will be observed by the simulated PhotonCamera.
| cameraSim | The camera simulation |
| robotToCamera | The transform from the robot pose to the camera pose |
|
inline |
Adds targets on the field which your vision system is designed to detect.
The PhotonCameras simulated from this system will report the location of the camera relative to the subset of these targets which are visible from the given camera position.
By default these are added under the type "targets".
| targets | Targets to add to the simulated field |
|
inline |
Adds targets on the field which your vision system is designed to detect.
The PhotonCameras simulated from this system will report the location of the camera relative to the subset of these targets which are visible from the given camera position.
| type | Type of target (e.g. "cargo"). |
| targets | Targets to add to the simulated field |
|
inline |
Adjust a camera's position relative to the robot.
Use this if your camera is on a gimbal or turret or some other mobile platform.
| cameraSim | The simulated camera to change the relative position of |
| robotToCamera | New transform from the robot to the camera |
|
inline |
Removes all simulated AprilTag targets from the simulated field.
|
inline |
Remove all simulated cameras from this vision system.
|
inline |
Removes every VisionTargetSim from the simulated field.
|
inline |
Get a simulated camera's position on the field.
If the requested camera is invalid, an empty optional is returned.
| cameraSim | The specific camera to get the field pose of |
|
inline |
Get a simulated camera's position on the field.
If the requested camera is invalid, an empty optional is returned.
| cameraSim | The specific camera to get the field pose of |
| time | Timestamp of when the pose should be observed |
|
inline |
Get one of the simulated cameras.
|
inline |
Get all the simulated cameras.
|
inline |
|
inline |
Get the latest robot pose in meters saved by the vision system.
|
inline |
Get the robot pose in meters saved by the vision system at this timestamp.
| timestamp | Timestamp of the desired robot pose |
|
inline |
Get a simulated camera's position relative to the robot.
If the requested camera is invalid, an empty optional is returned.
| cameraSim | The specific camera to get the robot-to-camera transform of |
|
inline |
Get a simulated camera's position relative to the robot.
If the requested camera is invalid, an empty optional is returned.
| cameraSim | The specific camera to get the robot-to-camera transform of |
| time | Timestamp of when the transform should be observed |
|
inline |
Returns all the vision targets on the field.
|
inline |
Returns all the vision targets of the specified type on the field.
| type | The type of vision targets to return |
|
inline |
Remove a simulated camera from this vision system.
| cameraSim | The camera to remove |
|
inline |
Removes the specified VisionTargetSims from the simulated field.
| targets | The targets to remove |
|
inline |
Removes every VisionTargetSim of the specified type from the simulated field.
| type | Type of target (e.g. "cargo"). Same as the type passed into #addVisionTargets(String, VisionTargetSim...) |
|
inline |
Reset the previous transforms for all cameras to their current transform.
|
inline |
Reset the transform history for this camera to just the current transform.
| cameraSim | The camera to reset |
|
inline |
Clears all previous robot poses and sets robotPose at current time.
| robotPose | The robot pose |
|
inline |
Clears all previous robot poses and sets robotPose at current time.
| robotPose | The robot pose |
|
inline |
Periodic update.
Ensure this is called repeatedly– camera performance is used to automatically determine if a new frame should be submitted.
| robotPoseMeters | The simulated robot pose in meters |
|
inline |
Periodic update.
Ensure this is called repeatedly– camera performance is used to automatically determine if a new frame should be submitted.
| robotPoseMeters | The simulated robot pose in meters |