Hardware Abstraction Layer (HAL)
硬件抽象层HALAdvancedA layer of code that hides specific hardware differences and exposes a uniform interface to the software above it.
A hardware abstraction layer is a common design pattern in operating systems and software engineering: a uniform interface is placed between specific hardware — motor drivers, cameras, sensors — and the higher-level program, so the upper layer only calls standard functions like “read joint angle” or “send torque command” without caring whether the bus underneath is CAN or EtherCAT, or which vendor's motor it is. That way, switching hardware only requires changing or adding this one layer, leaving the control algorithms and policy code untouched. In robotics, ROS 2's ros2_control implements exactly this through “hardware interface” plugins; embodied models aiming for “one brain, many bodies” — the same policy running on different robot bodies — also can't do without a clean HAL.
ExampleWriting a hardware interface plugin for a particular arm model in ros2_control lets MoveIt and controllers above it drive that arm directly.
- Related
- ros2_control · Driver (Device Driver) · Software Development Kit · Secondary Development (custom development on SDK) · One Brain, Multiple Robots
- Sources
- Hardware abstraction - Wikipedia
ros2_control 官方文档 (Chinese)