viam.components.arm.service

Classes

DoCommandRequest

DoCommandRequest represents a generic DoCommand input

DoCommandResponse

DoCommandResponse represents a generic DoCommand output

GetGeometriesRequest

Abstract base class for protocol messages.

GetGeometriesResponse

Abstract base class for protocol messages.

GetKinematicsRequest

Abstract base class for protocol messages.

GetKinematicsResponse

Abstract base class for protocol messages.

ArmServiceBase

Helper class that provides a standard way to create an ABC using

GetEndPositionRequest

Abstract base class for protocol messages.

GetEndPositionResponse

Abstract base class for protocol messages.

GetJointPositionsRequest

Abstract base class for protocol messages.

GetJointPositionsResponse

Abstract base class for protocol messages.

IsMovingRequest

Abstract base class for protocol messages.

IsMovingResponse

Abstract base class for protocol messages.

MoveToJointPositionsRequest

Abstract base class for protocol messages.

MoveToJointPositionsResponse

Abstract base class for protocol messages.

MoveToPositionRequest

Moves an arm to the specified pose that is within the reference frame of the arm.

MoveToPositionResponse

Abstract base class for protocol messages.

StopRequest

Abstract base class for protocol messages.

StopResponse

Abstract base class for protocol messages.

ResourceRPCServiceBase

Base RPC service for a resource.

ArmRPCService

gRPC Service for an Arm

Functions

dict_to_struct(→ google.protobuf.struct_pb2.Struct)

struct_to_dict(→ Dict[str, ValueTypes])

Module Contents

class viam.components.arm.service.DoCommandRequest(*, name: str = ..., command: google.protobuf.struct_pb2.Struct | None = ...)

Bases: google.protobuf.message.Message

DoCommandRequest represents a generic DoCommand input

name: str
property command: google.protobuf.struct_pb2.Struct
HasField(field_name: Literal['command', b'command']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.DoCommandResponse(*, result: google.protobuf.struct_pb2.Struct | None = ...)

Bases: google.protobuf.message.Message

DoCommandResponse represents a generic DoCommand output

property result: google.protobuf.struct_pb2.Struct
HasField(field_name: Literal['result', b'result']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.GetGeometriesRequest(*, name: str = ..., extra: google.protobuf.struct_pb2.Struct | None = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

name: str

The component name

property extra: google.protobuf.struct_pb2.Struct

Additional arguments to the method

HasField(field_name: Literal['extra', b'extra']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.GetGeometriesResponse(*, geometries: collections.abc.Iterable[global___Geometry] | None = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

property geometries: google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Geometry]

All geometries associated with the component, in their current configuration, in the frame of that component.

class viam.components.arm.service.GetKinematicsRequest(*, name: str = ..., extra: google.protobuf.struct_pb2.Struct | None = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

name: str

The component name

property extra: google.protobuf.struct_pb2.Struct

Additional arguments to the method

HasField(field_name: Literal['extra', b'extra']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.GetKinematicsResponse(*, format: global___KinematicsFileFormat = ..., kinematics_data: bytes = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

format: global___KinematicsFileFormat

The kinematics of the component, in either URDF format or in Viam’s kinematic parameter format (spatial vector algebra) https://docs.viam.com/internals/kinematic-chain-config/#kinematic-parameters

kinematics_data: bytes

The byte contents of the file

class viam.components.arm.service.ArmServiceBase[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract GetEndPosition(stream: grpclib.server.Stream[component.arm.v1.arm_pb2.GetEndPositionRequest, component.arm.v1.arm_pb2.GetEndPositionResponse]) None[source]
Async:

abstract MoveToPosition(stream: grpclib.server.Stream[component.arm.v1.arm_pb2.MoveToPositionRequest, component.arm.v1.arm_pb2.MoveToPositionResponse]) None[source]
Async:

abstract GetJointPositions(stream: grpclib.server.Stream[component.arm.v1.arm_pb2.GetJointPositionsRequest, component.arm.v1.arm_pb2.GetJointPositionsResponse]) None[source]
Async:

abstract MoveToJointPositions(stream: grpclib.server.Stream[component.arm.v1.arm_pb2.MoveToJointPositionsRequest, component.arm.v1.arm_pb2.MoveToJointPositionsResponse]) None[source]
Async:

abstract Stop(stream: grpclib.server.Stream[component.arm.v1.arm_pb2.StopRequest, component.arm.v1.arm_pb2.StopResponse]) None[source]
Async:

abstract IsMoving(stream: grpclib.server.Stream[component.arm.v1.arm_pb2.IsMovingRequest, component.arm.v1.arm_pb2.IsMovingResponse]) None[source]
Async:

abstract DoCommand(stream: grpclib.server.Stream[common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse]) None[source]
Async:

abstract GetKinematics(stream: grpclib.server.Stream[common.v1.common_pb2.GetKinematicsRequest, common.v1.common_pb2.GetKinematicsResponse]) None[source]
Async:

abstract GetGeometries(stream: grpclib.server.Stream[common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse]) None[source]
Async:

__mapping__() Dict[str, grpclib.const.Handler][source]
class viam.components.arm.service.GetEndPositionRequest(*, name: str = ..., extra: google.protobuf.struct_pb2.Struct | None = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

name: str

Name of an arm

property extra: google.protobuf.struct_pb2.Struct

Additional arguments to the method

HasField(field_name: Literal['extra', b'extra']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.GetEndPositionResponse(*, pose: viam.gen.common.v1.common_pb2.Pose | None = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

property pose: viam.gen.common.v1.common_pb2.Pose

Returns 6d pose of the end effector relative to the base, represented by X,Y,Z coordinates which express millimeters and theta, ox, oy, oz coordinates which express an orientation vector

HasField(field_name: Literal['pose', b'pose']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.GetJointPositionsRequest(*, name: str = ..., extra: google.protobuf.struct_pb2.Struct | None = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

name: str

Name of an arm

property extra: google.protobuf.struct_pb2.Struct

Additional arguments to the method

HasField(field_name: Literal['extra', b'extra']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.GetJointPositionsResponse(*, positions: global___JointPositions | None = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

property positions: global___JointPositions

a list JointPositions

HasField(field_name: Literal['positions', b'positions']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.IsMovingRequest(*, name: str = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

name: str
class viam.components.arm.service.IsMovingResponse(*, is_moving: bool = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

is_moving: bool
class viam.components.arm.service.MoveToJointPositionsRequest(*, name: str = ..., positions: global___JointPositions | None = ..., extra: google.protobuf.struct_pb2.Struct | None = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

name: str

Name of an arm

property positions: global___JointPositions

A list of joint positions There should be 1 entry in the list per joint DOF, ordered spatially from the base toward the end effector

property extra: google.protobuf.struct_pb2.Struct

Additional arguments to the method

HasField(field_name: Literal['extra', b'extra', 'positions', b'positions']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.MoveToJointPositionsResponse

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

class viam.components.arm.service.MoveToPositionRequest(*, name: str = ..., to: viam.gen.common.v1.common_pb2.Pose | None = ..., extra: google.protobuf.struct_pb2.Struct | None = ...)

Bases: google.protobuf.message.Message

Moves an arm to the specified pose that is within the reference frame of the arm. Move request in Motion API has the same behavior except that it performs obstacle avoidance when a world_state message is specified.

name: str

Name of an arm

property to: viam.gen.common.v1.common_pb2.Pose

The destination to move the arm to; this is from the reference frame of the arm.

property extra: google.protobuf.struct_pb2.Struct

Additional arguments to the method

HasField(field_name: Literal['extra', b'extra', 'to', b'to']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.MoveToPositionResponse

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

class viam.components.arm.service.StopRequest(*, name: str = ..., extra: google.protobuf.struct_pb2.Struct | None = ...)

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

name: str

Name of an arm

property extra: google.protobuf.struct_pb2.Struct

Additional arguments to the method

HasField(field_name: Literal['extra', b'extra']) bool

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

class viam.components.arm.service.StopResponse

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

class viam.components.arm.service.ResourceRPCServiceBase(manager: viam.resource.manager.ResourceManager)[source]

Bases: abc.ABC, viam.rpc.types.RPCServiceBase, Generic[viam.resource.manager.ResourceType]

Base RPC service for a resource. All resource RPC services must inherit from this class.

RESOURCE_TYPE
manager: viam.resource.manager.ResourceManager
get_resource(name: str) viam.resource.manager.ResourceType[source]

Return the resource with the given name if it exists in the registry. If the resource does not exist in the registry, this function will raise an error

Parameters:

name (str) – Name of the resource

Raises:

GRPCError with the status code Status.NOT_FOUND

Returns:

The resource

Return type:

ResourceType

viam.components.arm.service.dict_to_struct(obj: Mapping[str, ValueTypes]) google.protobuf.struct_pb2.Struct[source]
viam.components.arm.service.struct_to_dict(struct: google.protobuf.struct_pb2.Struct) Dict[str, ValueTypes][source]
class viam.components.arm.service.ArmRPCService(manager: viam.resource.manager.ResourceManager)[source]

Bases: viam.proto.component.arm.ArmServiceBase, viam.resource.rpc_service_base.ResourceRPCServiceBase[viam.components.arm.arm.Arm]

gRPC Service for an Arm

RESOURCE_TYPE
async GetEndPosition(stream: grpclib.server.Stream[viam.proto.component.arm.GetEndPositionRequest, viam.proto.component.arm.GetEndPositionResponse]) None[source]
async MoveToPosition(stream: grpclib.server.Stream[viam.proto.component.arm.MoveToPositionRequest, viam.proto.component.arm.MoveToPositionResponse]) None[source]
async GetJointPositions(stream: grpclib.server.Stream[viam.proto.component.arm.GetJointPositionsRequest, viam.proto.component.arm.GetJointPositionsResponse]) None[source]
async MoveToJointPositions(stream: grpclib.server.Stream[viam.proto.component.arm.MoveToJointPositionsRequest, viam.proto.component.arm.MoveToJointPositionsResponse]) None[source]
async Stop(stream: grpclib.server.Stream[viam.proto.component.arm.StopRequest, viam.proto.component.arm.StopResponse]) None[source]
async IsMoving(stream: grpclib.server.Stream[viam.proto.component.arm.IsMovingRequest, viam.proto.component.arm.IsMovingResponse]) None[source]
async DoCommand(stream: grpclib.server.Stream[viam.proto.common.DoCommandRequest, viam.proto.common.DoCommandResponse]) None[source]
async GetKinematics(stream: grpclib.server.Stream[viam.proto.common.GetKinematicsRequest, viam.proto.common.GetKinematicsResponse]) None[source]
async GetGeometries(stream: grpclib.server.Stream[viam.proto.common.GetGeometriesRequest, viam.proto.common.GetGeometriesResponse]) None[source]