Try out the Python Viam SDK and use code to control a robot in our lab!
-
Access this repo in a web browser at: https://github.com/viam-labs/try-viam-codespace .
-
Open a new GitHub Codespace using this repo as a template by clicking the green Use this template button, and selecting Open in a codespace.
-
In a separate browser window, head to Try Viam, start a new session by clicking Try Now. If you haven’t already, you will need to create a Viam account. Wait for configuration to complete, then click Try My Rover when ready.
-
Switch to the Code sample tab, and enable the Include secret toggle.
-
Copy the location secret, (the
payload
) shown in the Code sample tab and paste it between the single quotes forSECRET_FROM_VIAM_APP
indrive.py
. -
Similarly, copy the robot address within
RobotClient.at_address()
shown in the Code sample tab and paste it between the single quotes forADDRESS_FROM_VIAM_APP
indrive.py
. Only copy the hostname, ending withviam.cloud
. -
Next, in the Control tab, find the
viam_base
control panel, and enable thecam
andoverhead-cam:overheadcam
cameras. You should see live feeds from its forward-facing webcam, as well as an external overhead camera. -
Return to the Terminal in your GitHub editor window, and run the Python code:
python drive.py
You should see the robot move in the controls tab of the Try Viam app!