Go-based Telemetry Toolkit
Find a file
saji 900ad6d495
All checks were successful
release / release-full (push) Successful in 8m25s
release build correct package
2024-03-09 09:15:01 -06:00
.github/workflows release build correct package 2024-03-09 09:15:01 -06:00
cmd got realtime working 2024-03-08 11:51:59 -06:00
internal add JSON line parser, rename logparsers 2024-03-07 13:30:15 -06:00
migrations hack: remove faulty table from old migration 2024-03-06 15:16:13 -06:00
py move parsers to internal library 2024-02-12 14:38:01 -06:00
skylab cleanup comparison (thanks staticcheck) 2024-03-07 23:52:41 -06:00
socketcan fix socketcan bugs 2024-03-07 15:06:16 -06:00
web remove unused variable 2024-03-08 22:00:18 -06:00
xbee format 2024-03-07 06:18:49 -06:00
.gitignore update gitignore for WAL mode sqlite db 2024-03-02 21:56:31 -06:00
broker.go tests! 2024-03-07 23:02:46 -06:00
broker_test.go move openmct plugin to typescript 2024-03-08 17:08:43 -06:00
db.go revert order by change 2024-03-08 09:40:54 -06:00
db_test.go more tests! added BusEvent.Equals 2024-03-07 23:50:13 -06:00
go.mod support 1.21, add matrix for 1.21 and 1.22 in CI 2024-02-28 14:17:47 -06:00
go.sum fix up static check issues 2024-02-28 14:10:40 -06:00
http.go got realtime working 2024-03-08 11:51:59 -06:00
http_test.go revert order by change 2024-03-08 09:40:54 -06:00
migration.go combine separate packages 2024-03-02 21:49:18 -06:00
migration_test.go combine separate packages 2024-03-02 21:49:18 -06:00
openmct.go format 2024-03-07 06:18:49 -06:00
readme.md add orderby clause 2024-03-06 10:48:40 -06:00

GoTelem: Golang-based telemetry tools

GoTelem is a toolkit and library to make working with solar car telemetry data fast, reliable, and insightful.

Features:

  • SocketCAN interface for connecting to physical hardware.
  • TCP streaming system based around MessagePack-RPC for LAN control/inspection.
  • XBee integration and control for long-range communication.
  • HTTP API for easy external tool integration.
  • SQLite database format for storing telemetry, and tools to work with it.

GoTelem provides a flexible system for ingesting, storing, analyzing, and distributing telemetry information.

Rationale

There are probably two questions:

  1. What's this for?
  2. Why is it written in Go?

Telemetry is an interesting system since it not only involves a microcontroller on the car acting as a transmitter, it also requires software running on a laptop that can recieve the data and do useful things with it. Previous iterations of this PC software usually involved Python scripts that were thrown together quickly due to time constraints. This has a few problems, namely that performance is usually limited, APIs are not type-safe, and environments are not portable and require setup.

So we aught to invest in better tooling - schemas and programs that make working with the data we collect easier and more consistent, as well as being the standard. This tool/repo aims to package several ideas and utilities into a single, all-in-one binary. While that's a noble goal, design decisions are being made to support long-term evolution of software; we have versioned SQLite databases, that are entirely standalone.

I chose to write this in Go because Go has good concurrency support, good cross-compilation, and relatively good performance, especially when compared to interpreted languages.

C/C++ was eliminated due to being too close to the metal and having bad tooling/cross compilation.

Python was eliminated due to having poor concurrency support and difficult packaging/distribution. It also lacks a good http/networking story, instead relying on WSGI/ASGI packages which make Windows not viable. Futhermore, being dynamically typed leads to issues in asserting robustness of the code.

Rust was elminiated due to being too different from more common programming languages. Likewise for F#, C#, D, Zig, Nim, Julia, Racket, Elixr, and Common Lisp. Yes, I did seriouisly consider each of these. C# was a viable competitor but had issues with the cross-platform story.

Go has some quirks and -isms, like lacking "true" Object-Orientation, but the language is designed around being normal to look at, easy to write, and straightforward to understand.

Go has really good cross compilation support built in to the go binary. However, since this package uses some C libraries (SQLite), certain functionality will be missing if you don't have a cross-compiler set up. There's a way to make things easier on Linux using zig cc but this is not usually important since the user can pretty easily compile it on their own system, and it's a single executable to share to others with the same OS/architecture.

Building

gotelem was designed to be all-inclusive while being easy to build and have good cross-platform support. Binaries are a single, statically linked file that can be shared to other users of the same OS. Certain features, like socketCAN support, are only enabled on platforms that support them (Linux). This is handled automatically; builds will exclude the socketCAN files and the additional commands and features will not be present in the CLI.

Lightweight Build

This doesn't include the OpenMCT files, but is simpler to build, and doesn't require Node setup. You must install Go.

$ go build ./cmd/gotelem

Full Build

This includes an integrated OpenMCT build, which automatically connects to the Telemetry server for historical and live data. You must have both Go and Node.JS installed.

$ cd web/
$ npm install
$ npm run build
$ cd ..
$ go build -tags openmct ./cmd/gotelem

Development

During development, it can be useful to have the OpenMCT sources be served separately from Gotelem, so you don't need to rebuild everything. This case is supported:

$ go run ./cmd/gotelem server --db gotelem.db # in one terminal
$ npm run serve # in a separate terminal

When using the dev server, webpack will set the Gotelem URL to localhost:8080. If you're running Gotelem using the default settings, this should work out of the box. Making changes to the OpenMCT plugins will trigger a refresh automatically.