sensor_based_nav 1.0.3
sensor_based_nav: ^1.0.3 copied to clipboard
A Flutter package for sensor-based navigation using ONNX models.
Make predictions using a .onnx model file directly in the Flutter app.
Key Files #
- onnx_model.dart
: Loadsmodel.onnxand provides apredict()` function. sensor_based_nav_controller.dart: Collects sensor data and triggers the prediction.
How It Works #
-
HardwareSensorServiceprovides sensor data (accelerometer, gyroscope, magnetometer). -
SensorBasedNavController:- Collects 10 current sensor values (
_currentSensorSamples) - Stores historical values (
_historicalBursts) and past predictions (_historicalDeltas) - Prediction Trigger: Once 10 samples are collected,
OnnxModel.predict()is called with both current and historical data
[Code Reference] on GitLab: Sensor-Based-Navigation -> MainBranch - After prediction, old data stores are updated
- Data is updated every 100ms
- Collects 10 current sensor values (
-
The prediction result is displayed or used within the app.
Usage (App Team) #
-
Subscribe to predictions:
controller = SensorBasedNavController.instance; controller.predictions.listen((predictedValues) { print('Predicted values: $predictedValues'); }); -
Add as dependency
dependencies: sensor_based_nav: 1.0.0