Skip to content

RSDK-6121: Implement getAccuracy #515

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

Merged

Conversation

susmitaSanyal
Copy link
Contributor

@susmitaSanyal susmitaSanyal commented Jan 4, 2024

getAccuracy API changes. Scop doc: https://docs.google.com/document/d/1dbVI9njfMWXWg8B_wfRU9vCzi6pGQsgdwgqqjMB-Uhc/edit#heading=h.tcicyojyqi6c

getAccuracy now returns:
map<string, float> accuracy
float position_hdop
float position_vdop
int position_nmea_gga_fix
float compass_degrees_error

Copy link
Contributor

github-actions bot commented Jan 4, 2024

Warning your change may break code samples. If your change modifies any of the following functions please contact @viamrobotics/fleet-management. Thanks!

component function
base is_moving
board gpio_pin_by_name
camera get_image
encoder get_position
motor is_moving
sensor get_readings
servo get_position
arm get_end_position
gantry get_lengths
gripper is_moving
movement_sensor get_linear_acceleration
input_controller get_controls
audio get_properties
pose_tracker get_poses
power_sensor get_power
motion get_pose
vision get_classifications_from_camera

@susmitaSanyal susmitaSanyal marked this pull request as ready for review January 12, 2024 20:45
@susmitaSanyal susmitaSanyal requested a review from a team as a code owner January 12, 2024 20:45
Copy link
Member

@purplenicole730 purplenicole730 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@stuqdog stuqdog left a comment

Choose a reason for hiding this comment

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

Nice, looks good! Worth noting though, the GetAccuracyResponse is a pretty simple type (mostly just easily understood primitives). Personally I'm a big fan of creating shadow types for all things proto but this hasn't been a consistent norm in the python SDK. I suspect @njooma would have a preference for not creating the Accuracy shadow type because 1) it creates more maintenance work for us, including the possibility of failing to remain accurate if a GetAccuracyResponse introduces new fields in the future, and 2) as stated above, the values we're dealing with are all pretty straightforward and easily understood.

Would recommend the two minor fixes that @purplenicole730 caught and getting buy-in from @njooma on the type shadowing, otherwise looks great to me!

Copy link
Member

@njooma njooma left a comment

Choose a reason for hiding this comment

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

@stuqdog is correct, I'm not a big fan of shadow types. My suggestion would be to create a TypeAlias that maps to GetAccuracyResponse similar to how we did it for Camera.Properties

@susmitaSanyal susmitaSanyal requested a review from njooma January 22, 2024 18:22
@susmitaSanyal susmitaSanyal requested a review from njooma January 23, 2024 16:30
@susmitaSanyal susmitaSanyal requested a review from njooma January 23, 2024 16:53
@susmitaSanyal susmitaSanyal merged commit 75ab8e5 into viamrobotics:main Jan 23, 2024
nicksanford pushed a commit to nicksanford/viam-python-sdk that referenced this pull request Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants