Skip to content

APP-8003 Add world state store service #695

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

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
da7fd20
Add world object store service
DTCurrie May 20, 2025
2e6e723
forgot to save
DTCurrie May 20, 2025
bd38820
update from PR comments
DTCurrie May 21, 2025
e49a505
add missing extra params
DTCurrie May 21, 2025
c8955f4
add missing name field to requests
DTCurrie May 21, 2025
6ff06db
cleanup
DTCurrie May 21, 2025
54dbdad
Merge branch 'main' into APP-8003-add-world-object-store-service
DTCurrie Jun 2, 2025
0827571
use world state
DTCurrie Jun 9, 2025
71b79a2
Merge branch 'main' of github.com:viamrobotics/api into APP-8003-add-…
DTCurrie Jun 9, 2025
1d2beb3
Merge branch 'APP-8003-add-world-object-store-service' of github.com:…
DTCurrie Jun 9, 2025
a5b6b70
rename to world state
DTCurrie Jun 9, 2025
cb96833
rename to world state
DTCurrie Jun 9, 2025
a894cb6
rename to world state
DTCurrie Jun 9, 2025
d9ed491
revert to discuss
DTCurrie Jun 9, 2025
0652b6a
eol
DTCurrie Jun 9, 2025
f074c79
tweaks based on conversation with micheal parks
DTCurrie Jun 11, 2025
51ac7eb
rename to world state
DTCurrie Jun 13, 2025
cbb4e7a
Merge branch 'main' into APP-8003-add-world-object-store-service
DTCurrie Jun 13, 2025
175608f
fix doc comments
DTCurrie Jun 13, 2025
c433043
changes per convo
DTCurrie Jun 17, 2025
31808f2
Merge branch 'APP-8003-add-world-object-store-service' of github.com:…
DTCurrie Jun 17, 2025
710b32d
Merge branch 'main' of github.com:viamrobotics/api into APP-8003-add-…
DTCurrie Jun 17, 2025
600c336
introduce changes as TransformNew
DTCurrie Jun 23, 2025
6ff033e
cleanup, prepare to do quick test in SDKs
DTCurrie Jun 24, 2025
e1518db
Merge branch 'main' of github.com:viamrobotics/api into APP-8003-add-…
DTCurrie Jul 8, 2025
b5b5e39
Move to Tranform, consider adding streaming RPC
DTCurrie Jul 8, 2025
590baa4
Merge branch 'main' of github.com:viamrobotics/api into APP-8003-add-…
DTCurrie Jul 10, 2025
22b41a5
updates and add change stream rpc
DTCurrie Jul 10, 2025
2730ae0
cleanup
DTCurrie Jul 10, 2025
eb02687
Merge branch 'main' into APP-8003-add-world-object-store-service
DTCurrie Jul 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 34 additions & 8 deletions proto/viam/common/v1/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@
bytes mesh = 2;
}

message PointCloud {
bytes point_cloud = 1;
}

message Line {
repeated float segments = 1;
}
Comment on lines +96 to +98
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want to introduce the Line type if we are allowing Transform to have multiple Geometrys?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this has to do with Transform having multiple geometries

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on this comment:

While I'm not sold on needing a special line type and think it would be nice to implement multi geometries with lines as 0-radius capsules, I acknowledge this would be a larger lift and not strictly necessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should line be bytes too to match Pointcloud?


// Geometry contains the dimensions of a given geometry and the pose of its center. The geometry is one of either a sphere or a box.
message Geometry {
// Pose of a geometries center point
Expand All @@ -99,6 +107,8 @@
RectangularPrism box = 3;
Capsule capsule = 5;
Mesh mesh = 6;
PointCloud pointcloud = 7;
Line line = 8;
}
// Label of the geometry. If none supplied, will be an empty string.
string label = 4;
Expand Down Expand Up @@ -135,15 +145,31 @@
repeated Geometry geometries = 2;
}

// Transform contains a pose and two reference frames. The first reference frame is the starting reference frame, and the second reference
// frame is the observer reference frame. The second reference frame has a pose which represents the pose of an object in the first
// reference frame as observed within the second reference frame.
// Transform contains a pose and two reference frames. `parent` is the starting reference frame, and `name` is the observer reference frame.
// `pose` represents the pose of an object in the `parent` frame as observed within the `name` frame.
message Transform {

Check failure on line 150 in proto/viam/common/v1/common.proto

View workflow job for this annotation

GitHub Actions / Test For Lint and Breaking Changes

Previously present field "2" with name "pose_in_observer_frame" on message "Transform" was deleted.
// the name of a given reference frame
string reference_frame = 1;
// the pose of the above reference frame with respect to a different observer reference frame
PoseInFrame pose_in_observer_frame = 2;
optional Geometry physical_object = 3;
// The name of the transform
string name = 1;

Check failure on line 152 in proto/viam/common/v1/common.proto

View workflow job for this annotation

GitHub Actions / Test For Lint and Breaking Changes

Field "1" on message "Transform" changed name from "reference_frame" to "name".

Check failure on line 152 in proto/viam/common/v1/common.proto

View workflow job for this annotation

GitHub Actions / Test For Lint and Breaking Changes

Field "1" with name "name" on message "Transform" changed option "json_name" from "referenceFrame" to "name".
reserved "reference_frame";

// Deprecated: use `parent` and `pose` instead
reserved 2;
reserved "pose_in_observer_frame";

repeated Geometry geometry = 3;

Check failure on line 159 in proto/viam/common/v1/common.proto

View workflow job for this annotation

GitHub Actions / Test For Lint and Breaking Changes

Field "3" on message "Transform" changed name from "physical_object" to "geometry".

Check failure on line 159 in proto/viam/common/v1/common.proto

View workflow job for this annotation

GitHub Actions / Test For Lint and Breaking Changes

Field "3" with name "geometry" on message "Transform" changed option "json_name" from "physicalObject" to "geometry".

Check failure on line 159 in proto/viam/common/v1/common.proto

View workflow job for this annotation

GitHub Actions / Test For Lint and Breaking Changes

Field "3" with name "geometry" on message "Transform" changed cardinality from "optional with explicit presence" to "repeated".
reserved "physical_object";

// The name of the observer reference frame
string parent = 4;

// The pose of the named frame as observed from the parent frame
Pose pose = 5;

// The UUID of the transform
bytes uuid = 6;

// Can hold information like color, opacity, points colors, collision_allowed, etc...
optional google.protobuf.Struct metadata = 7;
}

// WorldState contains information about the physical environment around a given robot. All of the fields within this message are optional,
Expand Down
80 changes: 80 additions & 0 deletions proto/viam/service/worldstatestore/v1/world_state_store.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
syntax = "proto3";

package viam.service.worldstatestore.v1;

import "common/v1/common.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/struct.proto";

option go_package = "go.viam.com/api/service/worldstatestore/v1";
option java_package = "com.viam.service.worldstatestore.v1";

service WorldStateStoreService {
// ListUUIDs returns all world state transform UUIDs
rpc ListUUIDs(ListUUIDsRequest) returns (ListUUIDsResponse) {}

// GetTransform returns a world state transform by uuid
rpc GetTransform(GetTransformRequest) returns (GetTransformResponse) {}

// StreamTransformChanges streams changes to world state transforms
rpc StreamTransformChanges(StreamTransformChangesRequest) returns (stream StreamTransformChangesResponse) {
option (google.api.http) = {get: "/viam/api/v1/service/worldstatestore/{name}/stream_transform_changes"};
}
Comment on lines +20 to +23
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this based on a conversation with @stevebriskin and @micheal-parks . The intention of this RPC is to allow visualization tools to open a stream and listen for change events from this service. We define a change event as one of the following:

// TransformChangeType is the type of change that has occurred for a transform.
enum TransformChangeType {
  TRANSFORM_CHANGE_TYPE_UNSPECIFIED = 0;
  TRANSFORM_CHANGE_TYPE_ADDED = 1;
  TRANSFORM_CHANGE_TYPE_REMOVED = 2;
  TRANSFORM_CHANGE_TYPE_UPDATED = 3;
}

When an implementor of this service is going to Send a change message, they must define what type of change event is occurring in the response:

message StreamTransformChangesResponse {
  TransformChangeType change_type = 1;
  common.v1.Transform transform = 2;

  // The field mask of the Transform that has changed, if any. For added transforms, this will be empty. For updated
  // transforms, this will be the fields that have changed. For removed transforms, this will be the Transform's UUID
  // path.  
  google.protobuf.FieldMask updated_fields = 3;
}

Note we use a FieldMask, which will allow the implementor only to include fields that were changed during a TRANSFORM_CHANGE_TYPE_UPDATED event, or just the change_type and transform.uuid fields for a TRANSFORM_CHANGE_TYPE_REMOVED event.

The field mask will enable the implementor to reduce the amount of data sent over the wire in a stream response to only the relevant data, allowing the client to understand how to manage each event it receives quickly. This should be particularly helpful when dealing with Transforms that have large amounts of geometry data (like point clouds) or have large quantities of geometries defined.


// DoCommand sends/receives arbitrary commands
rpc DoCommand(common.v1.DoCommandRequest) returns (common.v1.DoCommandResponse) {
option (google.api.http) = {post: "/viam/api/v1/service/worldstatestore/{name}/do_command"};
}
}

message ListUUIDsRequest {
// Name of the world object store service
string name = 1;

// Additional arguments to the method
google.protobuf.Struct extra = 99;
}

message ListUUIDsResponse {
repeated bytes uuids = 1;
}

message GetTransformRequest {
// Name of the world object store service
string name = 1;

bytes uuid = 2;

// Additional arguments to the method
google.protobuf.Struct extra = 99;
}

message GetTransformResponse {
common.v1.Transform transform = 2;
}

enum TransformChangeType {
TRANSFORM_CHANGE_TYPE_UNSPECIFIED = 0;
TRANSFORM_CHANGE_TYPE_ADDED = 1;
TRANSFORM_CHANGE_TYPE_REMOVED = 2;
TRANSFORM_CHANGE_TYPE_UPDATED = 3;
}

message StreamTransformChangesRequest {
// Name of the world object store service
string name = 1;

// Additional arguments to the method
google.protobuf.Struct extra = 99;
}

message StreamTransformChangesResponse {
TransformChangeType change_type = 1;
common.v1.Transform transform = 2;

// The field mask of the transform that has changed, if any. For added transforms, this will be empty. For updated
// transforms, this will be the fields that have changed. For removed transforms, this will be the transform's UUID
// path.
google.protobuf.FieldMask updated_fields = 3;
}
Loading