Skip to main content

title: Polhemus Fastrak Serial Driver authors:

  • joe_starr

License: MIT White Logo image{width=10%}

hero{width=40%}

/// caption

///

Note to Reader

What Am I?

This repository contains an opinionated python serial driver for the Polhemus Fastrak. In this context opinionated means initializes the Fastrak for a specific use case. We however supply interfaces for all serial commands for the Fastrak.

About the Documentation

The following document describes the "rules" and expectation for development. The "Code Comments" page contains the technical context descriptions found in the source files. The "Use Cases" page contains a collection of use cases and a use case diagram for the tool. The "Decisions" page contains a collection of architectural decision records [@Kopp2018] giving context on why this tool is the way it is.

Issues

If you discover an issue with this repository or have a question, please feel free to open an issue. I've included templates for the following issues:

  • 🖋️ Spelling and Grammar: Found some language that is incorrect?
  • 🤷 Clarity: Found a section that just makes no sense?
  • ❓ Question: Do you have a general question?
  • 🐞 Bug: Found an error in the code?
  • 🚀 Enhancement: Have a suggestion for improving the toolchain?

:fontawesome-solid-paper-plane: Open Issue!{ .md-button }

📃 Cite Me

⚖️ License

Documentation: License: CC BY-SA 4.0

Code: License: MIT

Planning and Administration

Tasks

Tasks are tracked as GitHub issues.

Version Control

The toolchain shall be kept under Git versioning. Development shall take place on branches with main on GitHub as a source of truth. GitHub pull requests shall serve as the arbiter for inclusion on main with the following quality gates:

  • Running and passing the unit test suite.
  • Running and passing linting and style enforcers.
  • Successful generation of documentation.

Release Tagging

The project shall be tagged when a new feature or bug fix is merged into main. The tag shall follow semantic versioning for labels.

vMAJOR.MINOR.PATCH

Project Structure

Files and directories shall be lower case, where capital is not required by a tool, and contain no ' '.

📁 .
├── 📁 .github
│   ├── 📁 ISSUE_TEMPLATE
│   ├── 📁 PULL_REQUEST_TEMPLATE
│   ├── 📁 workflows
│   └── 📝 pull_request_template.md
├── 📁 .vscode
│   └── ⚙️ launch.json
├── 📁 docs
│   ├── 📁 content
│   ├── 📁 infra
│   └── 📖 README.md
├── 📁 src 
│   └── 🐍 __init__.py
├── ⚙️ .editorconfig
├── 🙈 .gitignore
├── 🛠️ .pre-commit-config.yaml
├── ⚙️ .rumdl.toml
├── ❄️ flake.lock
├── ❄️ flake.nix
├── 🛠️ Justfile
├── 📜 LICENSE
├── 📄 mkdocs.yml
├── 🐍 pyproject.toml
└── 🔒 uv.lock

Directories of Interest

  • docs: This directory contains the high level documentation for the tool.
  • src: This directory contains the source code of the tool.
  • .github: This directory contains the GitHub infrastructure.
  • .vscode: This directory contains the debugger configuration.

Define a Unit

A unit shall be a Python module.

Quality

The tool and its units shall fail-safe, that is the tool and its units can fail, but the failure must be detectable. A segfault is okay, an off by one error that computes the wrong value is not.

Unit Testing

Each internal unit shall have a unit test suite.

Integration Testing

The plugin shall have manual integration testing.

Requirements

Use Cases

Requirements are described as a collection of use cases and actors which are collected into the following use case diagram:

flowchart LR
  aU["👤 User"]
  aT["👤 Time"]

  SC(["Send Command"])
  SRR(["Receive Response"])
  SR(["Start Recording"])
  ER(["End Recording"])
  B(["Boresight"])
  GSR(["Get Single Record"])
  I(["Initialize Device"])
  PD(["Poll Data"])

  aU --> SC
  aU --> SRR 
  aU --> SR 
  aU --> ER 
  aU --> B 
  aU -->  I 
  aU --> GSR 
  aT --> PD 

  SR -. include .->SC
  SR -. include .->B
  SR -. include .->I
  ER -. include .->SC
  GSR -. include .->SRR
  GSR -. include .->SC
Architectural Decisions

Architectural decisions MADR [@Kopp2018] serve as the primary documentation for architectural decisions.

The following is the order of operations for the proposal of a MADR:

  1. Create a branch for a proposal with the name:

    proposal-{{short title}}
    
  2. Create a pull request with this template.

  3. In the branch create a Markdown file based on the MADR Template. Name the Markdown file:

    {{issue# padded to five digits}}-{{title}}
    
  4. When a decision is made change the status to:

    • "accepted" and pull the branch into main branch
    • "rejected" and pull the branch into main branch

Nonfunctional Requirements

Colors

Diagrams included in documentation for features (use case and unit descriptions) are expected to use the COLORS color palette.

Technologies
Languages and Frameworks
  • git
  • Python
  • mermaid.js
  • prek
  • tombi
  • rumdl
  • ruff
  • uv
  • MADR[@Kopp2018]
Documentation of Implementation
Code Style Guide

Python code shall be formatted with ruff using the included style settings. Markdown files shall be formatted with ruff using the included style settings. TOML files shall be formatted with tombi using the included style settings.

Design and Documentation

System

Block Diagram

flowchart LR
    device["FastrakDevice"]
    cwr@{ shape: processes, label: "{{Collection}}<br>Commands with response" }
    cwor@{ shape: processes, label: "{{Collection}}<br>Commands without response" }

    device--> cwr
    device --> cwor 

Class Diagram

classDiagram

    FastrakDevice o-- SerialCommandsWithResp
    FastrakDevice o-- SerialCommands
    FastrakDevice o-- Support 
    FastrakDevice *-- PollStream 
    PollStream o-- Command

    SerialCommandsWithResp o-- Support 
    SerialCommands o-- Support 

    CommandWithResponse --|> Command
    CommandWithResponse <|.. SerialCommandsWithResp
    Command <|.. SerialCommands

    class PollStream{
        + void __init__(baudrate,station,timeout,setup)
        + void stop()
        + void run()
        + bytearray data 
        - serial ser
        - Thread thread
    }
    class FastrakDevice{
        + void __init__(baudrate,station,timeout,setup)
        + void connect()
        + void enableStream()
        + void disableStream()
        + void readLine()
        + void boresight()
        + void basicSetup()
        + void create_valid_device()
        + bytearray data 
        - serial ser
        - FastrakStation station
        - bool running
        - PollStream thread
        - baudrate baud
    }

    class Command{<<interface>>}
    class CommandWithResponse{<<interface>>}
    class Support{<<collection>>}
    class SerialCommands{<<collection>>}
    class SerialCommandsWithResp{<<collection>>}

    note for Support "A collection of enum and data supporting classes."
    note for SerialCommands "A collection of serial commands for the Fastrak."
    note for SerialCommandsWithResp "A collection of serial commands with a response for the Fastrak."

Unit Designs

Unit designs (and test description) for the FastrakDevice unit (public members and methods) is found under Unit Designs. Designs for other units (commands and supporting classes) are omitted.

Release files for FastrakSerialDriver 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for FastrakSerialDriver 0.0.1
File Size Uploaded
fastrakserialdriver-0.0.1.tar.gz 409.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for FastrakSerialDriver 0.0.1
File Interpreter ABI Platform
fastrakserialdriver-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 424.1 kB

Release files / fastrakserialdriver-0.0.1.tar.gz

Download URL fastrakserialdriver-0.0.1.tar.gz
Size 409.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b58d13211629de5b31cbeb9139e2f2ca28da3903434a65f2d451751b28b0a2f7
BLAKE2b-256 checksum
How to use checksums
9d1c8c9ac839d3da31fa2136be5c36baa1b18f235cd32881a6f662720f7f9d98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fastrakserialdriver-0.0.1-py3-none-any.whl

Download URL fastrakserialdriver-0.0.1-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54fe7a441fd85406bb74e46137172e5eed7aab9fad267d96c3a9433bc3020bfc
BLAKE2b-256 checksum
How to use checksums
7c639c52f63d59492fc361771b33b1c4c23ba2058e596d12ae2183fa02bffacc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.2

2 release files

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page