Manage machines with Viam's machine management API | APIs

Manage machines with Viam's machine management API

The machine API allows you to connect to your machine from within a supported Viam SDK, retrieve status information, and send commands remotely.

The machine API is supported for use with the Viam Python SDK, the Viam Go SDK, and the Viam C++ SDK.

The machine API supports the following methods:

Method Name Description
GetOperations Get the list of operations currently running on the machine.
GetMachineStatus Get status information about the machine including the status of the machine and its resources and the revision of the machine config.
GetSessions Get the list of sessions currently connected to the robot.
ResourceNames Get a list of all known resource names connected to this machine.
ResourceRPCSubtypes Get a list of all resource types.
CancelOperation Cancel the specified operation on the machine.
BlockForOperation Blocks on the specified operation on the machine.
FrameSystemConfig Get the configuration of the frame system of a given machine.
TransformPose Transform a given source Pose from the original reference frame to a new destination reference frame.
TransformPCD Transforms the pointcloud to the desired frame in the robot’s frame system.
GetModelsFromModules Get a list of all models provided by local and registry modules on the machine.
StopAll Cancel all current and outstanding operations for the machine and stop all actuators and movement.
RestartModule Reload a module as if its config changed.
Log Create a LogEntry object from the log to send to the RDK over gRPC.
GetCloudMetadata Get app-related information about the robot.
GetVersion Return version information about the machine.
Options.with_api_key Create a RobotClient.Options using an API key as credentials.
AtAddress Create a RobotClient that is connected to the machine at the provided address.
WithChannel Create a RobotClient that is connected to a machine over the given channel.
Refresh Manually refresh the underlying parts of this machine.
Shutdown Shutdown shuts down the machine.
Close Close the underlying connections and stop any periodic tasks across all constituent parts of the machine.

Establish a connection

To use the machine management API, navigate to the CONNECT tab of one of your machines to get sample code.

API

GetOperations

Get the list of operations currently running on the machine.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.

GetMachineStatus

Get status information about the machine including the status of the machine and its resources and the revision of the machine config.

Parameters:

Returns:

GetSessions

Get the list of sessions currently connected to the robot.

Parameters:

Returns:

ResourceNames

Get a list of all known resource names connected to this machine.

Parameters:

Returns:

ResourceRPCSubtypes

Get a list of all resource types.

Parameters:

Returns:

CancelOperation

Cancel the specified operation on the machine.

Parameters:

Returns:

BlockForOperation

Blocks on the specified operation on the machine. This function will only return when the specific operation has finished or has been cancelled.

Parameters:

Returns:

FrameSystemConfig

Get the configuration of the frame system of a given machine.

Parameters:

Returns:

TransformPose

Transform a given source Pose from the original reference frame to a new destination reference frame.

Parameters:

Returns:

TransformPCD

Transforms the pointcloud to the desired frame in the robot’s frame system. Do not move the robot between the generation of the initial pointcloud and the receipt of the transformed pointcloud, as doing so will make the transformations inaccurate.

Parameters:

Returns:

GetModelsFromModules

Get a list of all models provided by local and registry modules on the machine. This includes models that are not currently configured on the machine.

Parameters:

Returns:

StopAll

Cancel all current and outstanding operations for the machine and stop all actuators and movement.

Parameters:

Returns:

RestartModule

Reload a module as if its config changed.

Parameters:

Log

Create a LogEntry object from the log to send to the RDK over gRPC.

Parameters:

Returns:

GetCloudMetadata

Get app-related information about the robot.

Parameters:

Returns:

GetVersion

Return version information about the machine.

Parameters:

Returns:

Options.with_api_key

Create a RobotClient.Options using an API key as credentials. Pass these options to AtAddress.

Parameters:

Returns:

Raises:

AtAddress

Create a RobotClient that is connected to the machine at the provided address.

Parameters:

Returns:

WithChannel

Create a RobotClient that is connected to a machine over the given channel. Any machines created using this method will NOT automatically close the channel upon exit.

Parameters:

Returns:

Refresh

Manually refresh the underlying parts of this machine.

Parameters:

Returns:

Shutdown

Shutdown shuts down the machine.

Parameters:

Returns:

Raises:

Close

Close the underlying connections and stop any periodic tasks across all constituent parts of the machine.

Parameters:

Returns: