From 3444f90c46ef1e99fb1e5a24270fb88968356628 Mon Sep 17 00:00:00 2001 From: Rachel Brindle Date: Mon, 15 Nov 2021 19:51:22 -0800 Subject: [PATCH] Consolidate down a couple articles Add the notes on Observability in control theory practice talk to the Bae article, and note how cool she is. Add some notes to the bicycling readme. Not a whole lot though. Finally consolidate the meta/setup.md and meta/duplicating.md articles. Update the tooling page with validation tooling. --- .spelling | 10 +++ ...9-07-17-observability-in-control-theory.md | 66 ----------------- src/bae/README.md | 73 ++++++++++++++++++- src/bicycling/README.md | 2 + src/meta/duplicating.md | 38 ---------- src/meta/setup.md | 46 +++++++++++- src/meta/tooling.md | 34 +++++++++ 7 files changed, 162 insertions(+), 107 deletions(-) delete mode 100644 src/bae/2019-07-17-observability-in-control-theory.md delete mode 100644 src/meta/duplicating.md diff --git a/.spelling b/.spelling index 2481cac..25b678b 100644 --- a/.spelling +++ b/.spelling @@ -508,6 +508,8 @@ book.toml - src/meta/setup.md html-proofer rsync +SUMMARY.md +book.toml - src/programming/ci/concourse.md Worker.beacon.forward worker.sh @@ -804,3 +806,11 @@ mdbook-section-validator README.md - src/programming/python/README.md rspec-like + - src/bae/README.md +there'd +Cy +2y +ACACx +nfor +ly +GGyG diff --git a/src/bae/2019-07-17-observability-in-control-theory.md b/src/bae/2019-07-17-observability-in-control-theory.md deleted file mode 100644 index 346e1b3..0000000 --- a/src/bae/2019-07-17-observability-in-control-theory.md +++ /dev/null @@ -1,66 +0,0 @@ -# 2019-07-17 Observability in Control Theory - -She practiced a talk on control theory in front of me. These are my notes. The talk content might be wrong - she's still learning about this. - -E.G. Drone on top of a car, measuring the car. - -It has a method to track the target (car). The way it does it is to measure the state of the target. - -`x(t+1) = A * x(t)` - -`A` is a transition matrix - it maps the target from the current state to the next (next state = current state * transition matrix) - -Drone can measure the target's "process" - it can estimate the next state of the target because it has the transition matrix encoded in it. - -Let's say drone also has some radar/camera sensors (other sensors). - -Now, `y(t) = C * x(t)` - `y` is the drone's measurement of `x(t)`. C maps the current state to what the drone is observing. - -This format is how we'd model dynamical system. Usually there'd be other terms for noise (B - process noise, D - measurement noise). - -Given this system, the system is observable if given `y(0), y(1), ..., y(l)` if we can backtrack to a state `x(0)` - -How to get from the measurements to the original state (get from `y(0), y(1), ...` to `x(0)). So, we know from `x(1) = A * x(0)`, and we know that `x(2) = A * x(1)` = `A^2 * x(0)`. Therefore, `x(l) = A^l * x(0)` - -Similarly, `y(0) = C * x(0)` and `y(1) = C * x(1) = C * A * x(0)`, and so forth: `y(l) = C*A^l*x(0)`. This can then be rewritten as a system of linear equations, like so: - -| y | observability matrix | -|--------|--------| -| `y(0)` | `C` | -| `y(1)` | `CA` | -| `y(2)` | `CA^2` | -| ... | ... | -| `y(l)` | `CA^l` | - -Can then be solved for `x(0)` if we have `A` and `C`. So, we could write this out if we have matrices `A` and `C`, but it's a long matrix, so it'd be difficult to compute. - -How do we know that this is observible if it's computationally hard to get to a unique `x(0)` - -So, this can be written as: - -`y\_bar = O * x(0)` (O = observability matrix). If the `rank(O) == n` (rank = number of columns, n = number of states that target can be in), then the system is observable. - -Doesn't tell you how observable it is, or how much information you need in order to get to x(0) - it could be observable, but it might be infeasible to observe. - -## Measuring Observability - -So, measuring observability: - -Observability gramiam - different kind of matrix that is used to tell how observable a system is. - -`for all t from 0 to l`, the normal of `y(t)` squared = energy of `y` = the observability gramiam. The higher, the more observable. -`= sum from 0 to l of transposed(C * A ^ t * x(0)) * (C * A ^ t * x(0))` = `G`. - -If we take determinant of `G`, and is high, then we have high energy in `y`, and it's highly observable. - -want to maximize the minimum eigenvalues of `G`, in order to have high observability. - -These are all ways to say how observable a system is. - -## Usefulness - -Why do this? - -You can use this information to calculate how well a kalman filter works by calculating the observability gramiam. - -You can determine how well you designed your system. diff --git a/src/bae/README.md b/src/bae/README.md index 817ebf5..065b835 100644 --- a/src/bae/README.md +++ b/src/bae/README.md @@ -1,3 +1,74 @@ # Bae -My bae is pretty great. +My bae is pretty great. As of this writing, she has a Masters in computer science, and is working on a PhD in robotics and electrical engineering. I have 3/4 of an undergrad computer science degree. + +## Talk Practices + +She sometimes gives talks, and she likes to practice for me. Sometimes I take notes on them. I rarely actually understand what she's talking about. But she's cute nonetheless. + +### 2019-07-17 Observability in Control Theory + +She practiced a talk on control theory in front of me. These are my notes. The talk content might be wrong - she's still learning about this. + +E.G. Drone on top of a car, measuring the car. + +It has a method to track the target (car). The way it does it is to measure the state of the target. + +`x(t+1) = A * x(t)` + +`A` is a transition matrix - it maps the target from the current state to the next (next state = current state * transition matrix) + +Drone can measure the target's "process" - it can estimate the next state of the target because it has the transition matrix encoded in it. + +Let's say drone also has some radar/camera sensors (other sensors). + +Now, `y(t) = C * x(t)` - `y` is the drone's measurement of `x(t)`. C maps the current state to what the drone is observing. + +This format is how we'd model dynamical system. Usually there'd be other terms for noise (B - process noise, D - measurement noise). + +Given this system, the system is observable if given `y(0), y(1), ..., y(l)` if we can backtrack to a state `x(0)` + +How to get from the measurements to the original state (get from `y(0), y(1), ...` to `x(0)). So, we know from `x(1) = A * x(0)`, and we know that `x(2) = A * x(1)` = `A^2 * x(0)`. Therefore, `x(l) = A^l * x(0)` + +Similarly, `y(0) = C * x(0)` and `y(1) = C * x(1) = C * A * x(0)`, and so forth: `y(l) = C*A^l*x(0)`. This can then be rewritten as a system of linear equations, like so: + +| y | observability matrix | +|--------|--------| +| `y(0)` | `C` | +| `y(1)` | `CA` | +| `y(2)` | `CA^2` | +| ... | ... | +| `y(l)` | `CA^l` | + +Can then be solved for `x(0)` if we have `A` and `C`. So, we could write this out if we have matrices `A` and `C`, but it's a long matrix, so it'd be difficult to compute. + +How do we know that this is observible if it's computationally hard to get to a unique `x(0)` + +So, this can be written as: + +`y\_bar = O * x(0)` (O = observability matrix). If the `rank(O) == n` (rank = number of columns, n = number of states that target can be in), then the system is observable. + +Doesn't tell you how observable it is, or how much information you need in order to get to x(0) - it could be observable, but it might be infeasible to observe. + +#### Measuring Observability + +So, measuring observability: + +Observability gramiam - different kind of matrix that is used to tell how observable a system is. + +`for all t from 0 to l`, the normal of `y(t)` squared = energy of `y` = the observability gramiam. The higher, the more observable. +`= sum from 0 to l of transposed(C * A ^ t * x(0)) * (C * A ^ t * x(0))` = `G`. + +If we take determinant of `G`, and is high, then we have high energy in `y`, and it's highly observable. + +want to maximize the minimum eigenvalues of `G`, in order to have high observability. + +These are all ways to say how observable a system is. + +#### Usefulness + +Why do this? + +You can use this information to calculate how well a kalman filter works by calculating the observability gramiam. + +You can determine how well you designed your system. diff --git a/src/bicycling/README.md b/src/bicycling/README.md index 479d90a..b69090d 100644 --- a/src/bicycling/README.md +++ b/src/bicycling/README.md @@ -1 +1,3 @@ # Bicycling + +Bicycling is one of the best forms of ground transportation. diff --git a/src/meta/duplicating.md b/src/meta/duplicating.md deleted file mode 100644 index 60dfb2e..0000000 --- a/src/meta/duplicating.md +++ /dev/null @@ -1,38 +0,0 @@ -# Creating your own mdBook-based Knowledge Repository - -The short version of [this page](setup.md). - -I maintain a second knowledge repository for work-specific things, these are the instructions I used for setting that one up. - -## Machine Setup - -[mdBook](https://github.com/rust-lang-nursery/mdBook) requires rust to use, so we first install rust. This is done via [rustup](https://rustup.rs). - -- `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` - -Next, we install mdbook itself: `cargo install mdbook`. - -Optionally, we can install my [mdbook-generate-summary](https://github.com/younata/mdbook-generate-summary) tool, which means we don't have to maintain the `SUMMARY.md` file that mdbook requires. If you don't want to install that, then you also need to add an entry to the SUMMARY.md file each time you create or move files around. - -- `cargo install mdbook-generate-summary` - -This is all that's required to setup the machine. - -## Setting up the Repository - -To set up the repository itself, you need to create a `book.toml` file, an initial `src/README.md` file, and (if not using `mdbook-generate-summary`) a `src/SUMMARY.md` file. - -For reference, this repository's book.toml file is: - -```toml -{{#include ../../book.toml}} -``` - -The only special thing is that this repository also uses my [`mdbook-api`](https://github.com/younata/mdbook-api) backend, in order to export things for use with my [client side tooling](tooling.md). - -## Building the Repository - -If you want to view the repository locally, you can use `mdbook build`, and open `book/index.html` in your web browser. If you're doing interactive work, then you can use `mdbook watch`. - -Note that if you're using `mdbook-generate-summary`, you should run that every time you create, delete, or move a page. - diff --git a/src/meta/setup.md b/src/meta/setup.md index 7d22748..575e8b8 100644 --- a/src/meta/setup.md +++ b/src/meta/setup.md @@ -2,7 +2,7 @@ This is setup using [mdBook](https://github.com/rust-lang-nursery/mdBook). It's hosted as a [repository on github](https://github.com/younata/personal_knowledge). I set up a pipeline in [concourse](https://concourse-ci.org) to build, check that things work, and then push new versions once things are set up. -[TL;DR, check out these instructions](duplicating.md) +[TL;DR, check out these instructions at the bottom](#duplicating) ## Repository Layout @@ -53,7 +53,49 @@ mdspell --ignore-acronyms --ignore-numbers --en-us "**/*.md" ## Future Work - On a per-section basis, add other lines to show up for all pages in that section (e.g. I want everything in my [flying](../flying/) section to have the "This is for my own use and is not flight instruction" disclaimer). -- Figure out a way to actually support checkboxes and such, as how github does. This could be done as a custom preprocessor. + +## Duplicating + +Here's what I did to stand up additional versions of this repository (e.g. a separate one for work, the [coz-e build](https://coz-e.rachelbrindle.com)). + +### Machine Setup + +[mdBook](https://github.com/rust-lang-nursery/mdBook) requires rust to use, so we first install rust. This is done via [rustup](https://rustup.rs). + +- `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` + +Next, we install mdbook itself: `cargo install mdbook`. + +Additionally, there's a bunch of [extra tooling I use]({{#path_for tooling}}). I won't go through them in detail, but here's the following commands to install everything: + +```bash +cargo install mdbook-generate-summary mdbook-api mdbook-chapter-path mdbook-git-atom mdbook-section-validator +``` + +This is all that's required to setup the machine. + +You can optionally install the validation tooling (markdown-spellcheck, html-proofer) with the following commands: + +```bash +npm i -g markdown-spellcheck +gem install html-proofer +``` + +### Setting up the Repository + +To set up the repository itself, you need to create a `book.toml` file, an initial `src/README.md` file, and (if not using `mdbook-generate-summary`) a `src/SUMMARY.md` file. + +For reference, this repository's book.toml file is: + +```toml +{{#include ../../book.toml}} +``` + +### Building the Repository + +If you want to view the repository locally, you can use `mdbook build`, and open `book/index.html` in your web browser. If you're doing interactive work, then you can use `mdbook watch`. + +Note that if you're using `mdbook-generate-summary`, you should run that every time you create, delete, or move a page. [^pipeline]: The pipeline definition looks like this: diff --git a/src/meta/tooling.md b/src/meta/tooling.md index c1d2ddd..60291bc 100644 --- a/src/meta/tooling.md +++ b/src/meta/tooling.md @@ -34,3 +34,37 @@ Because this is written as an mdbook postprocessor, it does mean that this check It has some rough edges. For example, if you don't give each directory a README.md file (with the name of the section), then the generated `SUMMARY.md` file will not be correctly organized. But, it works well enough for my use case, so long as I keep that limitation in mind. !!! + +### Last-updated Annotations + +This is simply a script that runs in CI which appends the date of the commit that last updated the file, which has the following contents: + +```bash +{{#include ../../scripts/annotate_dates.sh}} +``` + +### Spellcheck + +I use the [markdown-spellcheck](https://www.npmjs.com/package/markdown-spellcheck?activeTab=readme) package to spellcheck all the markdown files. + +### HTML-Proofer + +In CI, I use the [html-proofer](https://github.com/gjtorikian/html-proofer) gem to validate the generated html of this project. The command looks like: + +```bash +DOMAIN="https://knowledge.rachelbrindle.com" +FILE_IGNORES="./print.html,./404.html" # Ignore the 404 page and especially the print page. Print page is simply a all pages consolidated, and it's better to catch broken links as close to the original file as possible +URL_IGNORES: "/github.com\\/younata\\/personal_knowledge/" # Don't error if a link to a not-yet-there file is published. + +/usr/local/bundle/bin/htmlproofer \ + --assume-extension \ + --check-img-http \ + --enforce-https \ + --only_4xx \ + --http-status-ignore "401,402,403,415" \ + --file-ignore "$FILE_IGNORES" \ + --url-ignore "$URL_IGNORES" \ + --internal-domains "$DOMAIN" "./book/html" +``` + +Which is why, if you view source, all of the links to `http` sites have the `data-proofer-ignore` attribute in their anchor tag.