Move sensor building logic to a separate class and file
Don't use templates for RegisterInterface/I2CImpl/SPIImpl
This started getting ridiculous, now we can actually maintain it.
Make BNO085 work again
Add BNO to automatic detection, remove a bunch of others
Not all IMU types are enabled right now due to code size optimization, but it could be expanded in the future with optimization of Softfusion.
Pick IMU type automatically by asking it
* [ICM45*] Fix processing bad samples and stack overflow panics
1. At startup, we were receiving invalid samples from the IMU and passing it to
VQF. This causes huge initial rotations and accelerations that takes time
for VQF to eliminate.
Fix is to check the header to see if the data is present. Also had to add a
check for invalid gyro samples even though it is present.
2. During play, the tracker would rarely go haywire and jump into a random
position. I suspect this is caused by a stack overflow, which causes the
tracker to panic. Combined with problem (1), whenever the tracker restarts,
it would send huge rotations and accelerations to the server. This causes
the jump.
Fix is to make the read_buffer static, so that it's reserved on the BSS
segment instead of the stack. I noticed this because I was getting panics
when I tried to increase the size of the read buffer, or declared some new
stack variables.
After implementing these two fixes, rotation and acceleration are stable at
startup, and I am able to make modifications to the icm45base code without
randomly encountering panics.
* Always read one fewer packet to prevent AN-000364 2.16 errata
On ESP32, latency is high when TPS is low. When you go from not-moving to
moving, there is also some latency before movement starts. This is because the
ESP32 goes into sleep mode. This change eliminates sleep mode, which brings
latency in line with ESP8266-based trackers.
1. At startup, we were receiving invalid samples from the IMU and passing it to
VQF. This causes huge initial rotations and accelerations that takes time
for VQF to eliminate.
Fix is to check the header to see if the data is present. Also had to add a
check for invalid gyro samples even though it is present.
2. During play, the tracker would rarely go haywire and jump into a random
position. I suspect this is caused by a stack overflow, which causes the
tracker to panic. Combined with problem (1), whenever the tracker restarts,
it would send huge rotations and accelerations to the server. This causes
the jump.
Fix is to make the read_buffer static, so that it's reserved on the BSS
segment instead of the stack. I noticed this because I was getting panics
when I tried to increase the size of the read buffer, or declared some new
stack variables.
After implementing these two fixes, rotation and acceleration are stable at
startup, and I am able to make modifications to the icm45base code without
randomly encountering panics.
* BNO085 add more Features and Readouts to the lib
* BNO085 add
- Experimental compiler flags for disable Calibration
- Temp Readout (all 1 sec)
- Inspection only send when updated
- added conginue as 1 imu.dataAvailable() only reads out 1 packet of data
* BNO085 add source of info
After a reboot of the tracker the optional sensor did show up on the server too.
This is because a sensor packet was sent from all sensors including empty and unknown.
This should hopefully fix the issue.
It is a fast fix. It probably would be better to move all this check to sensor, and if the sensor has a chang set the flag, and reset the flag if the function gets called.
* Refactor toggles into separate class
* Add vqf toggles to config bits
* Load toggles into the sensor
* Mark correct toggles as supported for VQF
* Zero out calibration if it's disabled for softfusioncalibration
* Fix BNO085 typo
* Formatting
* hotfix: scan for IMU on bus twice
* hotfix: never fully empty icm45 fifo
* leave one packet, not one byte
* Formatting
---------
Co-authored-by: gorbit99 <gorbitgames@gmail.com>
* fix_sensorConfigData Magnetometer not avaliable on Server
* fix formating
* Send Sensor Configuration changes to Server.
before the Magnetometerchanges would not have been sent to the Server.
* Formating
* Refactor packets into structures
* Remove left in packet code
* Swap multi-byte data to big endian
* Refactor convert_to_bytes to use std::reverse instead
* Missed removing some old code
* Fix convert_to_chars refactor
* Add comment to legacy fields
* Add back rest of cut off comment
* Move temperature reading into the FIFO whenever possible (no love for MPU)
* Calculate gradient and feed into VQF
* Per sensor VQF params
* Split out classic softfusion calibration
* Cleanup
* Nonblocking calibration implemented
* Oops
* Formatting
* Make sure it actually compiles
* Use calibrated ZRO values
* Fix compilation errors and warnings
* Send temperature in correct place
* Add DELCAL command
* Slightly optimize ICM45 fifo handling
* Implement time taken measurer
* Precalculate nonblocking zro change
* Adjusted debug.h
* Reduced ICM45 accel rate to 102.4Hz
* Poll sensor at the same time we send data
* I hate git again
* Undo icm45 optimization
* Don't copy memory on ICM45 reads
* Change relevant doubles to floats
* Remove unnecessary union
* Fix guards to profiler
* Move temperature reading into the FIFO whenever possible (no love for MPU)
* Calculate gradient and feed into VQF
* Per sensor VQF params
* Split out classic softfusion calibration
* Cleanup
* Nonblocking calibration implemented
* Oops
* Formatting
* Make sure it actually compiles
* Use calibrated ZRO values
* Fix compilation errors and warnings
* Send temperature in correct place
* Add DELCAL command
* Slightly optimize ICM45 fifo handling
* Implement time taken measurer
* Precalculate nonblocking zro change
* Adjusted debug.h
* Reduced ICM45 accel rate to 102.4Hz
* Poll sensor at the same time we send data
* Undo icm45 optimization
* Don't copy memory on ICM45 reads
* Change relevant doubles to floats
* Remove unnecessary union
* Fix guards to profiler
* Fixes after rebase
* Fix after rebase
* Fix formatting
* Make SPI work
* Revert "Make SPI work"
This reverts commit 92bc946eaa.
* Rename to RuntimeCalibration
* Disable profiling
---------
Co-authored-by: Eiren Rain <Eirenliel@users.noreply.github.com>
* Add calibration reading commands for BNO08X
* Disable accelerometer calibration 1 minute after start up on BNO08X
Also save dynamic calibration periodically
* Work on new sensor interface to abstract I2C hardware
* Fix compile errors
* Abstract int pin and add multiplexer libraries
* Update IMU list to use new interfaces
* Make other IMUs definable, not only BNOx
* Fix build for ESP32
* Add TPS tracking code
Rename IMU_DESC_LIST to SENSOR_DESC_LIST
Start work on many-imu glove support
* Add PCA9546A support & glove imus list
* WIP use pointers properly
* I love C++ <3
* c++ is magic
* Fix build error because of typo
* Fix warnings
* Fix pinouts and some other issues
* Fix I2C with multiplexer
* Implement sending bone position
Implement sending flex data,
Minor refactoring
* Add tracker type to the protocol
* Work on analog sensors support
* Fix build errors
* Fix rebase conflict
* Apply formatting
* Update protocol to match server
* Fix thumb bone names
* Add an important comment
* Fix protocol compatibility
* Update defines for default configuration
* Minor comments and cleanups
* Format defines
* Formatting
* Formatting with proper clang
* Fucking clang
* Minor fixes after merge
* Fix formatting
* Remove unnecessary virtual keyword
* Remove delay on I2C clear error so OTA doesn't break
* Address some of the review comments
* Fix formatting
* Minor include imporvement
* Make new defines enums
* Fix build for sfusion
* Add IMU timeout detection to `SoftFusionSensor`
* Early return, use constexpr
* Define a sensor timeout error code
* Use enum instead of define
* Avoid false timeout on timer overflow
* Revert "Avoid false timeout on timer overflow"
This reverts commit f4c2835c7f.
* Use millis instead of micros
* Use SH-2 error codes
* Add rest calibration detection for the sensors that support it
* Resend sensor packet on calibration
* Renamed completedRestCalibration to hasCompletedRestCalibration
* Log when rest calibration is completed
---------
Co-authored-by: Eiren Rain <Eirenliel@users.noreply.github.com>
* Make I2Cscan non-blocking
* Address suggestions
* Use portExclude again
* Re-add some comments
* It's 8 AM and I'm allowed to be stupid
* No more while(true)
* More cleanup
* ...and more
* even more!
* Thanks clang-format
* Do not scan the same port twice
---------
Co-authored-by: Eiren Rain <Eirenliel@users.noreply.github.com>
* Reverse IMU I2C address from supplement to full
* Formatting fix
* More formatting
* Make suggested change to improve compatibility with lazy people
* Create CODEOWNERS
* Fix include and C++ standards