roboto.domain.device_types
Device types: named kinds of device within an organization, such as one robot model.
A device has at most one device type, whose ID is in device_type_id.
Submodules
Package Contents
CreateDeviceTypeRequest
Bases: pydantic.BaseModel
Request body for POST /v1/device-types/create, which creates a device type in the caller’s org.
Parameters
data AnyAttributes
CreateDeviceTypeRequest.description
Free-text description of the device type.
CreateDeviceTypeRequest.metadata
Initial key-value metadata pairs to associate with the device type.
DeviceType
A named kind of device within an organization, such as one robot model.
A Device has at most one device type, whose ID is its device_type_id. A device type has its own configurations (configurations), such as a URDF or a bill of materials that applies to every device of that type, and its own description, metadata and tags. Devices inherit none of the type’s description, metadata or tags. A device’s configurations listed with include_inherited=True (list_files()) include its type’s configurations beside its own.
Device type IDs (dt_...) are assigned by Roboto; the name is user-provided and unique within the org.
Usage
Give every device of a type the same URDF, then read it back from one device:
import pathlib
from roboto import Device, DeviceType
device_type = DeviceType.create(name="mk2", description="Second-generation arm")
device_type.configurations.upload_file(pathlib.Path("/path/to/mk2.urdf"), "mk2.urdf")
device = Device.from_id("robot_001").set_device_type(device_type.device_type_id)
for file in device.configurations.list_files(include_inherited=True):
print(file.relative_path, file.association.is_device_type)
# mk2.urdf TrueParameters
roboto_client Optional[roboto.Properties
DeviceType.configurations
Files that apply to every device of the type, such as a URDF.
DeviceType.create()
Create a device type in an organization.
Parameters
name strName of the device type, unique within the organization.
description Optional[str]Optional free-text description of the device type.
metadata Optional[dict[str, Any]]Optional key-value pairs to associate with the device type.
tags Optional[list[str]]Optional tags to associate with the device type.
caller_org_id Optional[str]The organization to create the device type in. If not specified and the caller belongs to only one organization, that organization will be used. Required if the caller belongs to multiple organizations.
roboto_client Optional[roboto.Optional RobotoClient instance for API communication. If not provided, the default client configuration will be used.
Returns
The newly created device type.
Raises
The organization already has a device type with this name.
Device types are not enabled for the organization.
The caller lacks permission to manage devices in the organization.
Usage
device_type = DeviceType.create(name="mk2", description="Second-generation arm", tags=["arm"])
device_type.device_type_id
# 'dt_abc123'DeviceType.delete()
Delete this device type.
Refused while any device is of this type; reassign or clear those devices’ types first. The device type’s configurations (configurations) are deleted with it, every version of each file, shortly after this call returns. Links elsewhere that point at those files stop working. Deleting a device type that no longer exists succeeds.
Raises
At least one device is of this type.
Device types are not enabled for the organization.
The caller lacks permission to delete this device type.
Return type
Usage
device_type = DeviceType.from_id("dt_abc123")
device_type.delete()Properties
DeviceType.description
Free-text description of this device type.
DeviceType.device_count
Number of devices of this device type, counted when Roboto returned this device type.
The count does not follow devices added or removed later; call from_id() for a current count.
DeviceType.device_type_id
This device type’s Roboto-assigned dt_ ID, unique across all orgs and never changed.
DeviceType.devices()
List the devices that are of this device type, newest first.
Yields
Each device of this type, fetched a page at a time.
Raises
Device types are not enabled for the organization.
The caller lacks permission to view this device type, or to manage devices in its org.
Return type
Usage
device_type = DeviceType.from_id("dt_abc123")
for device in device_type.devices():
print(device.device_id)
# robot_002
# robot_001DeviceType.for_org()
List an organization’s device types, newest first.
Parameters
org_id strThe organization ID to list device types for.
roboto_client Optional[roboto.Optional RobotoClient instance for API communication. If not provided, the default client configuration will be used.
Yields
Each of the organization’s device types, fetched a page at a time.
Raises
Device types are not enabled for the organization.
The caller lacks permission to manage devices in the organization.
Return type
Usage
for device_type in DeviceType.for_org("og_abc123"):
print(device_type.name)
# mk3
# mk2DeviceType.from_id()
Retrieve a device type by its ID.
Parameters
device_type_id strThe Roboto-assigned dt_ ID of the device type, not its name.
roboto_client Optional[roboto.Optional RobotoClient instance for API communication. If not provided, the default client configuration will be used.
org_id Optional[str]The organization that owns the device type. If not specified and the caller belongs to only one organization, that organization will be used. Required if the caller belongs to multiple organizations.
Returns
The device type.
Raises
Device types are not enabled for the organization.
The organization has no device type with this ID.
The caller lacks permission to view the device type.
Usage
device_type = DeviceType.from_id("dt_abc123", org_id="og_abc123")
device_type.name
# 'mk2'Properties
DeviceType.metadata
Key-value metadata pairs associated with this device type.
DeviceType.modified
The timestamp when this device type was last modified.
DeviceType.modified_by
The user ID of the person who last modified this device type.
DeviceType.record
Underlying DeviceTypeRecord for this device type.
This is the raw record as returned by Roboto and may evolve over time; prefer the public DeviceType API unless you need direct access to the record.
DeviceType.update()
Update this device type’s name, description, metadata or tags.
Parameters
The changes to apply. Fields left at their defaults change nothing.
Returns
Updated DeviceType instance with the changes applied.
Raises
The new name is already taken by another device type in the org.
Device types are not enabled for the organization.
The caller lacks permission to edit this device type.
Usage
Rename a device type and clear its description:
from roboto import UpdateDeviceTypeRequest
device_type = DeviceType.from_id("dt_abc123")
device_type = device_type.update(UpdateDeviceTypeRequest(name="mk2-rev-b", description=None))DeviceTypeRecord
Bases: pydantic.BaseModel
A device type as returned by Roboto.
Parameters
data AnyAttributes
DeviceTypeRecord.description
Free-text description of this device type.
DeviceTypeRecord.device_count
Number of devices of this device type, counted when Roboto returned this record.
DeviceTypeRecord.device_type_id
A Roboto-assigned identifier for this device type (dt_...), unique across all orgs and never changed.
DeviceTypeRecord.metadata
Key-value metadata pairs associated with this device type.
DeviceTypeRecord.modified
Date/time when this device type was last modified.
UpdateDeviceTypeRequest
Bases: pydantic.BaseModel
Request body for PUT /v1/device-types/id/<device_type_id>.
Fields left at their defaults change nothing.
Parameters
data AnyAttributes
UpdateDeviceTypeRequest.description
New description. None clears it.
UpdateDeviceTypeRequest.metadata_changeset
Metadata fields and tags to add, change, or remove.
UpdateDeviceTypeRequest.model_config
model_config #Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
UpdateDeviceTypeRequest.name
New name for the device type, unique within its org. Cannot be cleared.