Skip to content

Commit

Permalink
DOCS-1869: Add robot client examples (viamrobotics#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyleilani authored Mar 6, 2024
1 parent 4988daf commit edf35cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/viam/robot/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def connect():
# Replace "<API-KEY-ID>" (including brackets) with your machine's API key ID
api_key_id='<API-KEY-ID>'
)
return await RobotClient.at_address('ADDRESS FROM THE VIAM APP', opts)
return await RobotClient.at_address('<ADDRESS-FROM-THE-VIAM-APP>', opts)
async def main():
Expand Down Expand Up @@ -145,7 +145,7 @@ def with_api_key(cls, api_key: str, api_key_id: str, **kwargs) -> Self:
opts = RobotClient.Options.with_api_key(api_key, api_key_id)
robot = await RobotClient.at_address('ADDRESS FROM THE VIAM APP', opts)
robot = await RobotClient.at_address('<ADDRESS-FROM-THE-VIAM-APP>', opts)
Args:
api_key (str): your API key
Expand All @@ -169,6 +169,7 @@ async def at_address(cls, address: str, options: Options) -> Self:
::
async def connect():
opts = RobotClient.Options.with_api_key(
# Replace "<API-KEY>" (including brackets) with your machine's API key
api_key='<API-KEY>',
Expand Down Expand Up @@ -545,7 +546,6 @@ async def close(self):
::
# Cleanly close the underlying connections and stop any periodic tasks.
await robot.close()
"""
LOGGER.debug("Closing RobotClient")
Expand Down Expand Up @@ -738,6 +738,10 @@ async def stop_all(self, extra: Dict[ResourceName, Dict[str, Any]] = {}):
# Cancel all current and outstanding operations for the robot and stop all actuators and movement.
await robot.stop_all()
::
await robot.stop_all()
Args:
extra (Dict[viam.proto.common.ResourceName, Dict[str, Any]]): Any extra parameters to pass to the resources' ``stop`` methods,
keyed on the resource's ``ResourceName``
Expand Down

0 comments on commit edf35cf

Please sign in to comment.