From f5c2676d96665e0a4889bf4dbfe374d60b962081 Mon Sep 17 00:00:00 2001 From: Naomi Pentrel <5212232+npentrel@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:25:28 +0100 Subject: [PATCH] Make code samples more consistent (#771) --- src/viam/components/camera/camera.py | 2 ++ src/viam/components/input/input.py | 2 ++ src/viam/services/motion/motion.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/viam/components/camera/camera.py b/src/viam/components/camera/camera.py index e0ff15eb1..d2c220684 100644 --- a/src/viam/components/camera/camera.py +++ b/src/viam/components/camera/camera.py @@ -107,6 +107,8 @@ async def get_point_cloud( import numpy as np import open3d as o3d + my_camera = Camera.from_robot(robot=machine, name="my_camera") + data, _ = await my_camera.get_point_cloud() # write the point cloud into a temporary file diff --git a/src/viam/components/input/input.py b/src/viam/components/input/input.py index 5aea4b555..ae6f3fd46 100644 --- a/src/viam/components/input/input.py +++ b/src/viam/components/input/input.py @@ -276,6 +276,8 @@ async def trigger_event( """Directly send an Event (such as a button press) from external code :: + my_controller = Controller.from_robot( + robot=machine, name="my_controller") # Get your controller from the machine. my_controller = Controller.from_robot( diff --git a/src/viam/services/motion/motion.py b/src/viam/services/motion/motion.py index 9b4cdfd4d..37155e617 100644 --- a/src/viam/services/motion/motion.py +++ b/src/viam/services/motion/motion.py @@ -238,6 +238,8 @@ async def stop_plan( :: + motion = MotionClient.from_robot(robot=machine, name="builtin") + # Assuming a `move_on_globe()` started the execution # Stop the base component which was instructed to move by `move_on_globe()` # or `move_on_map()`