Repository navigation
CodeAIR's sensors read as its flight firmware reports them - #170
Merged
Merged
Conversation
Read from codeair-stm32-ref: each ranger, the flow sensor and the barometer read at their own rates and hold between reads; the gyroscope's raw counts are 16.384 a degree a second with x and y turned (the IMU sits half round) and carry a small bias; flow's deltaX follows forward motion and deltaY leftward motion with its sign turned, with the pitch and roll rates' share; the magnetometer reads 0 and the power manager's pm.* keep their starting values, as on CodeAIR; baro.asl comes from the pressure by the firmware's formula; stabilizer.pitch is stateEstimate.pitch; the accelerometer reads gravity turned into the body; the quaternion and motion.std are filled in. The battery is a LiPo cell on the firmware's voltage table that sags with the current and runs down as it flies. The motor test (motorPowerSet) spins CodeAIR's motors 1 to 4 at the powers set, heard and seen, and never flies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SS5gJ3p1XJhQBNJ3wv9z2z
|
Visit the preview URL for this PR (updated for commit 3660dfc): https://firialabs-open-editor--pr170-codeair-sensors-lxq2rkyt.web.app (expires Thu, 10 Dec 2026 15:18:37 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 81259a1fec315ca1af3747d225d9c7424890be3e |
… does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SS5gJ3p1XJhQBNJ3wv9z2z
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A simulated CodeAIR's sensors now report what CodeAIR's own flight firmware reports (read from its source,
codeair-stm32-ref), so FLY mission code compares against the same numbers it would see on the drone. World only: no page changes.What changes
GYRO): 16.384 a degree a second, x and y with the drone's sign (its IMU sits turned half round and raw counts are logged before alignment), with a small fixed bias.FLOW):deltaXfollows forward motion,deltaYleftward motion with its sign turned (the simulator had them swapped), plus the pitch and roll rates' share;motion.motionis the register's 176.pm.*: 3.7 V, level 10, never changing, as on CodeAIR (only the main board measures the battery).baro.aslfrom the pressure by the firmware's formula (1015.7 hPa reference), with noise and a slow wander.stabilizer.pitchequalsstateEstimate.pitch(one variable on the drone); the quaternion is filled in.power.battery_voltage()), for FLY's battery check.set_param('motorPowerSet.enable', 1)withm1tom4spins CodeAIR's motors 1 to 4 (front left, front right, rear left, rear right, asmotors.cmaps them and the Attitude lessons use them), heard and seen; it never flies.Calibration numbers that are estimates (battery capacity, hover current, the out-of-range ranger value) are listed in
sim/DESIGN.mdunder Calibration, to check on a drone.Tests: five new headless tests in
tests/sim.mjs(floor readings against the firmware, flow and gyro signs in flight, ranger rates, the motor test, the battery).node tests/sim.mjspasses on both MicroPython builds. The browser test (tests/sim-ui.mjs) is left to CI: on the shared host it stopped before CodeAIR at a CodeBot stepping check, from load there rather than this change. Also here: thecrtpmodule keeps one log packet, the newest, as the device's C module does (it kept two).Screenshot: a CodeAIR on the floor, motor test on, printing its sensors.
Design: the botblocks page "CodeAIR sensors in the simulator: design". Next: holding the drone and a ranger card (world), then the handles on the page.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SS5gJ3p1XJhQBNJ3wv9z2z