Champak Posted January 20, 2015 Share Posted January 20, 2015 (edited) I need help figuring something out. Sounding board or something please. I'm programming a turn by turn voice navigation in my app. I have it set up to only announce based on my bearings approach to a particular leg in the route (the calculations determine the bearings of the leg and checks my bearings and distance to determine if it should announce anything). I'm trying to figure out how I should determine not to announce that particular leg of the route anymore and move on to waiting for the next leg to come within range to announce. First thought: check if the coordinates is 180' from current bearings(behind me), but that would exclude if I made a right angle turn or merged. Second thought: simply check if the bearings of the coordinates changed from my current bearings, that would be a problem because on approach to the leg the bearings can change up to a 6' +/- swing. Third thought: take a range of bearings, maybe current bearings +/- 20' and anything beyond that would be considered as I passed the leg in the route. I'm uncomfortable with this one because I think it may have faults in it. After more thought I definitely don't think this will work Any help and ideas would be appreciated. Edited January 20, 2015 by Champak Link to comment Share on other sites More sharing options...
BrewManNH Posted January 21, 2015 Share Posted January 21, 2015 Set a flag that tells your script you've already announced the turn, then when you've made the turn reset the flag for the next upcoming turn. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Champak Posted January 21, 2015 Author Share Posted January 21, 2015 Thanks, but that won't work because it's not a matter of it will only announce once. It's like any navigation program, when you get within a certain range it starts announcing every so often, so it may announce the turn is coming up 1-4 times...depending on how fast I'm going or how far I set the detection distance. Link to comment Share on other sites More sharing options...
BrewManNH Posted January 21, 2015 Share Posted January 21, 2015 The programs/apps/devices I've used always make an announcement that tells me that the turn is coming up in (for example) 2 miles, then a new announcement tells me when to actually make the turn. Just use flags to tell your program you've made the announcements as they happen, and reset them after the points have been passed. If you wrote the algorithm correctly, you're going to have different tests being made for distances to the turn, so each flag will only be needed to be checked. once per turn. pseudo code If distance < 2 miles then If flag is false then do this flag = true endif elseif distance < 2 miles and > 1 mile then if thisflag is false then do this other thing thisflag = true endif endif If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Champak Posted January 21, 2015 Author Share Posted January 21, 2015 Ok I see what you're saying. The way I had it set up was to announce every 10-15 sec once I'm within a specified range until the point is passed. This way I can limit the amount of times the function is called. But reconfiguring it to make one specific announcement within specific ranges could be a good alternative and I guess I could keep the same timer callback. I guess that's me always looking for complicated solutions lol. I'll give it a try, thanks for the help. Link to comment Share on other sites More sharing options...
Champak Posted February 7, 2015 Author Share Posted February 7, 2015 So far it seems to be working well. I do have one issue however. Let's say there is an immediate point right after I pass a different point on the route (like an immediate turn or merge), or another function on a timer kicks in and I pass a coordinate that my app is waiting for, if either of those things happen my app ends up waiting for a coordinate that has already been passed and will never come and the voice nav will no longer progress. What are some thoughts on overcoming this? I need the app to KNOW that I passed a specific coordinate if I/the app ended up skipping it. My initial idea is to make a counter to track the distance I've traveled, but my issue with that is the constant calculations and time in running that function so often, or ever so often, constantly interrupting other functions happening. So what other ideas? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now