Feat/pool test#16
Merged
Merged
Conversation
* ci: add lint CI workflow and pre-commit config Add GitHub Actions workflow that runs pre-commit hooks on all pushes and PRs to main/master. Includes pre-commit-config with clang-format, ESLint, Prettier, and yamllint. Legacy auv/ directory is excluded. * ci: fix pre-commit hooks and auto-fix existing lint issues Fix ESLint/Prettier hooks to strip repo-root prefix from file paths before cd-ing into web_app/frontend_gui. Exclude tsconfig.json from check-json (it uses JSONC with comments). Auto-fix trailing whitespace, missing final newlines, and prettier formatting across the codebase. * ci: use local node_modules binaries instead of npx npx downloads fresh eslint/prettier versions in CI instead of using the packages installed by npm ci. Use ./node_modules/.bin/ directly. * ci: add missing eslint/prettier devDependencies to package.json The lint CI workflow fails because eslint, prettier, and all eslint plugins were missing from package.json. npm ci in CI never installed them, causing pre-commit hooks to fail with "No such file or directory".
* motor.hpp - created motor.hpp off of motor.py - set up pigpio in CMakeLists.txt - main.cpp is for testing motor.hpp * motor.hpp is a header file. motor.cpp doesn't exist. motor.hpp doesn't do stuff. * added some comments * added some comments * edits - moved files to src/drivers - edited gpioServo - it won't run with add_subdirectory(src/core) so I made it a comment * Revert "edits" This reverts commit cbc291e. * Revert "Revert "edits"" This reverts commit 193e9ba. * test motor without pi * spacing Now if you do BUILD_SIMULATION it'll run the little test code. If we want like an actual simulation we should do that. They just had some test code in motor.py that now works here. * made it fit the style better * comment * Added support for C language in cmake list and added lsm6dsox driver as a static library. platform_i2c.cpp so lis3md and lsm6dsox which are in c can communicate with pigpio. * test.cpp to test the motor also some imu stuff * test motor * for testing * Change code to use lgpio instead of pigpio Hopefully test should work now. * remove build * fixed pin * continued work on imu so it fits with lgpio better * cut out work on imu so it's just the motor code. It should still function the same. * added pool test code. It's untested. Pin numbers haven't been added yet. Also assuming gpio chip number is 0. * updated pins in pool_test * Replace lgTxServo with sysfs hardware PWM to fix motor stuttering * Replace sysfs PWM with RT-thread software PWM for Pi 5 sysfs hardware PWM (/sys/class/pwm/pwmchip0/) didn't work on Pi 5. Switch to hand-rolled 50Hz PWM running in a dedicated SCHED_FIFO thread that toggles GPIO via lgGpioWrite + clock_nanosleep. RT hardening to minimize jitter: - Pin PWM thread to CPU core 3 (pthread_setaffinity_np) - SCHED_FIFO priority 99 (max RT) - mlockall + 16KB stack prefault to avoid page faults - CMake defaults to Release build - add_compile_definitions(_GNU_SOURCE) for CPU_SET / pthread_setaffinity_np main.cpp and pool_test.cpp updated for new Motor API: constructor takes (pin, gpiochip handle), init() starts the RT thread, cleanup() stops it and frees the pin. * Busy-wait for PWM pulse width to eliminate ESC chatter The previous RT-thread approach still let clock_nanosleep wakeup jitter (~10-50us even at SCHED_FIFO 99) land on the LOW edge, since pulseEnd was computed from a fixed nextPeriod base. That wobbled pulse width enough for the T200 ESC to repeatedly lose sync. Fix: capture the real timestamp immediately after writing HIGH, compute pulseEnd from that, and busy-wait (clock_gettime loop, vDSO on aarch64) instead of clock_nanosleep. Pulse width is now pw +/- ~1us, well inside ESC tolerance. Period boundary still uses clock_nanosleep but its jitter no longer affects pulse width. Costs ~7.5% of core 3 CPU during each 1500us pulse, which is free since the thread is pinned there at priority 99. * Widen reverse test to 1450us to escape ESC dead zone 1475us sits on the edge of the T200 ESC's reverse deadband (~25us around 1500us neutral) and often reads as stopped. Forward at 1525us was working because the forward deadband happened to be just inside that margin; reverse needs more offset to cross reliably. * Arm 4 ESCs before user input in pool test; update prompt text pool_test.cpp was jumping straight from motor.init() into the speed input loop, so the first command hit unarmed ESCs and they ignored it. Add a 7-second 1500us neutral hold after init, mirroring main.cpp. Also update the speed-range prompt to reflect the ~25us ESC deadband we hit during single-motor testing: forward starts at ~1530, reverse at ~1470. Previous 1525/1475 text sat on the edge of the deadband. Add explicit <chrono> and <thread> includes for std::this_thread:: sleep_for (they were coming in transitively via motor.hpp). * Simplify motor.hpp: drop non-essential RT hardening, clean up time math Remove CPU core pinning (pthread_setaffinity_np), stack prefault, and _GNU_SOURCE — these were belt-and-suspenders that don't measurably affect the ESC chatter fix. The essential pieces remain: SCHED_FIFO 99, mlockall, and the busy-wait anchored to the real HIGH timestamp. Replace timespec arithmetic (addNs helper, two-field comparisons) with int64 nanosecond math via nowNs()/sleepUntilNs() helpers. Drop explicit memory_order_relaxed annotations in favor of default ordering — the performance difference at 50Hz is unmeasurable. Public API is unchanged; main.cpp and pool_test.cpp need no updates. * Revert "Simplify motor.hpp: drop non-essential RT hardening, clean up time math" This reverts commit 691158b. * Unfinished working example * Work on motor class * Motor api * Fix git ignore * Remove uneeded build artifacts and gitignore them --------- Co-authored-by: IBfettuccine <annyanibblet@gmail.com> Co-authored-by: SuhaanCoding <Suhaankhurana@gmail.com>
* added old server with updated motor func * ran linter, just pruning endlines * comment hot fix imma bypass da rules
… object (#13) * Working physical + sim gps * run formater * Run correct linter and add targets * change sim to share a common connection --------- Co-authored-by: Copilot <copilot@github.com>
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.
IMU stuff :p