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: Clean up gantry, camera, board, encoder and arm pages for docs parsing #631

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
32 changes: 26 additions & 6 deletions src/viam/components/arm/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def get_end_position(
**kwargs,
) -> Pose:
"""
Get the current position of the end of the arm expressed as a Pose.
Get the current position of the end of the arm expressed as a ``Pose``.

::

Expand All @@ -44,8 +44,14 @@ async def get_end_position(
# Get the end position of the arm as a Pose.
pos = await my_arm.get_end_position()

Args:
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
Copy link
Member

Choose a reason for hiding this comment

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

The idiom in python is to not provide docstring comments for extra and timeout, so we should remove these (and the same comments in below methods). It looks like the same comment is used here as in motion; sorry for the confusion! The motion doc comments should probably get removed at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, thank you!

Returns:
Pose: The location and orientation of the arm described as a Pose.
Pose: A representation of the arm’s current position as a 6 DOF (six degrees of freedom) pose.
The ``Pose`` is composed of values for location and orientation with respect to the origin.
Location is expressed as distance, which is represented by x, y, and z coordinate values.
Orientation is expressed as an orientation vector, which is represented by o_x, o_y, o_z, and theta values.
"""
...

Expand All @@ -72,7 +78,11 @@ async def move_to_position(
await my_arm.move_to_position(pose=examplePose)

Args:
pose (Pose): The destination Pose for the arm.
pose (Pose): The destination ``Pose`` for the arm. The ``Pose`` is composed of values for location and orientation with respect to the origin.
Copy link
Member

Choose a reason for hiding this comment

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

The linter is complaining about this line (and some others) that they're too long; can we cut this down or break it into multiple lines?

Location is expressed as distance, which is represented by x, y, and z coordinate values.
Orientation is expressed as an orientation vector, which is represented by o_x, o_y, o_z, and theta values.
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
"""
...

Expand Down Expand Up @@ -105,6 +115,8 @@ async def move_to_joint_positions(

Args:
positions (JointPositions): The destination ``JointPositions`` for the arm.
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
"""
...

Expand All @@ -126,8 +138,12 @@ async def get_joint_positions(
# Get the current position of each joint on the arm as JointPositions.
pos = await my_arm.get_joint_positions()

Args:
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
Returns:
JointPositions: The current JointPositions for the arm.
JointPositions: The current ``JointPositions`` for the arm.
``JointPositions`` can have one attribute, ``values``, a list of joint positions with rotational values (degrees) and translational values (mm).
"""
...

Expand All @@ -148,6 +164,10 @@ async def stop(

# Stop all motion of the arm. It is assumed that the arm stops immediately.
await my_arm.stop()

Args:
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
"""
...

Expand Down Expand Up @@ -193,7 +213,7 @@ async def get_kinematics(

Returns:
Tuple[KinematicsFileFormat.ValueType, bytes]: A tuple containing two values; the first [0] value represents the format of the
file, either in URDF format or Viam's kinematic parameter format (spatial vector algebra), and the second [1] value
represents the byte contents of the file.
file, either in URDF format or Viam's kinematic parameter format (spatial vector algebra), and the second [1] value
represents the byte contents of the file.
"""
...
30 changes: 22 additions & 8 deletions src/viam/components/gantry/gantry.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Gantry(ComponentBase):
@abc.abstractmethod
async def get_position(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[float]:
"""
Get the position in millimeters.
Get the positions of the axes of the gantry in millimeters.

::

Expand All @@ -35,8 +35,11 @@ async def get_position(self, *, extra: Optional[Dict[str, Any]] = None, timeout:
# Get the current positions of the axes of the gantry in millimeters.
positions = await my_gantry.get_position()

Args:
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
Returns:
List[float]: The position of the axes.
List[float]: A list of the position of the axes of the gantry in millimeters.
"""
...

Expand All @@ -51,7 +54,7 @@ async def move_to_position(
**kwargs,
):
"""
Move the gantry to a new position at the requested speeds.
Move the axes of the gantry to the desired positions (mm) at the requested speeds (mm/sec).

::

Expand All @@ -68,24 +71,29 @@ async def move_to_position(
positions=examplePositions, speeds=exampleSpeeds)

Args:
positions (List[float]): List of positions for the axes to move to,
in millimeters.
positions (List[float]): A list of positions for the axes of the gantry to move to, in millimeters.
speeds (List[float]): A list of speeds in millimeters per second for the gantry to move at respective to each axis.
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
"""
...

@abc.abstractmethod
async def home(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> bool:
"""
Home the gantry to find it's starting and ending positions
Run the homing sequence of the gantry to re-calibrate the axes with respect to the limit switches.

::

my_gantry = Gantry.from_robot(robot=robot, name="my_gantry")

await my_gantry.home()

Args:
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
Returns:
bool : whether the gantry has run the homing sequence successfully
bool: Whether the gantry has run the homing sequence successfully.
"""

@abc.abstractmethod
Expand All @@ -100,8 +108,11 @@ async def get_lengths(self, *, extra: Optional[Dict[str, Any]] = None, timeout:
# Get the lengths of the axes of the gantry in millimeters.
lengths_mm = await my_gantry.get_lengths()

Args:
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
Returns:
List[float]: The lengths of the axes.
List[float]: A list of the lengths of the axes of the gantry in millimeters.
"""
...

Expand All @@ -118,6 +129,9 @@ async def stop(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optiona
# immediately.
await my_gantry.stop()

Args:
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
"""
...

Expand Down
Loading