Robotics & Hardware Abstraction Layer
Overview
Bridge AI agents with physical robotics hardware
The Hardware Abstraction Layer (HAL) provides a unified interface for controlling sensors, actuators, and robotics hardware. It enables AI agents to interact with physical devices through a consistent API, supporting multiple hardware backends, real-time sensor data streaming, and emergency stop capabilities for safe operation.
Core Components
Hardware Abstraction Layer
Unified interface for all hardware components
- • Sensor registration and management
- • Actuator control with safety limits
- • Emergency stop (E-Stop) functionality
- • Real-time data streaming via GenStage
Sensor Interface
Standardized sensor behaviour and callbacks
- • @callback read() :: :ok, value | :error, reason
- • @callback calibrate() :: :ok | :error, reason
- • @callback get_metadata() :: map()
- • Support for camera, lidar, imu, encoder types
Actuator Interface
Control interface for motors, servos, grippers
- • @callback set_state(state) :: :ok | :error, reason
- • @callback get_state() :: :ok, state
- • @callback emergency_stop() :: :ok
- • Safety limits and validation built-in
API Endpoints
/api/v1/robotics/hal/sensors
Register a new sensor with the HAL.
{
"sensor_id": "lidar_front",
"type": "lidar",
"config": {
"update_rate_hz": 10,
"frame_id": "base_link"
},
"metadata": {
"manufacturer": "RPLidar",
"model": "A2"
}
}
/api/v1/robotics/hal/actuators
Register a new actuator with the HAL.
/api/v1/robotics/hal/actuators/:id/state
Set actuator state with safety validation.
{
"state": {
"position": 1.57,
"velocity": 0.5
},
"safety_check": true
}
/api/v1/robotics/hal/emergency_stop
Trigger emergency stop for all actuators.
/api/v1/robotics/hal/status
Get overall HAL status including all sensors and actuators.