Project Structure

Hedgehog’s source files are divided into several repositories hosted on GitHub. This page shortly describes their roles and relations to each other.

Hardware

Hedgehog_PCB
KiCad schematics and layouts of Hedgehog’s hardware controller.

HWC Software & Tools

HedgehogFirmware
Firmware to run on the HWC’s STM32 microcontroller, written in C.
HedgehogHWCFlasher
A simple Python program for flashing the HWC microcontroller with binaries. It uses HedgehogPlatform To determine how to connect to the microcontroller, i.e. what interface to use and how to reset the microcontroller.

Common Python Packages

HedgehogUtils
Collection of Python utilities for Hedgehog, but not specific to a particular part of the software. Utilities are mostly for Protocol Buffers and ZeroMQ, additionally there is a stand-alone discovery component building on both.
HedgehogPlatform

Python library that detects the “platform” that Hedgehog software is run on, i.e. the kind of software controller used, and provides platform independent interfaces on top of features that differ by platform. Right now, the only feature that is abstracted in this way is access to the HWC, used by HedgehogHWCFlasher and HedgehogServer.

The only platform that is currently used for Hedgehog is the Raspberry Pi 3. In the past, an Orange Pi 2 was used instead. As there is only one platform in use at the moment, and it is hard to anticipate what platform differences may arise, this repository’s code is currently somewhat stale.

HedgehogProtocol

Contains protocol buffers definitions and Python classes for the Hedgehog Protocol. In addition to the classes generated from the protobuf definition, this repository contains:

  • Exception classes that correspond to error acknowledgement codes
  • Wrapper classes that correspond to Hedgehog protocol messages: a single protobuf message type may correspond to multiple Hedgehog message types; for example, sensor requests and sensor replies are transported as the same message type. The wrapper classes convey what Hedgehog message is represented, and provide message-specific validation.
  • helpers for working with Hedgehog protocol messages over ZeroMQ sockets, such as sockets that encode and decode single- or multipart messages.

HedgehogProtocol depends on HedgehogUtils for its ZeroMQ and Protobuf capabilities.

Server Software

HedgehogServer
Serves clients that use the Hedgehog protocol. The server is written in Python and builds on HedgehogProtocol. To handle client requests, the server communicates with the HWC, utilizing HedgehogPlatform to determine how to do that. HedgehogUtils’ discovery mechanism is used for advertising the controller to its peers.
hedgehog-ide
Hedgehog’s web IDE. The server part uses Node.js, the browser side Angular 4; both parts are written in TypeScript. To communicate with the HedgehogServer, HedgehogNodeClient is used.

Client Software

HedgehogClient
Python client library for Hedgehog. The library builds on top of HedgehogProtocol, and uses HedgehogUtils’ discovery mechanism for finding controllers.
HedgehogNodeClient
Node.js client library for Hedgehog. At the moment, this library also includes the protocol implementation for Node.js. The hedgehog-ide uses this to communicate to the HedgehogServer.

Miscellaneous

Hedgehog
Contains this documentation, and also a Makefile that serves as the entry point into Hedgehog software installation. Executing the Makefile will clone the HedgehogBundle and install different components.
HedgehogBundle
Bundles installation scripts into one repository. The bundle contains folders for installations of the HWC firmware, server, IDE and client.
HedgehogGui
A desktop Python application based on Kivy for writing and running Python client programs. It is not actively developed, as it was superseded by hedgehog-ide.