Skip to content

Commit

Permalink
RSDK-8813: Add frame_rate to python sdk (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
jckras authored Sep 25, 2024
1 parent f53775b commit 77e6c21
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
8 changes: 1 addition & 7 deletions src/viam/components/camera/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,7 @@ async def GetProperties(self, stream: Stream[GetPropertiesRequest, GetProperties
camera = self.get_resource(name)
timeout = stream.deadline.time_remaining() if stream.deadline else None
properties = await camera.get_properties(timeout=timeout, metadata=stream.metadata)
response = GetPropertiesResponse(
supports_pcd=properties.supports_pcd,
intrinsic_parameters=properties.intrinsic_parameters,
distortion_parameters=properties.distortion_parameters,
mime_types=properties.mime_types,
)
await stream.send_message(response)
await stream.send_message(properties)

async def DoCommand(self, stream: Stream[DoCommandRequest, DoCommandResponse]) -> None:
request = await stream.recv_message()
Expand Down
1 change: 1 addition & 0 deletions tests/mocks/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ def __init__(self, name: str):
intrinsic_parameters=IntrinsicParameters(width_px=1, height_px=2, focal_x_px=3, focal_y_px=4, center_x_px=5, center_y_px=6),
distortion_parameters=DistortionParameters(model="no_distortion"),
mime_types=[CameraMimeType.PNG, CameraMimeType.JPEG],
frame_rate=10.0,
)
self.timeout: Optional[float] = None
ts = Timestamp()
Expand Down
2 changes: 2 additions & 0 deletions tests/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def properties() -> Camera.Properties:
intrinsic_parameters=IntrinsicParameters(width_px=1, height_px=2, focal_x_px=3, focal_y_px=4, center_x_px=5, center_y_px=6),
distortion_parameters=DistortionParameters(model="no_distortion"),
mime_types=[CameraMimeType.PNG, CameraMimeType.JPEG],
frame_rate=10.0,
)


Expand Down Expand Up @@ -202,6 +203,7 @@ async def test_get_properties(self, camera: MockCamera, service: CameraRPCServic
assert response.supports_pcd == properties.supports_pcd
assert response.intrinsic_parameters == properties.intrinsic_parameters
assert response.mime_types == properties.mime_types
assert response.frame_rate == properties.frame_rate
assert camera.timeout == loose_approx(5.43)

@pytest.mark.asyncio
Expand Down

0 comments on commit 77e6c21

Please sign in to comment.