101 lines
3.9 KiB
Makefile
101 lines
3.9 KiB
Makefile
default:
|
|
@just --list
|
|
|
|
fmt:
|
|
cargo fmt --all
|
|
|
|
lint:
|
|
cargo fmt --all -- --check
|
|
cargo clippy --workspace --all-targets -- -D warnings
|
|
|
|
test:
|
|
cargo test --workspace --all-targets
|
|
|
|
audit:
|
|
cargo +nightly -Zscript scripts/audit-rules.rs
|
|
|
|
audit-test:
|
|
cargo +nightly -Zscript scripts/audit-rules.rs --self-test
|
|
|
|
install-hooks:
|
|
git config --local core.hooksPath .githooks
|
|
chmod +x .githooks/pre-commit
|
|
|
|
check:
|
|
just fmt
|
|
just lint
|
|
just test
|
|
just audit
|
|
|
|
vcan-test:
|
|
sudo modprobe vcan
|
|
sudo ip link add dev vcan0 type vcan || true
|
|
sudo ip link set up vcan0
|
|
cargo test -p integration-tests --test socketcan_vcan -- --ignored --test-threads 1
|
|
|
|
run-mock:
|
|
cargo run -p chassisd -- --mock
|
|
|
|
rc-monitor device="/dev/ttyS2":
|
|
cargo run --release -p spin -- rc --device {{device}}
|
|
|
|
check-structure:
|
|
cargo +nightly -Zscript scripts/audit-rules.rs
|
|
|
|
build-armv7:
|
|
rustup target add armv7-unknown-linux-musleabihf
|
|
cargo build --release -p chassisd --target armv7-unknown-linux-musleabihf
|
|
cargo build --release -p spin --target armv7-unknown-linux-musleabihf
|
|
cargo build --release -p chassis-tune --target armv7-unknown-linux-musleabihf
|
|
|
|
deploy board="root@192.168.2.2" mode="--mock":
|
|
just build-armv7
|
|
ssh {{board}} "mkdir -p /tmp/chassisd"
|
|
scp -q target/armv7-unknown-linux-musleabihf/release/chassisd {{board}}:/tmp/chassisd/chassisd
|
|
ssh {{board}} "/tmp/chassisd/chassisd {{mode}}"
|
|
|
|
can-up board="root@192.168.2.2" iface="can0":
|
|
ssh {{board}} "ip link set {{iface}} down; ip link set {{iface}} up type can bitrate 1000000 restart-ms 100 && ip -br link show {{iface}}"
|
|
|
|
build-spin:
|
|
rustup target add armv7-unknown-linux-musleabihf
|
|
cargo build --release -p spin --target armv7-unknown-linux-musleabihf
|
|
|
|
bench-spin board="root@192.168.2.2" device="/dev/ttyACM0" rpm="500" opts="":
|
|
just build-spin
|
|
scp -q target/armv7-unknown-linux-musleabihf/release/spin {{board}}:/tmp/spin
|
|
ssh {{board}} "/tmp/spin chassis --device {{device}} --rpm {{rpm}} {{opts}}"
|
|
|
|
bench-check board="root@192.168.2.2" device="/dev/ttyACM0":
|
|
just build-spin
|
|
scp -q target/armv7-unknown-linux-musleabihf/release/spin {{board}}:/tmp/spin
|
|
ssh {{board}} "/tmp/spin chassis --device {{device}} --dry-run"
|
|
|
|
tune-presets preset="config/tune.toml":
|
|
cargo run -p chassis-tune -- presets --preset {{preset}}
|
|
|
|
tune-preset name="sim_bench_model" opts="" preset="config/tune.toml":
|
|
cargo run --release -p chassis-tune -- sweep --preset {{preset}} --preset-name {{name}} {{opts}}
|
|
|
|
tune-sim samples="512" seed="20260101":
|
|
cargo run --release -p chassis-tune -- sweep --samples {{samples}} --seed {{seed}} --out-dir target/tune
|
|
|
|
tune-smoke samples="64" seed="7":
|
|
cargo run --release -p chassis-tune -- sweep --samples {{samples}} --top-k 3 --max-iters 40 --ensemble 2 --seed {{seed}} --out-dir target/tune-smoke
|
|
|
|
tune-validate gains="2,10,0,0":
|
|
cargo run --release -p chassis-tune -- validate --gains {{gains}}
|
|
|
|
tune-plot samples="128":
|
|
cargo run --release -p chassis-tune --features plot -- sweep --samples {{samples}} --out-dir target/tune-plot
|
|
|
|
tune-write config="config/chassis.toml.example" motor="front_left" out="target/tune/chassis.tuned.toml":
|
|
cargo run --release -p chassis-tune -- sweep --config {{config}} --motor {{motor}} --write-config {{out}} --samples 256 --out-dir target/tune
|
|
|
|
tune-bench board="root@192.168.2.2" device="/dev/ttyACM0" esc_id="1" samples="24" preset="bench_noload" opts="":
|
|
rustup target add armv7-unknown-linux-musleabihf
|
|
cargo build --release -p chassis-tune --target armv7-unknown-linux-musleabihf
|
|
scp -q target/armv7-unknown-linux-musleabihf/release/chassis-tune {{board}}:/tmp/chassis-tune
|
|
scp -q config/tune.toml {{board}}:/tmp/tune.toml
|
|
ssh {{board}} "/tmp/chassis-tune sweep --backend bench --preset /tmp/tune.toml --preset-name {{preset}} --device {{device}} --esc-id {{esc_id}} --current-limit 1500 --samples {{samples}} --top-k 3 --i-know-the-wheel-spins {{opts}}"
|