Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

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

class roboto.domain.device_types.CreateDeviceTypeRequest(/, **data)#View Source

Bases: pydantic.BaseModel

Request body for POST /v1/device-types/create, which creates a device type in the caller’s org.

Parameters

data Any

Attributes

CreateDeviceTypeRequest.description

description str | None = None #

Free-text description of the device type.

CreateDeviceTypeRequest.metadata

metadata dict[str, Any] = None #

Initial key-value metadata pairs to associate with the device type.

CreateDeviceTypeRequest.name

name str #

Name of the device type, unique within the org.

CreateDeviceTypeRequest.tags

tags list[str] = None #

Initial tags to associate with the device type.

DeviceType

class roboto.domain.device_types.DeviceType(record, roboto_client=None)#View Source

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 True

Properties

DeviceType.configurations

Files that apply to every device of the type, such as a URDF.

DeviceType.create()

classmethod create(name, description=None, metadata=None, tags=None, caller_org_id=None, roboto_client=None)#View Source

Create a device type in an organization.

Parameters

name str

Name 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.http.RobotoClient]

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'

Properties

DeviceType.created

created datetime.datetime #

The timestamp when this device type was created.

Return type: datetime.datetime

DeviceType.created_by

created_by str #

The user ID of the person who created this device type.

Return type: str

DeviceType.delete()

delete()#View Source

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

None

Usage

device_type = DeviceType.from_id("dt_abc123")
device_type.delete()

Properties

DeviceType.description

description str | None #

Free-text description of this device type.

Return type: Optional[str]

DeviceType.device_count

device_count int #

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.

Return type: int

DeviceType.device_type_id

device_type_id str #

This device type’s Roboto-assigned dt_ ID, unique across all orgs and never changed.

Return type: str

DeviceType.devices()

devices()#View Source

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

collections.abc.Generator[roboto.domain.devices.Device, None, None]

Usage

device_type = DeviceType.from_id("dt_abc123")
for device in device_type.devices():
    print(device.device_id)
# robot_002
# robot_001

DeviceType.for_org()

classmethod for_org(org_id, roboto_client=None)#View Source

List an organization’s device types, newest first.

Parameters

org_id str

The organization ID to list device types for.

roboto_client Optional[roboto.http.RobotoClient]

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

collections.abc.Generator[DeviceType, None, None]

Usage

for device_type in DeviceType.for_org("og_abc123"):
    print(device_type.name)
# mk3
# mk2

DeviceType.from_id()

classmethod from_id(device_type_id, roboto_client=None, org_id=None)#View Source

Retrieve a device type by its ID.

Parameters

device_type_id str

The Roboto-assigned dt_ ID of the device type, not its name.

roboto_client Optional[roboto.http.RobotoClient]

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

metadata dict[str, Any] #

Key-value metadata pairs associated with this device type.

Return type: dict[str, Any]

DeviceType.modified

modified datetime.datetime #

The timestamp when this device type was last modified.

Return type: datetime.datetime

DeviceType.modified_by

modified_by str #

The user ID of the person who last modified this device type.

Return type: str

DeviceType.name

name str #

This device type’s name, unique within its org.

Return type: str

DeviceType.org_id

org_id str #

The ID of the org to which this device type belongs.

Return type: str

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.tags

tags list[str] #

List of tags associated with this device type.

Return type: list[str]

DeviceType.update()

update(request)#View Source

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

class roboto.domain.device_types.DeviceTypeRecord(/, **data)#View Source

Bases: pydantic.BaseModel

A device type as returned by Roboto.

Parameters

data Any

Attributes

DeviceTypeRecord.created

created datetime.datetime #

Date/time when this device type was created.

DeviceTypeRecord.created_by

created_by str #

The user who created this device type.

DeviceTypeRecord.description

description str | None = None #

Free-text description of this device type.

DeviceTypeRecord.device_count

device_count int #

Number of devices of this device type, counted when Roboto returned this record.

DeviceTypeRecord.device_type_id

device_type_id str #

A Roboto-assigned identifier for this device type (dt_...), unique across all orgs and never changed.

DeviceTypeRecord.metadata

metadata dict[str, Any] = None #

Key-value metadata pairs associated with this device type.

DeviceTypeRecord.modified

modified datetime.datetime #

Date/time when this device type was last modified.

DeviceTypeRecord.modified_by

modified_by str #

The user who last modified this device type.

DeviceTypeRecord.name

name str #

A user-provided name for this device type, unique within its org.

DeviceTypeRecord.org_id

org_id str #

The org to which this device type belongs.

DeviceTypeRecord.tags

tags list[str] = None #

List of tags associated with this device type.

UpdateDeviceTypeRequest

class roboto.domain.device_types.UpdateDeviceTypeRequest(/, **data)#View Source

Bases: pydantic.BaseModel

Request body for PUT /v1/device-types/id/<device_type_id>.

Fields left at their defaults change nothing.

Parameters

data Any

Attributes

UpdateDeviceTypeRequest.description

description str | roboto.sentinels.NotSetType | None #

New description. None clears it.

UpdateDeviceTypeRequest.metadata_changeset

metadata_changeset roboto.updates.MetadataChangeset | None = None #

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.

Was this page helpful?