Introduce announce off route for GPX navigation

This commit is contained in:
Victor Shcherb 2013-07-24 20:40:26 +02:00
parent 0879baacef
commit ad528473b1
3 changed files with 24 additions and 1 deletions

View file

@ -11,6 +11,9 @@
<asset source="voice/es/ttsconfig.p" destination="voice/es-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/it/ttsconfig.p" destination="voice/it-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<!-- <asset source="voice/pl-tts-old/ttsconfig.p" destination="voice/pl-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" /> -->
<asset source="voice/pl/ttsconfig.p" destination="voice/pl-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/cs-tts-old/ttsconfig.p" destination="voice/cs-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/fi-tts-old/ttsconfig.p" destination="voice/fi-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
@ -21,7 +24,7 @@
<asset source="voice/ko-tts-old/ttsconfig.p" destination="voice/ko-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/lv-tts-old/ttsconfig.p" destination="voice/lv-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/nl-tts-old/ttsconfig.p" destination="voice/nl-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/pl-tts-old/ttsconfig.p" destination="voice/pl-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/pt-tts-old/ttsconfig.p" destination="voice/pt-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/ro-tts-old/ttsconfig.p" destination="voice/ro-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />

View file

@ -226,6 +226,9 @@ public class RoutingHelper {
log.info("Recalculate route, because correlation : " + dist); //$NON-NLS-1$
calculateRoute = true;
}
if(dist > 350 && currentGPXRoute != null) {
voiceRouter.announceOffRoute(dist);
}
}
// 3. Identify wrong movement direction
Location next = route.getNextRouteLocation();

View file

@ -29,7 +29,9 @@ public class VoiceRouter {
private int currentStatus = STATUS_UNKNOWN;
private float playGoAheadDist = 0;
private long lastAnnouncedSpeedLimit = 0;
private long lastAnnouncedOffRoute = 0;
private long waitAnnouncedSpeedLimit = 0;
private long waitAnnouncedOffRoute = 0;
private long lastAnnouncedSpeedCamera = 0;
private long lastAnnouncedWarning = 0;
@ -183,6 +185,21 @@ public class VoiceRouter {
}
public void announceOffRoute(double dist) {
long ms = System.currentTimeMillis();
if(waitAnnouncedOffRoute == 0 || ms - lastAnnouncedOffRoute > waitAnnouncedOffRoute) {
CommandBuilder p = getNewCommandPlayerToPlay();
if (p != null) {
p.offRoute(dist).play();
}
if(waitAnnouncedOffRoute == 0) {
waitAnnouncedOffRoute = 30000;
} else {
waitAnnouncedOffRoute += 10000;
}
lastAnnouncedOffRoute = ms;
}
}
public void announceAlarm(AlarmInfo alarm) {
if(alarm == null) {