Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 69 additions & 30 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,110 @@
name: deploy-book

# Only run this when the master branch changes
# Validate pull requests and deploy when main changes
on:
pull_request:
push:
branches:
- main

# This job installs dependencies, builds the book, and pushes it to `gh-pages`
# If using conda lock, re-generate conda-lock file with:
# > conda-lock -f environment.yml -p linux-64
jobs:
deploy-book:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
s76-outcome: ${{ steps.s76.outcome }}
env:
CONDA_LOCK: false
MPLBACKEND: module://matplotlib_inline.backend_inline
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4

- name: Activate conda env with conda.lock
if: env.CONDA_LOCK == 'true'
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: false
auto-activate-base: false
activate-environment: gtbook
python-version: 3.9
environment-file: conda-linux-64.lock
- uses: actions/checkout@v7.0.1

- name: Activate conda env with environment.yml
if: env.CONDA_LOCK == 'false'
uses: conda-incubator/setup-miniconda@v3
uses: conda-incubator/setup-miniconda@v4.0.1
with:
auto-update-conda: false
auto-activate-base: false
auto-activate: false
activate-environment: gtbook
python-version: 3.9
python-version: '3.13'
environment-file: environment.yml

- run: conda info --envs
if: env.CONDA_LOCK == 'false'
name: Check active env

- run: conda list
if: env.CONDA_LOCK == 'false'
name: Check versions

- run: pip install plotly==5.5.0
if: env.CONDA_LOCK == 'true'
name: Install plotly
- name: Execute S76 independently
id: s76
continue-on-error: true
timeout-minutes: 15
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/s76"
python scripts/s76_ci.py execute --output-dir "$RUNNER_TEMP/s76" \
2>&1 | tee "$RUNNER_TEMP/s76/execution.log"

- name: Select S76 outputs and prepare book configuration
if: steps.s76.outcome == 'success' || steps.s76.outcome == 'failure'
env:
S76_OUTCOME: ${{ steps.s76.outcome }}
run: |
set -euo pipefail
args=()
if [ "$S76_OUTCOME" = success ]; then
args+=(--use-executed)
echo 'S76: using freshly executed outputs.' >> "$GITHUB_STEP_SUMMARY"
else
echo '::warning::S76 execution failed; using saved committed outputs.'
echo 'S76: execution failed or timed out; using saved committed outputs. See the S76 diagnostic artifact.' >> "$GITHUB_STEP_SUMMARY"
fi
python scripts/s76_ci.py prepare --output-dir "$RUNNER_TEMP/s76" \
--prepared-config "$RUNNER_TEMP/book-config.yml" "${args[@]}"

- run: pip install gtbook
if: env.CONDA_LOCK == 'true'
name: Install gtbook
- name: Preserve S76 diagnostics
if: always() && (steps.s76.outcome == 'success' || steps.s76.outcome == 'failure')
continue-on-error: true
uses: actions/upload-artifact@v7.0.1
with:
name: s76-execution-${{ github.run_id }}
path: ${{ runner.temp }}/s76/
if-no-files-found: warn

- name: Build Frank and Seth's book
run: |
jupyter-book clean .
touch *.ipynb
jupyter-book build .
touch ./*.ipynb
jupyter-book build . --config "$RUNNER_TEMP/book-config.yml"

# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/actions-gh-pages@v4
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4.1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
cname: www.roboticsbook.org

report-s76:
needs: deploy-book
if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.deploy-book.outputs.s76-outcome == 'failure'
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
issues: write
concurrency:
group: s76-failure-report
cancel-in-progress: false
steps:
- uses: actions/checkout@v7.0.1
- name: Open an issue unless this failure is already tracked
uses: actions/github-script@v9.0.0
with:
script: |
const report = require('./scripts/report_s76.cjs');
await report({github, context, core});
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ _build/*
.DS_Store
.ipynb_checkpoints/*
.vscode/settings.json

build/

__pycache__/
2 changes: 1 addition & 1 deletion S24_sorter_perception.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@
"source": [
"posterior = gtsam.DiscreteDistribution(unnormalized_posterior)\n",
"print(type(posterior))\n",
"assert sum(p for _, p in posterior.enumerate()) == 1.0\n",
"assert np.isclose(sum(p for _, p in posterior.enumerate()), 1.0, rtol=0, atol=1e-12)\n",
"pretty(posterior)"
]
},
Expand Down
7 changes: 5 additions & 2 deletions S54_diffdrive_perception.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,8 @@
}
],
"source": [
"model = torch.hub.load('pytorch/vision:v0.10.0', 'deeplabv3_resnet50', pretrained=True);\n",
"from torchvision.models.segmentation import DeepLabV3_ResNet50_Weights, deeplabv3_resnet50\n",
"model = deeplabv3_resnet50(weights=DeepLabV3_ResNet50_Weights.COCO_WITH_VOC_LABELS_V1);\n",
"model.to(DEVICE) # DEVICE will be equal to 'cuda' if GPU is available\n",
"model.eval();"
]
Expand Down Expand Up @@ -926,8 +927,10 @@
}
],
"source": [
"# MiDaS also loads its EfficientNet backbone from this repository.\n",
"_ = torch.hub.list(\"rwightman/gen-efficientnet-pytorch\", trust_repo=True, verbose=False)\n",
"model_type = \"MiDaS_small\" # MiDaS v2.1 - Small\n",
"midas = torch.hub.load(\"intel-isl/MiDaS\", model_type, verbose=False);\n",
"midas = torch.hub.load(\"intel-isl/MiDaS\", model_type, verbose=False, trust_repo=True);\n",
"midas.to(DEVICE);\n",
"midas.eval();"
]
Expand Down
7 changes: 5 additions & 2 deletions S72_drone_actions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"source": [
"import math\n",
"import numpy as np\n",
"from dataclasses import dataclass\n",
"from dataclasses import dataclass, field\n",
"\n",
"import gtsam\n",
"from gtbook.drone import axes\n",
Expand Down Expand Up @@ -802,11 +802,14 @@
" g: float = 9.81\n",
" mass: float = 1.0\n",
" k_d: float = 0.0425 # drag coefficient\n",
" gn: np.ndarray = gtsam.Point3(0, 0, -g) # gravity vector in navigation frame.\n",
" gn: np.ndarray = field(init=False) # gravity vector in navigation frame.\n",
" I_xy: float = 4 * 0.15 * mass * 0.1**2 # All 4 motors contribute to I_xy\n",
" I_z: float = 4 * 0.15 * mass * 2 * 0.1**2 # I_z leverages longer arm\n",
" I = np.diag([I_xy, I_xy, I_z]) # Inertia matrix\n",
"\n",
" def __post_init__(self):\n",
" self.gn = gtsam.Point3(0, 0, -self.g)\n",
"\n",
" # define integrate method that updates dynamics and then calls super's integrate method:\n",
" def integrate(self, f: float, tau:gtsam.Point3, dt=1.0):\n",
" \"\"\"Integrate equations of motion given dynamic inputs f and tau.\"\"\"\n",
Expand Down
4 changes: 3 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ title: Introduction to Robotics and Perception
author: Frank Dellaert and Seth Hutchinson
logo: logo.png
only_build_toc_files: true
execute_notebooks: on

# Force re-execution of notebooks on each build.
# See https://jupyterbook.org/content/execute.html
execute:
execute_notebooks: force
timeout: 300
allow_errors: false
raise_on_error: true

# Define the name of the latex output file for PDF builds
latex:
Expand Down
14 changes: 7 additions & 7 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ name: gtbook
channels:
- conda-forge
dependencies:
- python=3.9
- conda-lock
- python=3.13
- black
- jupyter-book>=0.15
- jupyter-book>=1,<2
- python-graphviz
- ipywidgets>=7.5
- pandas
- matplotlib=3.5.3
- matplotlib
- pillow # section 5.3 etc..
- pytorch
- torchvision
- timm
- nbformat
- pip
- pip:
- plotly # in pip for binder
- kaleido # needed for png output
- gtbook
- plotly>=5.24.1,<6 # in pip for binder
- kaleido>=0.2.1,<1 # bundled browser for png output
- gtbook>=0.0.41
Loading
Loading