-
Notifications
You must be signed in to change notification settings - Fork 113
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
RSDK-2692 - Add collectors for MovementSensor LinearAcceleration and Orientation #2258
Conversation
Warning your change may break code samples. If your change modifies any of the following functions please contact @viamrobotics/fleet-management. Thanks!
|
|
return v, err | ||
}) | ||
registerCollector("Orientation", func(ctx context.Context, ms MovementSensor) (interface{}, error) { | ||
v, err := ms.Orientation(ctx, make(map[string]interface{})) |
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.
Since Orientation returns an interface, and these are persisted by converting them to a proto struct using this function, which requires the input to be a struct, this unfortunately won't work. This output will need to wrapped in/converted to some concrete type. The proto defined OrientationResponse type here should work
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.
This did seem to work. Orientation output looked like this:
{"Imag":0,"Jmag":0,"Kmag":0,"MetadataIndex":3,"Real":1,"TimeReceived":{"seconds":1682100838,"nanos":271460000},"TimeRequested":{"seconds":1682100838,"nanos":271455000}}
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.
Interesting - I must be mis-remembering. Looks like the concrete type it's using is a quat.Number
then. I would still recommend wrapping in that proto type so that this is consistent (should be an easy mapping using the orientations .AxisAngles()
, which seems to be the representation the proto interface uses)
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.
Though actually I see Readings uses this quat value too. I think this is definitely fine for now, but as a team we should revisit the pattern here soon (put time on Thursday to discuss)
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.
Thanks for the explanation, and sounds good!
I tested this manually by creating a robot with a fake movement sensor and capturing Position, LinearAcceleration, and Orientation. I didn't see a place to add unit test coverage.
Here is the exported sensor data.
sensor_data.zip
Here are the corresponding app changes: https://github.com/viamrobotics/app/pull/1503