$ show hybridgroup/gobot
Gobot is a Go framework for robotics, physical computing, and the Internet of Things. It provides a consistent hardware abstraction layer (HAL) over dozens of single-board computers (Raspberry Pi, BeagleBone, Intel Edison, Jetson, etc.), microcontrollers (Arduino via Firmata, Digispark), and communication protocols (GPIO, I2C, SPI, BLE, serial, MQTT, NATS, MAVLink). The architecture is modular: platform-specific adaptors implement core interfaces (DigitalPinner, PWMPinner, I2cBusAdaptor, etc.) and are composed from reusable building blocks in the `platforms/adaptors` package. Drivers for sensors, actuators, displays, and robots (Sphero, Parrot drones, DJI Tello, GoPiGo3) are organized by bus type (gpio, i2c, spi, ble, aio, onewire, serial) and share a common lifecycle pattern with event publishing and command registration. A built-in HTTP API server (with optional basic auth and CORS) exposes robot state and commands over REST and Server-Sent Events, and includes an embedded web UI (Robeaux). The framework supports both high-level orchestration via `Robot` and `Manager` and low-level 'metal' usage for direct hardware control. External dependencies include `periph.io` for GPIO, `tinygo.org/x/bluetooth` for BLE, `gocv.io/x/gocv` for computer vision, and `go.bug.st/serial` for serial communication. The codebase is extensively tested with mock filesystem and syscall infrastructure, and uses functional options for configuration throughout.
The LLM identified 4 files worth highlighting for reuse:
Provides a unified `Accesser` interface for low-level Linux hardware access (sysfs and cdev GPIO, I2C, SPI, PWM, analog, 1-wire) with mockable filesystem and syscall backends. This enables thorough unit testing of all platform adaptors and drivers without real hardware. The design is clean, isolated, and could be extracted as a standalone library for any Go project needing mockable Linux device access.
Implements a reusable `DigitalPinsAdaptor` that platform adaptors can embed to gain digital pin control. It uses functional options (`WithDigitalPinTranslator`, `WithDigitalPinDefinitions`) for configuration and delegates to a `DigitalPinTranslator` for board-specific pin mapping. This composable pattern is used by all major platform adaptors (Raspberry Pi, Tinker Board, etc.) and demonstrates clean separation of concerns.
Contains shared packet types, checksum calculation, and command IDs used by both BLE and serial Sphero drivers. This avoids duplication across transport layers and provides a single source of truth for the Sphero protocol. The packet crafting logic is self-contained and could be reused in any Go project that communicates with Sphero devices.
Implements an HTTP API server that exposes robot state, device commands, and event streams over REST and Server-Sent Events. It includes optional basic authentication, CORS support, and an embedded Robeaux web interface. The API is built on top of the `gobot.Manager` and provides a generic control plane for any robot configuration. This component is standalone and could be extracted as a reusable web interface for IoT frameworks.