SimVisionSystem
- class photonvision.SimVisionSystem(camName: str, camDiagFOV: degrees, cameraToRobot: wpimath.geometry._geometry.Transform3d, maxLEDRange: meters, cameraResWidth: int, cameraResHeight: int, minTargetArea: float)
Bases:
pybind11_object
Create a simulated vision system involving a camera and coprocessor mounted on a mobile robot running PhotonVision, detecting one or more targets scattered around the field. This assumes a fairly simple and distortion-less pinhole camera model.
- Parameters:
camName – Name of the PhotonVision camera to create. Align it with the settings you use in the PhotonVision GUI.
camDiagFOV – Diagonal Field of View of the camera used. Align it with the manufacturer specifications, and/or whatever is configured in the PhotonVision Setting page.
cameraToRobot – Transform to move from the camera’s mount position to the robot’s position
maxLEDRange – Maximum distance at which your camera can illuminate the target and make it visible. Set to 9000 or more if your vision system does not rely on LED’s.
cameraResWidth – Width of your camera’s image sensor in pixels
cameraResHeight – Height of your camera’s image sensor in pixels
minTargetArea – Minimum area that that the target should be before it’s recognized as a target by the camera. Match this with your contour filtering settings in the PhotonVision GUI.
- addSimVisionTarget(target: photonvision._photonvision.SimVisionTarget) None
Add a target on the field which your vision system is designed to detect. The PhotonCamera from this system will report the location of the robot relative to the subset of these targets which are visible from the given robot position.
- Parameters:
target – Target to add to the simulated field
- property cam
- camCamSeeTarget(dist: meters, yaw: radians, pitch: radians, area: float) bool
- property cameraToRobot
- clearVisionTargets() None
Clears all sim vision targets. This is useful for switching alliances and needing to repopulate the sim targets. NOTE: Old targets will still show on the Field2d unless overwritten by new targets with the same ID
- property dbgCamera
- property dbgField
- property dbgRobot
- getM2PerPx(dist: meters) square_meters
- moveCamera(newCameraToRobot: wpimath.geometry._geometry.Transform3d) None
Adjust the camera position relative to the robot. Use this if your camera is on a gimbal or turret or some other mobile platform.
- Parameters:
newCameraToRobot – New Transform from the robot to the camera
- processFrame(*args, **kwargs)
Overloaded function.
processFrame(self: photonvision._photonvision.SimVisionSystem, robotPose: wpimath.geometry._geometry.Pose2d) -> None
Periodic update. Call this once per frame of image data you wish to process and send to NetworkTables
- Parameters:
robotPose – current pose of the robot on the field. Will be used to calculate which targets are actually in view, where they are at relative to the robot, and relevant PhotonVision parameters.
processFrame(self: photonvision._photonvision.SimVisionSystem, robotPose: wpimath.geometry._geometry.Pose3d) -> None
Periodic update. Call this once per frame of image data you wish to process and send to NetworkTables
- Parameters:
robotPose – current pose of the robot in space. Will be used to calculate which targets are actually in view, where they are at relative to the robot, and relevant PhotonVision parameters.
- property targetList