Skip to content

Commit

Permalink
Add audible speed advisories (#628)
Browse files Browse the repository at this point in the history
* change min speed to 7 km/h

* put instruction under sg

* line length

* some improvements

* adapt routing distances

* Create separate audio service

* Finish refactoring (reroute and button)

* Add some more comments

* Properly reset audio instructions service

* Add setting for using audio routing instructions seperately

* Start fixing the wait for green audio information

* Fix play audio when waiting for green

* First speed advisory instructions only implementation

* Fix audio instruction min distance

* Place audio speed advisory option in main settings

* Fix calc second next phase

* Enhance audio speed advisory instruction generation and start adding test cases to validate this functionality

* Add test data for audio text generation

* Add new text generation algo with test cases

* Round distance to sg up to 25m accuracy

* Add audio service to enable hearing music and speed advisory instructions

* Fix speech rate

* Add prediction not valid anymore and adjust speechrate values

* Refactor code

* Fix countdown exact second

* Fix unnecessary creation of instructions

* Add audio speech rate to main settings

* Add speed advisory to tracking data

* Add speed advisory green in 5 to track

* Add check for division with 0

* Fix green in 5 set active

* Refactor code, removing routing instruction generation

* Refactor speed advisory instruction trigger range

* Refactor comments

* Minor fix audio init and settings exception

* Refactor function description

* Refactor function description

* Fix last speed values and add drescription for default value

* Use average instead of median

* Remove unused routing instruction code

* move speech rate to normal settings

* Add toast and hint that audio is deactivated when the user selects a SG manually

* Fix prediction invalid when user selects sg

---------

Co-authored-by: P4u14 <paula.schreiberailbox.tu-dresden.de>
Co-authored-by: PaulPickhardt <[email protected]>
  • Loading branch information
adeveloper-wq and PaulPickhardt authored Sep 19, 2024
1 parent 86e5769 commit 83f0041
Show file tree
Hide file tree
Showing 21 changed files with 2,734 additions and 782 deletions.
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
PODS:
- audio_session (0.0.1):
- Flutter
- battery_plus (1.0.0):
- Flutter
- connectivity_plus (0.0.1):
Expand Down Expand Up @@ -122,6 +124,7 @@ PODS:
- Flutter

DEPENDENCIES:
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- battery_plus (from `.symlinks/plugins/battery_plus/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
Expand Down Expand Up @@ -163,6 +166,8 @@ SPEC REPOS:
- Turf

EXTERNAL SOURCES:
audio_session:
:path: ".symlinks/plugins/audio_session/ios"
battery_plus:
:path: ".symlinks/plugins/battery_plus/ios"
connectivity_plus:
Expand Down Expand Up @@ -209,6 +214,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/wakelock_plus/ios"

SPEC CHECKSUMS:
audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
battery_plus: 1ff2e16ba75af2a78387f65476057a390b47885e
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
Expand Down
15 changes: 15 additions & 0 deletions lib/ride/models/audio.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
enum SpeechRate {
fast,
normal,
}

extension SpeechRateDescription on SpeechRate {
String get description {
switch (this) {
case SpeechRate.fast:
return "Schnell";
case SpeechRate.normal:
return "Normal";
}
}
}
3 changes: 3 additions & 0 deletions lib/ride/models/recommendation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class Recommendation {
/// The predicted current signal phase, calculated periodically.
final Phase calcCurrentSignalPhase;

/// The timestamp of the last recommendation.
final DateTime timestamp = DateTime.now();

Recommendation(
this.calcPhasesFromNow, this.calcQualitiesFromNow, this.calcCurrentPhaseChangeTime, this.calcCurrentSignalPhase);
}
Loading

0 comments on commit 83f0041

Please sign in to comment.