Skip to content

Commit c428bb5

Browse files
authored
RSDK-8829: Add frame_rate to cpp sdk (#294)
1 parent cb4630f commit c428bb5

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

src/viam/sdk/components/camera.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ Camera::properties Camera::from_proto(
231231
return {proto.supports_pcd(),
232232
from_proto(proto.intrinsic_parameters()),
233233
from_proto(proto.distortion_parameters()),
234-
{proto.mime_types().begin(), proto.mime_types().end()}};
234+
{proto.mime_types().begin(), proto.mime_types().end()},
235+
(proto.frame_rate())};
235236
}
236237

237238
viam::component::camera::v1::IntrinsicParameters Camera::to_proto(
@@ -282,7 +283,8 @@ bool operator==(const Camera::distortion_parameters& lhs,
282283
bool operator==(const Camera::properties& lhs, const Camera::properties& rhs) {
283284
return lhs.supports_pcd == rhs.supports_pcd &&
284285
lhs.intrinsic_parameters == rhs.intrinsic_parameters &&
285-
lhs.distortion_parameters == rhs.distortion_parameters;
286+
lhs.distortion_parameters == rhs.distortion_parameters &&
287+
lhs.frame_rate == rhs.frame_rate;
286288
}
287289

288290
} // namespace sdk

src/viam/sdk/components/camera.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ class Camera : public Component {
6565

6666
/// @brief Contains the mime types the camera supports.
6767
Camera::mime_types mime_types;
68+
69+
/// @brief Contains the camera's frame rate.
70+
float frame_rate;
6871
};
6972

7073
/// @struct point_cloud

src/viam/sdk/components/private/camera_server.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ ::grpc::Status CameraServer::GetProperties(
114114
*response->mutable_intrinsic_parameters() =
115115
Camera::to_proto(properties.intrinsic_parameters);
116116
response->set_supports_pcd(properties.supports_pcd);
117+
response->set_frame_rate(properties.frame_rate);
117118
});
118119
}
119120

src/viam/sdk/tests/mocks/camera_mocks.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Camera::properties fake_properties() {
9696
properties.intrinsic_parameters = fake_intrinsic_parameters();
9797
properties.distortion_parameters = fake_distortion_parameters();
9898
properties.mime_types = fake_mime_types();
99+
properties.frame_rate = 10.0;
99100
return properties;
100101
}
101102

0 commit comments

Comments
 (0)