Skip to content

Commit

Permalink
RSDK-8829: Add frame_rate to cpp sdk (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
jckras authored Sep 24, 2024
1 parent cb4630f commit c428bb5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/viam/sdk/components/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ Camera::properties Camera::from_proto(
return {proto.supports_pcd(),
from_proto(proto.intrinsic_parameters()),
from_proto(proto.distortion_parameters()),
{proto.mime_types().begin(), proto.mime_types().end()}};
{proto.mime_types().begin(), proto.mime_types().end()},
(proto.frame_rate())};
}

viam::component::camera::v1::IntrinsicParameters Camera::to_proto(
Expand Down Expand Up @@ -282,7 +283,8 @@ bool operator==(const Camera::distortion_parameters& lhs,
bool operator==(const Camera::properties& lhs, const Camera::properties& rhs) {
return lhs.supports_pcd == rhs.supports_pcd &&
lhs.intrinsic_parameters == rhs.intrinsic_parameters &&
lhs.distortion_parameters == rhs.distortion_parameters;
lhs.distortion_parameters == rhs.distortion_parameters &&
lhs.frame_rate == rhs.frame_rate;
}

} // namespace sdk
Expand Down
3 changes: 3 additions & 0 deletions src/viam/sdk/components/camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class Camera : public Component {

/// @brief Contains the mime types the camera supports.
Camera::mime_types mime_types;

/// @brief Contains the camera's frame rate.
float frame_rate;
};

/// @struct point_cloud
Expand Down
1 change: 1 addition & 0 deletions src/viam/sdk/components/private/camera_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ ::grpc::Status CameraServer::GetProperties(
*response->mutable_intrinsic_parameters() =
Camera::to_proto(properties.intrinsic_parameters);
response->set_supports_pcd(properties.supports_pcd);
response->set_frame_rate(properties.frame_rate);
});
}

Expand Down
1 change: 1 addition & 0 deletions src/viam/sdk/tests/mocks/camera_mocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Camera::properties fake_properties() {
properties.intrinsic_parameters = fake_intrinsic_parameters();
properties.distortion_parameters = fake_distortion_parameters();
properties.mime_types = fake_mime_types();
properties.frame_rate = 10.0;
return properties;
}

Expand Down

0 comments on commit c428bb5

Please sign in to comment.