Sensor API | Component APIs

Sensor API

The sensor API allows you to get measurements from your sensor components.

The sensor component supports the following methods:

Method Name Description viam-micro-server Support
GetReadings Get the measurements or readings that this sensor provides.
GetGeometries Get all the geometries associated with the sensor in its current configuration, in the frame of the sensor.
Reconfigure Reconfigure this resource.
DoCommand Execute model-specific commands that are not otherwise defined by the component API.
GetResourceName Get the ResourceName for this sensor.
Close Safely shut down the resource and prevent further use.

API

GetReadings

Get the measurements or readings that this sensor provides. Supported by viam-micro-server.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.

Parameters:

Returns:

Example:


For more information, see the Go SDK Docs.

GetGeometries

Get all the geometries associated with the sensor in its current configuration, in the frame of the sensor. The motion and navigation services use the relative position of inherent geometries to configured geometries representing obstacles for collision detection and obstacle avoidance while motion planning.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.

Reconfigure

Reconfigure this resource. Reconfigure must reconfigure the resource atomically and in place.

Parameters:

Returns:

For more information, see the Go SDK Docs.

DoCommand

Execute model-specific commands that are not otherwise defined by the component API. Most models do not implement DoCommand. Any available model-specific commands should be covered in the model’s documentation. If you are implementing your own sensor and want to add features that have no corresponding built-in API method, you can implement them with DoCommand.

Parameters:

Returns:

Raises:

Example:


For more information, see the Python SDK Docs.

GetResourceName

Get the ResourceName for this sensor.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.

Close

Safely shut down the resource and prevent further use.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.