| 1 | 100103 17:25 this script used to feed navit a list of destinations, one at the time |
|---|
| 2 | and set the next waypoint as destination if you are near the current waypoint |
|---|
| 3 | |
|---|
| 4 | This makes it possible to set a route from A to B via C, |
|---|
| 5 | by just puting the lat/lon pairs in a file: |
|---|
| 6 | 51.1234;5.1234;Point A |
|---|
| 7 | 52.1234;6.1234;Point C |
|---|
| 8 | 53.1234;7.1234;Point B |
|---|
| 9 | |
|---|
| 10 | And if A is your starting point, that can be ommitted altogether. |
|---|
| 11 | |
|---|
| 12 | So instead of having the shortest route, or the fastest route, you can now plan a |
|---|
| 13 | route along a road with the maximum number of sharp bents in it. |
|---|
| 14 | (ideal for motorcycle lovers) |
|---|
| 15 | Or you can share a route you drove and enjoyed with others. |
|---|
| 16 | I think you can use itinerary files used by other navigation software too, if they have the fields in the same order. |
|---|
| 17 | |
|---|
| 18 | How does this all work? |
|---|
| 19 | Well, the script is intended to be placed in the subdirectroy "scripts" in your home directory (mkdir ~/scripts) |
|---|
| 20 | and to be started by cron every minute. (* * * * * if test -x ~/scripts/waypoint.sh; then ~/scripts/waypoint.sh; fi) |
|---|
| 21 | It will then read nmea data from gpsd (needs to be running anyway) |
|---|
| 22 | and convert that data with gpsbabel. (needs to be installed) |
|---|
| 23 | This wil give you the current lat/long. |
|---|
| 24 | If the current lat/lon is close enough to the current waypoint, the next waypoint is set as destination by a dbus call. |
|---|
| 25 | (libbinding_dbus.so" active="yes" needs to be set in navit.xml and dbus needs to be running, but it probably is) |
|---|
| 26 | |
|---|
| 27 | How close is close? |
|---|
| 28 | Well, that is defined by the MAX_DELTA parameter in the script. |
|---|
| 29 | for example, with max_delta=10000 and the waypoint at lat=52.100 and long 5.100 then any location between 52.000,5.000 and 52.200,5.200 |
|---|
| 30 | would be considered "close" (100 * 100 = 10000) |
|---|
| 31 | |
|---|
| 32 | 52.100,5.100 and 52.100,5.100 |
|---|
| 33 | with a max_delta of 1024 any location between 52.068,5.068 and 52.132,5.132 would be close ( 32 * 32 = 1024 ) -> aprox 10 Km radius at this latitude |
|---|
| 34 | with a max_delta of 100 any location between 52.090,5.090 and 52.110,5.110 would be close ( 10 * 10 = 100 ) -> aprox 2 Km radius at this latitude |
|---|
| 35 | with a max_delta of 9 any location between 52.097,5.097 and 52.103,5.103 would be close ( 3 * 3 = 9 ) -> aprox 0.1 Km radius at this latitude |
|---|
| 36 | If this script is ran every minute and your max speed is 120 Km/h (=2 Km/min) you don't want to go below max_delta=100, |
|---|
| 37 | or you might overshoot your waypoint. |
|---|
| 38 | |
|---|
| 39 | In case you can not reach your next waypoint because there is a roadblock or you changed your mind, do the following: |
|---|
| 40 | edit the ~/itinerary.csv file and remove the problematic waypoints. |
|---|
| 41 | Then remove the destination.set file (rm /dev/shm/destination.set). |
|---|
| 42 | The next time the script is run by cron the new waypoint is set as destination. |
|---|
| 43 | |
|---|
| 44 | It is easiest to keep a source file and copy that to the ~/itinerary.csv file, |
|---|
| 45 | the ~/itinerary.csv is removed and recreated every time you are near a waypoint. |
|---|
| 46 | |
|---|
| 47 | This script is free software, feel free to use and/or modify it in anyway you like, for example add fields to have a per waypoint max_delta. |
|---|
| 48 | Please don't operate a laptop/pda while driving, let someone else drive while you use this script. |
|---|
| 49 | |
|---|
| 50 | Have fun, adn drive safely! |
|---|
| 51 | |
|---|
| 52 | Kind regards, |
|---|
| 53 | Ed |
|---|