Difference between revisions of "Tunnel Extrapolation"

From Navit's Wiki
Jump to: navigation, search
(Tidy. Perhaps we should make a patch for this?)
Line 1: Line 1:
 
Tunnel extrapolation is an extrapolation function which uses the last available speed data to extrapolate the position of your vehicle inside a tunnel.
 
Tunnel extrapolation is an extrapolation function which uses the last available speed data to extrapolate the position of your vehicle inside a tunnel.
  
== How to Use ==
+
Add <tt>tunnel_extrapolation="12"</tt> to <tt><tracking ... ></tt>. You will need to play around with this value if you find that the cursor lags or runs ahead of your actual position. 12 stands for 1.2s extrapolation per gps rate.
  
To use tunnel extrapolation you need to patch <tt>navit/navit/maptool/osm.c</tt> by copying the three highlighted lines at the right place:
 
  
  if (! strcmp(k,"hazmat")) {
+
Note that this function will only work if the particular section of highway has the <tt>[http://wiki.openstreetmap.org/wiki/Tunnel tunnel=yes]</tt> key/value pair in OSM (and if it hasn't, go ahead and add it!). To process your own map, see [[OpenStreetMap#From_.bz2]]
  flags[access_value(v)] |= AF_DANGEROUS_GOODS;
 
level=5;
 
    }
 
          '''if (! strcmp(k,"tunnel") && ! strcmp(v,"1")) {'''
 
                  '''flags[0] |= AF_UNDERGROUND;'''
 
          '''}'''
 
  if (! strcmp(k,"note"))
 
  level=5;
 
  if (! strcmp(k,"name")) {
 
  attr_strings_save(attr_string_label, v);
 
  level=5;
 
 
 
<tt>navit/navit/track.c</tt> needs to be edited too:
 
 
 
          if (!vehicle_get_attr(tr->vehicle, attr_position_valid, &valid, NULL))
 
              valid.u.num=attr_position_valid_valid;
 
  '''#if 0'''
 
          if (valid.u.num == attr_position_valid_invalid) {
 
              tr->valid=valid.u.num;
 
          return 0;
 
          }
 
  '''#endif'''
 
          if (!vehicle_get_attr(tr->vehicle, attr_position_speed, &speed_attr, NULL) ||
 
 
 
 
 
 
 
Also, you need to add <tt>tunnel_extrapolation="12"</tt> to <tt><tracking ... ></tt>. You will need to play around with this value if you find that the cursor lags or runs ahead of your actual position. 12 stands for 1.2s extrapolation per gps rate.
 
 
 
 
 
Note that this function will only work if you process your own maps with maptool, and the particular section of highway has the <tt>[http://wiki.openstreetmap.org/wiki/Tunnel tunnel=yes]</tt> key/value pair in OSM (and if it hasn't, go ahead and add it!). To process your own map, see [[OpenStreetMap#From_.bz2]]
 
 
 
 
 
This feature will become permanent after successful testing.
 

Revision as of 16:42, 5 August 2012

Tunnel extrapolation is an extrapolation function which uses the last available speed data to extrapolate the position of your vehicle inside a tunnel.

Add tunnel_extrapolation="12" to <tracking ... >. You will need to play around with this value if you find that the cursor lags or runs ahead of your actual position. 12 stands for 1.2s extrapolation per gps rate.


Note that this function will only work if the particular section of highway has the tunnel=yes key/value pair in OSM (and if it hasn't, go ahead and add it!). To process your own map, see OpenStreetMap#From_.bz2