Skip to content

Commit 921a883

Browse files
authored
DOCS-2313: Clean up gantry, camera, board, encoder and arm pages for docs parsing (#631)
1 parent ce38437 commit 921a883

File tree

5 files changed

+44
-31
lines changed

5 files changed

+44
-31
lines changed

src/viam/components/arm/arm.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async def get_end_position(
3535
**kwargs,
3636
) -> Pose:
3737
"""
38-
Get the current position of the end of the arm expressed as a Pose.
38+
Get the current position of the end of the arm expressed as a ``Pose``.
3939
4040
::
4141
@@ -45,7 +45,10 @@ async def get_end_position(
4545
pos = await my_arm.get_end_position()
4646
4747
Returns:
48-
Pose: The location and orientation of the arm described as a Pose.
48+
Pose: A representation of the arm’s current position as a 6 DOF (six degrees of freedom) pose.
49+
The ``Pose`` is composed of values for location and orientation with respect to the origin.
50+
Location is expressed as distance, which is represented by x, y, and z coordinate values.
51+
Orientation is expressed as an orientation vector, which is represented by o_x, o_y, o_z, and theta values.
4952
"""
5053
...
5154

@@ -72,7 +75,10 @@ async def move_to_position(
7275
await my_arm.move_to_position(pose=examplePose)
7376
7477
Args:
75-
pose (Pose): The destination Pose for the arm.
78+
pose (Pose): The destination ``Pose`` for the arm. The ``Pose`` is composed of values for location and orientation
79+
with respect to the origin.
80+
Location is expressed as distance, which is represented by x, y, and z coordinate values.
81+
Orientation is expressed as an orientation vector, which is represented by o_x, o_y, o_z, and theta values.
7682
"""
7783
...
7884

@@ -127,7 +133,9 @@ async def get_joint_positions(
127133
pos = await my_arm.get_joint_positions()
128134
129135
Returns:
130-
JointPositions: The current JointPositions for the arm.
136+
JointPositions: The current ``JointPositions`` for the arm.
137+
``JointPositions`` can have one attribute, ``values``, a list of joint positions with rotational values (degrees)
138+
and translational values (mm).
131139
"""
132140
...
133141

@@ -148,6 +156,7 @@ async def stop(
148156
149157
# Stop all motion of the arm. It is assumed that the arm stops immediately.
150158
await my_arm.stop()
159+
151160
"""
152161
...
153162

@@ -193,7 +202,7 @@ async def get_kinematics(
193202
194203
Returns:
195204
Tuple[KinematicsFileFormat.ValueType, bytes]: A tuple containing two values; the first [0] value represents the format of the
196-
file, either in URDF format or Viam's kinematic parameter format (spatial vector algebra), and the second [1] value
197-
represents the byte contents of the file.
205+
file, either in URDF format or Viam's kinematic parameter format (spatial vector algebra), and the second [1] value
206+
represents the byte contents of the file.
198207
"""
199208
...

src/viam/components/board/board.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Board(ComponentBase):
3838

3939
class Analog:
4040
"""
41-
AnalogReader represents an analog pin reader or writer that resides on a Board.
41+
Analog represents an analog pin reader or writer that resides on a Board.
4242
"""
4343

4444
name: str
@@ -63,7 +63,7 @@ async def read(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optiona
6363
6464
my_board = Board.from_robot(robot=robot, name="my_board")
6565
66-
# Get the AnalogReader "my_example_analog_reader".
66+
# Get the Analog "my_example_analog_reader".
6767
reader = await my_board.analog_reader_by_name(
6868
name="my_example_analog_reader")
6969
@@ -79,16 +79,20 @@ async def read(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optiona
7979
@abc.abstractmethod
8080
async def write(self, value: int, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs):
8181
"""
82-
Write a value to the analog writer.
82+
Write a value to the Analog writer.
8383
8484
::
85+
8586
my_board = Board.from_robot(robot=robot, name="my_board")
8687
87-
# Get the AnalogWriter "my_example_analog_writer".
88+
# Get the Analog "my_example_analog_writer".
8889
writer = await my_board.analog_by_name(
8990
name="my_example_analog_writer")
9091
9192
await writer.write(42)
93+
94+
Args:
95+
value (int): Value to write to the analog writer.
9296
"""
9397
...
9498

@@ -100,7 +104,7 @@ class DigitalInterrupt:
100104
"""
101105

102106
name: str
103-
"""The name of the digital interrupt"""
107+
"""The name of the digital interrupt."""
104108

105109
def __init__(self, name: str):
106110
self.name = name
@@ -130,11 +134,11 @@ async def value(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Option
130134

131135
class GPIOPin:
132136
"""
133-
Abstract representation of an individual GPIO pin on a board
137+
Abstract representation of an individual GPIO pin on a board.
134138
"""
135139

136140
name: str
137-
"""The name of the GPIO pin"""
141+
"""The name of the GPIO pin."""
138142

139143
def __init__(self, name: str):
140144
self.name = name

src/viam/components/camera/camera.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async def get_image(
5959
mime_type (str): The desired mime type of the image. This does not guarantee output type
6060
6161
Returns:
62-
ViamImage: The frame
62+
ViamImage: The frame.
6363
"""
6464
...
6565

@@ -77,8 +77,8 @@ async def get_images(self, *, timeout: Optional[float] = None, **kwargs) -> Tupl
7777
timestamp = metadata.captured_at
7878
7979
Returns:
80-
Tuple[List[NamedImage], ResponseMetadata]: A tuple containing two values; the first [0] a list of images returned from the
81-
camera system, and the second [1] the metadata associated with this response.
80+
Tuple[List[NamedImage], ResponseMetadata]: A tuple containing two values; the first [0] a list of images
81+
returned from the camera system, and the second [1] the metadata associated with this response.
8282
"""
8383
...
8484

@@ -108,8 +108,8 @@ async def get_point_cloud(
108108
points = np.asarray(pcd.points)
109109
110110
Returns:
111-
Tuple[bytes, str]: A tuple containing two values; the first [0] the pointcloud data, and the second [1] the mimetype of the
112-
pointcloud (e.g. PCD).
111+
Tuple[bytes, str]: A tuple containing two values; the first [0] the pointcloud data,
112+
and the second [1] the mimetype of the pointcloud (for example, PCD).
113113
"""
114114
...
115115

@@ -125,6 +125,6 @@ async def get_properties(self, *, timeout: Optional[float] = None, **kwargs) ->
125125
properties = await my_camera.get_properties()
126126
127127
Returns:
128-
Properties: The properties of the camera
128+
Properties: The properties of the camera.
129129
"""
130130
...

src/viam/components/encoder/encoder.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ async def get_position(
7575
print("The encoder position is currently ", position[0], position[1])
7676
7777
Args:
78-
position_type (PositionType.ValueType): The desired output type of the position
78+
position_type (PositionType.ValueType): The desired output type of the position.
7979
8080
Returns:
81-
Tuple[float, PositionType]: A tuple containing two values; the first [0] the Position of the encoder which can either be
82-
ticks since last zeroing for a relative encoder or degrees for an absolute encoder, and the second [1] the type of
83-
position the encoder returns (ticks or degrees).
81+
Tuple[float, PositionType]: A tuple containing two values; the first [0] the Position of the encoder
82+
which can either be ticks since last zeroing for a relative encoder or degrees for an absolute encoder,
83+
and the second [1] the type of position the encoder returns (ticks or degrees).
8484
"""
8585
...
8686

src/viam/components/gantry/gantry.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Gantry(ComponentBase):
2626
@abc.abstractmethod
2727
async def get_position(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[float]:
2828
"""
29-
Get the position in millimeters.
29+
Get the positions of the axes of the gantry in millimeters.
3030
3131
::
3232
@@ -36,7 +36,7 @@ async def get_position(self, *, extra: Optional[Dict[str, Any]] = None, timeout:
3636
positions = await my_gantry.get_position()
3737
3838
Returns:
39-
List[float]: The position of the axes.
39+
List[float]: A list of the position of the axes of the gantry in millimeters.
4040
"""
4141
...
4242

@@ -51,7 +51,7 @@ async def move_to_position(
5151
**kwargs,
5252
):
5353
"""
54-
Move the gantry to a new position at the requested speeds.
54+
Move the axes of the gantry to the desired positions (mm) at the requested speeds (mm/sec).
5555
5656
::
5757
@@ -68,15 +68,15 @@ async def move_to_position(
6868
positions=examplePositions, speeds=exampleSpeeds)
6969
7070
Args:
71-
positions (List[float]): List of positions for the axes to move to,
72-
in millimeters.
71+
positions (List[float]): A list of positions for the axes of the gantry to move to, in millimeters.
72+
speeds (List[float]): A list of speeds in millimeters per second for the gantry to move at respective to each axis.
7373
"""
7474
...
7575

7676
@abc.abstractmethod
7777
async def home(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> bool:
7878
"""
79-
Home the gantry to find it's starting and ending positions
79+
Run the homing sequence of the gantry to re-calibrate the axes with respect to the limit switches.
8080
8181
::
8282
@@ -85,7 +85,7 @@ async def home(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optiona
8585
await my_gantry.home()
8686
8787
Returns:
88-
bool : whether the gantry has run the homing sequence successfully
88+
bool: Whether the gantry has run the homing sequence successfully.
8989
"""
9090

9191
@abc.abstractmethod
@@ -101,7 +101,7 @@ async def get_lengths(self, *, extra: Optional[Dict[str, Any]] = None, timeout:
101101
lengths_mm = await my_gantry.get_lengths()
102102
103103
Returns:
104-
List[float]: The lengths of the axes.
104+
List[float]: A list of the lengths of the axes of the gantry in millimeters.
105105
"""
106106
...
107107

0 commit comments

Comments
 (0)