feathersdk.robot.services.camera_service Module¶
- class feathersdk.robot.services.camera_service.CameraResolution(value)¶
Bases:
UniqueEnumResolution for the teleop camera.
- HD720 = 0¶
- HD1080 = 1¶
- HD2K = 2¶
- class feathersdk.robot.services.camera_service.CameraColorSpace(value)¶
Bases:
UniqueEnumThe color space of the camera image output.
- BGR = 0¶
- RGB = 1¶
- class feathersdk.robot.services.camera_service.ZedCameraVersion(value)¶
Bases:
UniqueEnumThe version of the camera.
- ZED_2i = 0¶
- class feathersdk.robot.services.camera_service.BinocularCameraView(value)¶
Bases:
UniqueEnumThe view of the binocular camera to use.
- LEFT = 0¶
- RIGHT = 1¶
- BOTH = 2¶
- class feathersdk.robot.services.camera_service.ZedCameraServiceConfig(*, module_name='camera_service', version=ZedCameraVersion.ZED_2i, resolution=CameraResolution.HD720, fps=30, view=BinocularCameraView.BOTH, color_space=CameraColorSpace.BGR, brightness=5, whitebalance_temp=5600)¶
Bases:
PyDFrozenBaseModelConfiguration for the camera service.
- Parameters:
module_name (str)
version (ZedCameraVersion)
resolution (CameraResolution)
fps (int)
view (BinocularCameraView)
color_space (CameraColorSpace)
brightness (int)
whitebalance_temp (int)
- version: ZedCameraVersion¶
The version of the camera.
- resolution: CameraResolution¶
The resolution of the camera.
- view: BinocularCameraView¶
Whether to use just the left/right, or both cameras. The CameraService’s image will be the selected view.
- color_space: CameraColorSpace¶
The color space of the camera image output.
- model_config: ClassVar[ConfigDict] = {'frozen': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class feathersdk.robot.services.camera_service.ZedCameraService(config, *args, **kwargs)¶
Bases:
RobotModule[ZedCameraServiceConfig]A service that monitors the camera.
- Parameters:
config (ZedCameraServiceConfig)
robot (FeatherRobot)
- runtime_params: sl.RuntimeParameters¶
The runtime parameters for the zed camera.
- total_width: int¶
The total width in pixels of the camera. This is width * 2 if config.view == BinocularCameraView.BOTH, otherwise width.
- image: ndarray¶
The image from the camera. If config.view == BinocularCameraView.BOTH, then this contains both left and right images in a side-by-side format. Will be in config.color_space format. Shape: (height, total_width, 3), dtype: np.uint8.
- init_params: sl.InitParameters¶
The initialization parameters for the zed camera.
- get_imu_data()¶
Get the latest linear acceleration from the ZED 2i.
Values are in m/s^2 and include gravity. IMU frame: +X right of the camera, +Y down, +Z forward along the optical axis.
- get_imu_angular_velocity()¶
Get the latest angular velocity from the ZED 2i.
Values are in rad/s. IMU frame: +X right of the camera, +Y down, +Z forward.
- capture_image()¶
Capture an image from the camera, storing result in self.image.
- Return type:
None
- reset_camera()¶
Close and re-open the camera. Takes 5-10 seconds.
- detect_broken_pipeline(apply_fix=True)¶
Detect (and possibly fix) if the camera pipeline is broken.
Sometimes, the camera pipeline will become broken due to a variety of reasons. For example, if the usb cable shakes and becomes loose for a second. When this happens, the resultant image will be homogenously colored.
This function will sample random pixels from the image. If the pixels are all the same, we assume that the pipeline is broken. If apply_fix is True, the function will attempt to fix the pipeline by closing and re-opening the camera (this will take 5-10 seconds), then capture a fresh image.