Autopilot in Go for docking the SpaceX Dragon capsule in the simulator

Overview

Dragon ISS Docking Autopilot in Go

Autopilot written in Go and executed as WebAssembly for docking the SpaceX Dragon capsule in the official simulator.

Screencast of the autopilot in action

Autopilot during docking

Why

I never used Go and WebAssembly together before. This seemed like a nice and small excercise and I also got to refresh controller algorithms.

Using this autopilot

  • Compile the autopilot and serve the files.
go run ./cmd/autopilot-server
  • Open the SpaceX ISS docking simulator: https://iss-sim.spacex.com
  • Open the developer console of your browser (eg. right click > Inspect in Chrome)
  • Paste the following code into the console to load the autopilot:
const s = document.createElement("script");
s.setAttribute("src", "http://localhost:8000/loader.js?t="+ new Date().getTime());
document.body.appendChild(s);

If you want to make modifications to autopilot.go, restart the autopilot-server, refresh the simulator page and paste the above JavaScript code into the console again.

Controller algorithm

The main controller algorithm is the correct() method in autopilot.go. At first the current rate is calculated using the previous time and offset and dampened over some cycles DampingCycles.

Then a correction factor Correction is used to calculate the target rate. This target rate is limited based on the offset and RateFactor but kept between RateMin and RateMax.

The difference between target and current rate is then added to a clicks accumulator. Full clicks are then subtracted from the accumulator and returned from the function.

Play around with the ios configuration to get different controller behavior.

Contributing

If you improved this autopilot or added a new feature, don't hesitate to open a PR. I'm looking forward to see what you will do with it.


Built by @mbertschler

You might also like...
secure scuttlebutt network simulator

Network Simulator a brief exposition on the network simulator to be built as part of SSB's NGI Pointer grant For the remainder of May—and likely parts

A LoRaWAN nodes' and network simulator that works with a real LoRaWAN environment (such as Chirpstack) and equipped with a web interface for real-time interaction.
A LoRaWAN nodes' and network simulator that works with a real LoRaWAN environment (such as Chirpstack) and equipped with a web interface for real-time interaction.

LWN Simulator A LoRaWAN nodes' simulator to simulate a LoRaWAN Network. Table of Contents General Info Requirements Installation General Info LWN Simu

Scalable package delivery logistics simulator built using SingleStore and Vectorized Redpanda
Scalable package delivery logistics simulator built using SingleStore and Vectorized Redpanda

Reference Architecture using SingleStore and Redpanda for global logistics 📯 INFO: For the story behind this code (and epic dashboards), check out th

MIPS simulator written in Go
MIPS simulator written in Go

FUM-MIPS is a 5-stage CPU, that supports a subset of the MIPS Instruction Set. It is a 32-bit CPU with 32 general-purpose registers. The figure below shows an overview of the architecture.

A web-based simulator for the Kubernetes scheduler
A web-based simulator for the Kubernetes scheduler

Web-based Kubernetes scheduler simulator Hello world. Here is web-based Kubernetes scheduler simulator. On the simulator, you can create/edit/delete t

An easy-to-use, flexible network simulator library in Go.

ns-x An easy-to-use, flexible network simulator library for Go. Feature Programmatically build customizable and scalable network topology from basic n

K8s cluster simulator for workload scheduling.
K8s cluster simulator for workload scheduling.

Open-Simulator Motivation 概念定义 Open-Simulator 是 K8s 下的仿真调度组件。用户准备一批待创建 Workload 资源,Workload 资源指定好资源配额、绑核规则、亲和性规则、优先级等,通过 Open-Simulator 的仿真调度能力可判断当前集群

Wirewold cellular automata simulator, running entirely on GPU.

Wireworld-gpu Wireworld implements the data and rules for the Wireworld cellular automata. This particular version is an experiment whereby the simula

A genetic simulator written in Go
A genetic simulator written in Go

BioGo This is a simple genetic simulator written in Go. Heavily inspired by https://github.com/davidrmiller/biosim4/tree/main/src About This project s

AutoTrackIR will automatically re-enabled your Track IR if flight simulator disabled it. (bug introduce in SU7)

AutoTrackIR AutoTrackIR will automatically re-enable your Track IR if flight simulator disabled it. (bug introduce in SU7) How it works ? It just watc

This repo contains implementation of Conway's Game of Life simulator

Conway's Game of Life simulation This repo contains implementation of Conway's Game of Life simulator. Build Prerequisite: Tho Go programming language

A cloud-native application simulator for golang

Build and upload Docker images Build docker images for main application and work

golife is a cell evolution simulator.
golife is a cell evolution simulator.

golife WORK IN PROGRESS golife is a cell evolution simulator. It presents autonomous organism with inner properties and behavior (hunter or prey) that

VHDL Simulator, code VHDL in your browser! 🤖
VHDL Simulator, code VHDL in your browser! 🤖

VHDL Runner 🤖 VHDL Simulator, code VHDL in your browser! 🤖 Usage Go to https://vhdl.mateuszwozniak.com/ Next, type some VHDL code, with appropriate

Economy - Economy simulator library in Go

economy Economy simulator library in Go This library was developed primarily to

Typo - Terminal input simulator for demos
Typo - Terminal input simulator for demos

typo Somehow, whenever I need to give a presentation or demo, my typing skills d

This project implements a simple Alien Invasion simulator CLI

Alien Invasion Simulator This project implements a simple Alien Invasion simulat

Multithreaded Airline Check-In Simulator

Multithreaded Airline Check-In Simulator This is a task scheduler which includes a single queue and 5 clerks. The queue will be sorted based on priori

Zeonica is a simulator for CGRA and Wafer-Scale Accelerators.

Zeonica Zeonica is a simulator for CGRA and wafer-scale accelerators. ISA Definition Register Space Special registers include: PC: Program Counter. TI

Owner
Martin Bertschler
Part time inventor, full time Gopher. I love building fun and useful things.
Martin Bertschler
📡 Prometheus exporter that exposes metrics from SpaceX Starlink Dish

Starlink Prometheus Exporter A Starlink exporter for Prometheus. Not affiliated with or acting on behalf of Starlink(™) ?? Starlink Monitoring System

DanOpsTech 81 Nov 14, 2022
A very very simple CLI tool to know the next and previous SpaceX flights.

Rocket A very very simple CLI tool to know the next and previous SpaceX flights. Commands rocket Get the next flight. rocket latest Get the last fligh

Quentin 3 Apr 19, 2021
Dragon 🐲 🐲 🐲 is an enterprise high performance web framework with Go for the feature and comfortable develop.

Dragon start dragon ab performance Dragon ?? ?? ?? is a lightweight high performance web framework with Go for the feature and comfortable develop. 中文

dragon 8 Sep 14, 2022
Dragon 🐲 🐲 🐲 is a lightweight high performance web framework with Go for the feature and comfortable develop.

Dragon project new link start dragon ab performance Dragon ?? ?? ?? is a lightweight high performance web framework with Go for the feature and comfor

azerothyang 0 Sep 6, 2022
Argo-CD Autopilot

Introduction New users to GitOps and Argo CD are not often sure how they should structure their repos, add applications, promote apps across environme

argoproj-labs 498 Nov 23, 2022
A simple low bandwidth simulator written in go

NETSNAIL 0.8 ABOUT Netsnail is a simple network proxy that simulates low bandwidth. RUNNING Usage of netsnail: -d=0: the delay on data transfe

Per Arneng 23 May 19, 2021
Busy is a mouse movement simulator

Busy is a mouse movement simulator. It stops your system from going to sleep / idling and makes sure that you keep getting those notifications while you take that well deserved break.

Tejus 15 Mar 31, 2021
2D particle system simulator for Go

twodeeparticles An engine-agnostic 2D particle system simulator for Go twodeeparticles does not render particles itself. Any rendering engine can be u

Maik Schreiber 35 Aug 29, 2022
FLoC Simulator

FLoC Simulator Command line FLoC simulator to calculate CohortID with using host list and cluster data. Build and Run Demo $ cd $ cd demos/floc_sampl

Shigeki Ohtsu 37 May 5, 2022
connect to microsoft flight simulator 2020 using golang

msfs2020-go simconnect package msfs2020-go/simconnect connects to microsoft flight simulator 2020 using golang. cross-compiles from macos/linux, no ot

lian 365 Nov 23, 2022