Skip to content
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

DOCS-2313: Fix docstrings in arm and encoder where link not parsing #641

Merged

Conversation

sguequierre
Copy link
Contributor

Some final fixups from this ticket

  • Fix encoder PositionType.ValueType by changing to PositionType (like in other parts of docstring) + fix code sample (value type seems to be off)
  • Fix arm KinematicsFileFormat.ValueType by giving the two value types in docstring (link to KinematicsFileFormat does not explain much)

@sguequierre sguequierre requested a review from a team as a code owner June 11, 2024 20:15
Copy link
Contributor

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_properties


::

my_encoder = Encoder.from_robot(robot=robot, name='my_encoder')

# Get the position of the encoder in ticks
position = await my_encoder.get_position(encoder.PositionTypeTicks)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

LMK if this is wrong as far as I can tell new way is way to do it?

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.

One small thing that's a technicality and honestly I'd be ok not implementing it because it's just confusing overall and I think most developers will understand

print("The encoder position is currently ", position[0], position[1])

Args:
position_type (PositionType.ValueType): The desired output type of the position.
Copy link
Member

Choose a reason for hiding this comment

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

This technically needs to be PositionType.ValueType because of the way protobuf implements these types of enumerations. If this links, then it should link to the .ValueType

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh ok-- the link wasn't being generated by the parser. I'll try adding it manually?

Copy link
Member

Choose a reason for hiding this comment

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

Ohh interesting. Ok for linking purposes I think we can keep this as just PositionType then. The actual underlying type is a property of PositionType, so it should be straightforward. And since the actual method signature has the correct type, typechecking should work just fine.

Up to y'all as this only affects docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's good with me, I figured it was straightforward as well

@npentrel
Copy link
Contributor

@sguequierre lgtm if you've confirmed this fixes the issue and renders correctly

@sguequierre
Copy link
Contributor Author

@sguequierre lgtm if you've confirmed this fixes the issue and renders correctly

yup, renders correctly changed to PositionType as Naveed suggested!

@sguequierre sguequierre merged commit 380c508 into viamrobotics:main Jun 21, 2024
13 checks passed
@sguequierre sguequierre deleted the DOCS-2313/fix-links-not-parsing branch June 21, 2024 20:41
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