-
Notifications
You must be signed in to change notification settings - Fork 79
Consolidate camera api demo #679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
nicksanford
wants to merge
5
commits into
viamrobotics:main
Choose a base branch
from
nicksanford:consolidate-camera-api-demo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,29 +12,47 @@ option java_package = "com.viam.component.camera.v1"; | |
|
||
// A CameraService services all cameras associated with a robot | ||
service CameraService { | ||
// GetImage returns a frame from a camera of the underlying robot. A specific MIME type | ||
// can be requested but may not necessarily be the same one returned. | ||
// GetImage returns a frame from a camera of the underlying robot. A specific | ||
// MIME type can be requested but may not necessarily be the same one | ||
// returned. | ||
rpc GetImage(GetImageRequest) returns (GetImageResponse) { | ||
option deprecated = true; | ||
option (google.api.http) = {get: "/viam/api/v1/component/camera/{name}/image"}; | ||
} | ||
|
||
rpc GetImages(GetImagesRequest) returns (GetImagesResponse) { | ||
option deprecated = true; | ||
option (google.api.http) = {get: "/viam/api/v1/component/camera/{name}/images"}; | ||
} | ||
|
||
// RenderFrame renders a frame from a camera of the underlying robot to an HTTP response. A specific MIME type | ||
// can be requested but may not necessarily be the same one returned. | ||
// RenderFrame renders a frame from a camera of the underlying robot to an | ||
// HTTP response. A specific MIME type can be requested but may not | ||
// necessarily be the same one returned. | ||
rpc RenderFrame(RenderFrameRequest) returns (google.api.HttpBody) { | ||
option deprecated = true; | ||
option (google.api.http) = {get: "/viam/api/v1/component/camera/{name}/render_frame"}; | ||
} | ||
|
||
// GetPointCloud returns a point cloud from a camera of the underlying robot. A specific MIME type | ||
// can be requested but may not necessarily be the same one returned. | ||
// GetPointCloud returns a point cloud from a camera of the underlying robot. | ||
// A specific MIME type can be requested but may not necessarily be the same | ||
// one returned. | ||
rpc GetPointCloud(GetPointCloudRequest) returns (GetPointCloudResponse) { | ||
option deprecated = true; | ||
option (google.api.http) = {get: "/viam/api/v1/component/camera/{name}/point_cloud"}; | ||
Comment on lines
+17
to
41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We wouldn't deprecate these APIs immediately as part of this proposal, but rather, we would remove them at the end of the project once all important camera models have been migrated to the new API that can express all of them. |
||
} | ||
|
||
// GetProperties returns the camera intrinsic parameters and camera distortion parameters from a camera of the underlying robot, if available. | ||
// BinaryReadings returns the readings of all sensors on the camera at a given point in time. | ||
// The caller may specify requested sensor_names and/or formats to be sent. The server is | ||
// expected to return all results if the caller doesn't specify requested sensor_names and/or formats | ||
// and only return requested sensor_names and/or formats when the caller specifies them. | ||
// This is important to conserve bandwidth when the caller is only interested in certain | ||
// sensor readings or formats. | ||
rpc BinaryReadings(BinaryReadingsRequest) returns (BinaryReadingsResponse) { | ||
option (google.api.http) = {get: "/viam/api/v1/component/camera/{name}/binary_readings"}; | ||
} | ||
|
||
// GetProperties returns the camera intrinsic parameters and camera distortion | ||
// parameters from a camera of the underlying robot, if available. | ||
rpc GetProperties(GetPropertiesRequest) returns (GetPropertiesResponse) { | ||
option (google.api.http) = {get: "/viam/api/v1/component/camera/{name}/properties"}; | ||
} | ||
|
@@ -44,7 +62,8 @@ service CameraService { | |
option (google.api.http) = {post: "/viam/api/v1/component/camera/{name}/do_command"}; | ||
} | ||
|
||
// GetGeometries returns the geometries of the component in their current configuration | ||
// GetGeometries returns the geometries of the component in their current | ||
// configuration | ||
rpc GetGeometries(common.v1.GetGeometriesRequest) returns (common.v1.GetGeometriesResponse) { | ||
option (google.api.http) = {get: "/viam/api/v1/component/camera/{name}/geometries"}; | ||
} | ||
|
@@ -126,7 +145,8 @@ message GetPropertiesRequest { | |
} | ||
|
||
message GetPropertiesResponse { | ||
// A boolean property determining whether the camera supports the return of pointcloud data | ||
// A boolean property determining whether the camera supports the return of | ||
// pointcloud data | ||
bool supports_pcd = 1; | ||
// Parameters for doing a perspective of a 3D scene to a 2D plane | ||
// If camera does not provide intrinsic parameters, leave the field empty | ||
|
@@ -183,3 +203,49 @@ message DistortionParameters { | |
string model = 1; | ||
repeated double parameters = 2; | ||
} | ||
|
||
enum ReadingFormat { | ||
READING_FORMAT_UNSPECIFIED = 0; | ||
READING_FORMAT_BITMAP_RAW_RGBA = 1; | ||
READING_FORMAT_BITMAP_RAW_DEPTH = 2; | ||
READING_FORMAT_IMAGE_JPEG = 3; | ||
READING_FORMAT_IMAGE_PNG = 4; | ||
READING_FORMAT_POINTCLOUD_PCD = 5; | ||
} | ||
|
||
message BinaryReadingsRequest { | ||
// Name of a camera | ||
string name = 1; | ||
|
||
// Requested sensor_names | ||
// If empty all readings are requested | ||
repeated string sensor_names = 2; | ||
|
||
// Requested reading_formats | ||
// If empty all readings are requested | ||
repeated ReadingFormat formats = 3; | ||
} | ||
|
||
message BinaryReadingsResponse { | ||
// list of binary readings returned from the camera system | ||
repeated BinaryReading readings = 1; | ||
// contains timestamp data | ||
common.v1.ResponseMetadata response_metadata = 84260; | ||
} | ||
|
||
message BinaryReading { | ||
// the name of the sensor where the reading came from | ||
string source_name = 1; | ||
// format of the data | ||
ReadingFormat format = 2; | ||
// the reading data | ||
bytes data = 3; | ||
// image pixel_dimensions | ||
// may not be set if the reading isn't an image or a bitmap | ||
Dimensions pixel_dimensions = 4; | ||
} | ||
|
||
message Dimensions { | ||
uint32 x = 1; | ||
uint32 y = 2; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why we needed this custom API endpoint for the frontend to begin with since the web app can handle GRPC responses.