Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e0c65a4
large updates to interfaces, added analysis suite, improved tests
nickwitten Dec 29, 2025
f267b38
add analysis data files
nickwitten Mar 3, 2026
06e1e34
small bugfixes and updates
nickwitten Mar 4, 2026
a856ca5
error propogation to callers
nickwitten Mar 4, 2026
687dd54
cleanup and bugfixes
nickwitten Mar 4, 2026
a82e919
add some vector and matrix type aliases
nickwitten Mar 7, 2026
118a83d
debug launcher for compute_trajectory.rs and update robot_params
nickwitten Mar 9, 2026
2384f43
kalman_visualize with tracked trajectory, update robot_params
nickwitten Mar 11, 2026
e00799f
friction compensation
nickwitten Mar 13, 2026
979828d
updating robot_params.json
nickwitten Mar 16, 2026
5493db7
bugfix friction force computation
nickwitten Mar 16, 2026
00cc313
update robot_params.json
nickwitten Mar 17, 2026
23b7ce2
update robot_params.json, revert friction compensation tuning
nickwitten Mar 17, 2026
2f038d5
add feedback/feedforward gain parameter
nickwitten Mar 18, 2026
9c67e37
add reset interface
nickwitten Mar 27, 2026
e468d45
add test-model.rs for model debug
nickwitten Mar 28, 2026
5d15f51
motor and friction tuning, velocity overlay to kalman visualize
nickwitten Apr 1, 2026
caac606
add bangbang_accel to param_tuning_loop.py, update robot_params.json
nickwitten Apr 6, 2026
acff51a
robot params with friction and PD tuning
nickwitten Apr 7, 2026
4e9488e
update robot_params.json, working friction and feedback tuning to hit…
nickwitten Apr 8, 2026
b1f11db
set default params in firmware
nickwitten Apr 8, 2026
e3de1d2
add get_state to robot_model
nickwitten Apr 12, 2026
2fe5a1e
remove "allowable error" traj params
nickwitten Apr 12, 2026
5d773a7
updates for new parameter interface
nickwitten Apr 12, 2026
0948537
updates for new body control modes in telemetry
nickwitten Apr 12, 2026
8b1cc6a
more updates to use body control telemetry
nickwitten Apr 12, 2026
959df78
public z_rotation_mat function
nickwitten Apr 13, 2026
158b378
add twist PID params to robot_params.json, graph fric comp in kalman_…
nickwitten Apr 13, 2026
0e38dc3
robot params - filter out encoder noise
nickwitten Apr 14, 2026
acb0992
also update in kalman params
nickwitten Apr 14, 2026
f6e9cbc
add square motion input, update robot pose PID
nickwitten Apr 14, 2026
5350a74
bugfix bangbang traj state_at for trajectories that end with non-zer…
nickwitten Apr 18, 2026
5bd8980
update visualization colors, separate param upload script
nickwitten Apr 18, 2026
10fe89d
bugfix TrajectoryParams class in rust_interface.py
nickwitten Apr 19, 2026
0ae07c2
trajectory_overlay - update legend when drawing optimal traj lines
nickwitten Apr 19, 2026
ae9fb2d
only record needed topics in param_tuning_loop
nickwitten Apr 20, 2026
c1112e6
set max accel linear param to 2.0
nickwitten May 5, 2026
a764f3f
update robot params
nickwitten May 7, 2026
3395c0a
update plotting for new telemetry messages
nickwitten May 10, 2026
2887f1d
add string formatters to ControlsError
nickwitten May 15, 2026
c50524c
remove unused imports
nickwitten May 15, 2026
1ce1154
cleanup robot params
nickwitten May 15, 2026
48581ec
add kalman filter manual position override
nickwitten May 16, 2026
1fe823c
large refactor
nickwitten May 22, 2026
f1df8ab
small edgecase bugfix in pathing for bag2np
nickwitten May 22, 2026
77efab8
README.md update
nickwitten May 26, 2026
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
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,16 @@ target
# Cmake #
#########
build


#########
# Python #
#########
*.pyc
.venv


#################
# Analysis data #
#################
analysis/data
Empty file added COLCON_IGNORE
Empty file.
134 changes: 125 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
members = [
"ateam-controls",
"ateam-controls-c",
"analysis",
]
resolver = "3"
62 changes: 53 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# controls

This repository holds shared code and analysis docs for the A-Team motion control stack.
This repository holds shared code and analysis tools for the A-Team motion control stack.

The shared code is written primarily in Rust with C interface bindings.

## Contents
* analysis
* Docs and scripts used to design and understand our motion controls
* ateam-controls
* The primary Rust crate for shared code
* ateam-controls-c
* Crate for building C-compatible library and headers
* cpp_tests
* Tests for the C-compatible bindings

* **ateam-controls** — Primary Rust crate for control algorithms
* **ateam-controls-c** — C-compatible library and headers
* **ateam-controls-py** — Installable Python package with ctypes bindings (same interface as the C library)
* **analysis** — Telemetry visualization scripts and ROS tooling
* **cpp_tests** — Tests for the C-compatible bindings

## Dependencies

### For Rust users
* [nix](https://nixos.org/)

Expand All @@ -24,6 +23,10 @@ The shared code is written primarily in Rust with C interface bindings.
* [CMake](https://cmake.org/)
* `apt install cmake`

### For Python / analysis users
* [uv](https://docs.astral.sh/uv/)
* `curl -LsSf https://astral.sh/uv/install.sh | sh`

## Building and Testing

### Rust
Expand All @@ -42,3 +45,44 @@ cmake --build build
cd build
ctest
```

### Python

```bash
uv sync
source .venv/bin/activate
```

> **WSL users:** You may need `sudo apt install python3-tk` for matplotlib GUI windows.

## Analysis

Activate the python virtual environment and change to the analysis directory

```bash
source .venv/bin/activate
cd analysis
```

While running robots, capture telemetry to a ros bag, convert it to a numpy archive, and visualize the telemetry

```bash
rm -rf data/bags/robot_telemetry && ros2 bag record -o data/bags/robot_telemetry --topics /robot_feedback/extended/robot0
python ros_scripts/telem_bag2np.py --bag data/bags/robot_telemetry -o data/telemetry/robot_telemetry.npz --robot 0
python telem_visualize.py -t data/telemetry/robot_telemetry.npz
```

This opens:
- **Body state** — 3×3 grid (pos/vel/accel × x/y/theta) with predicted, estimated,
measured, and commanded traces. Press **Space** to toggle trajectory + velocity overlays.
- **Wheel current** — commanded vs measured current per wheel (2×2).
- **Wheel velocity** — commanded vs measured velocity per wheel (2×2).

### ROS Scripts

Scripts in `analysis/ros_scripts/` require a sourced ROS2 workspace:

- `telem_bag2np.py` — Convert ROS2 bags to NumPy archives
- `upload_params.py` — Upload parameters to robot firmware via ROS2 services
- `param_tuning_loop.py` — Interactive edit → upload → record → visualize workflow
- `record_and_visualize.sh` — Record a ROS bag and visualize
12 changes: 0 additions & 12 deletions analysis/Cargo.toml

This file was deleted.

5 changes: 0 additions & 5 deletions analysis/README.md

This file was deleted.

11 changes: 11 additions & 0 deletions analysis/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Build helper for the Rust controls library."""

import subprocess
from ateam_controls._bindings import CONTROLS_REPO_PATH


def compile_controls():
"""Build the shared library (and binaries) in release mode."""
build_cmd = ["cargo", "build", "--release", "--workspace"]
subprocess.run(build_cmd, cwd=CONTROLS_REPO_PATH, check=True)
print("Built controls workspace (release).")
Loading