logo       

Re: [ gpsdrive ] No developer question, but a question about an older versi: msg#00003

Subject: Re: [ gpsdrive ] No developer question, but a question about an older version of gpsdrive
Guenther Meyer wrote:
> Am Mittwoch 31 Oktober 2007 schrieb Thomas Schönhütl:
>
>   
>>> Instead of different rules for cities/highways could you make a list of
>>> the best time/distance-to-waypoint while at different speeds? Then we
>>> could create a single new formula. i.e. it doesn't have to be linear or
>>> rules based.
>>>
>>> Sorry it is poorly worded, I hope that makes sense.
>>>       
>> I come back to this topic, because I made some new experiences with the
>> speech output.
>>
>> I changed the factor 0.02 in ROUTEREACH to 0.08 and 0.12 to test the
>> behaviour of my slow Libretto with speechoutput.
>>
>> 0.08 (in definition of gpsdrive.h #define ROUTEREACH
>> (0.02+10*current.groundspeed/(3600*milesconv))) seems to be quite good
>> with a speed up to 50 km/h. The speechoutput will be given about 400 m
>> before the next waypoint.
>>
>> 0.12 seems to be quite good with a speed between 50 and 100 km/h. The
>> speechoutput will be given about 600 m before the next waypoint.
>>
>> 0.2 seems to be quite good with a speed over 100 km/h.
>>
>> I tried to rewrite the definition of ROUTEREACH in gpsdrive.h to
>>
>> #define ROUTEREACH1 (0.08+10*current.groundspeed/(3600*milesconv))
>> #define ROUTEREACH2 (0.12+10*current.groundspeed/(3600*milesconv))
>> #define ROUTEREACH3 (0.2+10*current.groundspeed/(3600*milesconv))
>>
>> and to add a line
>>
>> if (current.groundspeed <= 50)
>>
>>     
> as there is the speed already present inside the formula, shouldn't it be 
> changed to reflect the behaviour you need directly, instead of adding those 
> define and if statements?
>
> something like const1 + const2 * current.groundspeed ... if it's linear, 
> something else, if not.

Hi all,

thank you to Guenther Meyer for his ideas in this mail and in two 
personal mails.

I changed the code in gpsdrive.c (in my 2pre10 version, in current 
versions these lines are in routes.c!!!) and gpsdrive.h a little bit so 
that the speechoutput is near the next waypoint but far enough to react 
in a secure way with the car (change the lane or reduce the speed ...).

Here the lines in gpsdrive.h:

/*#define ROUTEREACH (0.02+10*groundspeed/(3600*milesconv))*/
#define ROUTEREACH1 (10*groundspeed/(3600*milesconv))
#define ROUTEREACH2 (15*groundspeed/(3600*milesconv))
#define ROUTEREACH3 (20*groundspeed/(3600*milesconv))
#define ROUTEREACH4 (30*groundspeed/(3600*milesconv))

For ROUTEREACH1-4 I use different speed "zones" in the file routes.c:

/*  test if we need to load another map */
void
testnewmap ()
{
  long long best = 1000000000LL;
  gdouble posx, posy;
  long long bestmap = 9999999999LL;
  gdouble pixelfactloc, bestscale = 1000000000.0, fact;
  gint i, j, skip, istopo, ncount = 0;
  gchar str[100], buf[200], mappath[500];
  gdouble dif;
  gchar nasaname[255];
  static int nasaisvalid = FALSE;

  if (importactive)
    return;

  if (posmode)
    {
      current_long = posmode_x;
      current_lat = posmode_y;
    }
  else
    {
      gdouble d;
/*  test for new route point */
      if (strcmp (targetname, "     "))
        {
          if (routemode)
            d =
              calcdist ((routelist + routepointer)->longitude,
                        (routelist + routepointer)->lat);
          else
            d = calcdist (target_long, target_lat);

/*        g_print */
/*          ("\nroutepointer: %d d: %.1f routenearest: %.1f routereach: 
%0.3f", */
/*           routepointer, d, routenearest, ROUTEREACH); */
          if (groundspeed <= 50)
          {
          if ((d <= ROUTEREACH1) || forcenextroutepoint)
            {
              forcenextroutepoint = FALSE;
              if ((routepointer != (routeitems - 1)) && (routemode))
                {
                  routepointer++;
/* let's say the waypoint description */
                  g_strlcpy (mappath, homedir, sizeof (mappath));
                  g_strlcat (mappath, activewpfile, sizeof (mappath));
                  saytargettext (mappath, targetname);

                  setroutetarget (NULL, -1);
                }
              else
                {
/*  route endpoint reached */
                  if (saytarget)
                    {
                      g_snprintf (str, sizeof (str), "%s: %s", _("To"),
                                  targetname);
                      gtk_frame_set_label (GTK_FRAME (destframe), str);
                      createroute = FALSE;
                      routemode = FALSE;
                      saytarget = FALSE;
                      routepointer = routeitems = 0;
                      switch (voicelang)
                        {
                        case english:
                          g_snprintf (buf, sizeof (buf),
                                      "You reached the target %s",
                                      targetname);
                          break;
                        case spanish:
                          g_snprintf (buf, sizeof (buf),
                                      "usted ha llegado a %s", targetname);
                          break;
                        case german:
                          g_snprintf (buf, sizeof (buf),
                                      "Sie haben das Ziel %s erreicht",
                                      targetname);
                        }
                      speech_out_speek (buf);
/* let's say the waypoint description */
                      g_strlcpy (mappath, homedir, sizeof (mappath));
                      g_strlcat (mappath, activewpfile, sizeof (mappath));
                      saytargettext (mappath, targetname);
                    }
                }
            }
            }
          if (50 < groundspeed <= 70)
          {
          if ((d <= ROUTEREACH2) || forcenextroutepoint)
            {
              forcenextroutepoint = FALSE;
              if ((routepointer != (routeitems - 1)) && (routemode))
                {
                  routepointer++;
/* let's say the waypoint description */
                  g_strlcpy (mappath, homedir, sizeof (mappath));
                  g_strlcat (mappath, activewpfile, sizeof (mappath));
                  saytargettext (mappath, targetname);

                  setroutetarget (NULL, -1);
                }
              else
                {
/*  route endpoint reached */
                  if (saytarget)
                    {
                      g_snprintf (str, sizeof (str), "%s: %s", _("To"),
                                  targetname);
                      gtk_frame_set_label (GTK_FRAME (destframe), str);
                      createroute = FALSE;
                      routemode = FALSE;
                      saytarget = FALSE;
                      routepointer = routeitems = 0;
                      switch (voicelang)
                        {
                        case english:
                          g_snprintf (buf, sizeof (buf),
                                      "You reached the target %s",
                                      targetname);
                          break;
                        case spanish:
                          g_snprintf (buf, sizeof (buf),
                                      "usted ha llegado a %s", targetname);
                          break;
                        case german:
                          g_snprintf (buf, sizeof (buf),
                                      "Sie haben das Ziel %s erreicht",
                                      targetname);
                        }
                      speech_out_speek (buf);
/* let's say the waypoint description */
                      g_strlcpy (mappath, homedir, sizeof (mappath));
                      g_strlcat (mappath, activewpfile, sizeof (mappath));
                      saytargettext (mappath, targetname);
                    }
                }
            }
            }
          if (70< groundspeed <=100)
          {
          if ((d <= ROUTEREACH3) || forcenextroutepoint)
            {
              forcenextroutepoint = FALSE;
              if ((routepointer != (routeitems - 1)) && (routemode))
                {
                  routepointer++;
/* let's say the waypoint description */
                  g_strlcpy (mappath, homedir, sizeof (mappath));
                  g_strlcat (mappath, activewpfile, sizeof (mappath));
                  saytargettext (mappath, targetname);

                  setroutetarget (NULL, -1);
                }
              else
                {
/*  route endpoint reached */
                  if (saytarget)
                    {
                      g_snprintf (str, sizeof (str), "%s: %s", _("To"),
                                  targetname);
                      gtk_frame_set_label (GTK_FRAME (destframe), str);
                      createroute = FALSE;
                      routemode = FALSE;
                      saytarget = FALSE;
                      routepointer = routeitems = 0;
                      switch (voicelang)
                        {
                        case english:
                          g_snprintf (buf, sizeof (buf),
                                      "You reached the target %s",
                                      targetname);
                          break;
                        case spanish:
                          g_snprintf (buf, sizeof (buf),
                                      "usted ha llegado a %s", targetname);
                          break;
                        case german:
                          g_snprintf (buf, sizeof (buf),
                                      "Sie haben das Ziel %s erreicht",
                                      targetname);
                        }
                      speech_out_speek (buf);
/* let's say the waypoint description */
                      g_strlcpy (mappath, homedir, sizeof (mappath));
                      g_strlcat (mappath, activewpfile, sizeof (mappath));
                      saytargettext (mappath, targetname);
                    }
                }
            }
            }
          if (groundspeed > 100)
          {
          if ((d <= ROUTEREACH4) || forcenextroutepoint)
            {
              forcenextroutepoint = FALSE;
              if ((routepointer != (routeitems - 1)) && (routemode))
                {
                  routepointer++;
/* let's say the waypoint description */
                  g_strlcpy (mappath, homedir, sizeof (mappath));
                  g_strlcat (mappath, activewpfile, sizeof (mappath));
                  saytargettext (mappath, targetname);

                  setroutetarget (NULL, -1);
                }
              else
                {
/*  route endpoint reached */
                  if (saytarget)
                    {
                      g_snprintf (str, sizeof (str), "%s: %s", _("To"),
                                  targetname);
                      gtk_frame_set_label (GTK_FRAME (destframe), str);
                      createroute = FALSE;
                      routemode = FALSE;
                      saytarget = FALSE;
                      routepointer = routeitems = 0;
                      switch (voicelang)
                        {
                        case english:
                          g_snprintf (buf, sizeof (buf),
                                      "You reached the target %s",
                                      targetname);
                          break;
                        case spanish:
                          g_snprintf (buf, sizeof (buf),
                                      "usted ha llegado a %s", targetname);
                          break;
                        case german:
                          g_snprintf (buf, sizeof (buf),
                                      "Sie haben das Ziel %s erreicht",
                                      targetname);
                        }
                      speech_out_speek (buf);
/* let's say the waypoint description */
                      g_strlcpy (mappath, homedir, sizeof (mappath));
                      g_strlcat (mappath, activewpfile, sizeof (mappath));
                      saytargettext (mappath, targetname);
                    }
                }
            }
            }
        }
    }

I repeat the block with the different speed "zones" four times, because 
I do not know how to write it in a correct and clean way ...

It works quite good.

Up to 50 km/h the next waypoint and the spoken text are given 10 seconds 
before I reach the waypoint.
Between 50 and 70 km/h 15 seconds, between 70 and 100 km/h 20 second and 
over 100 km/h 30 secondes before the next waypoint will be reached.

I tested it and it seems to work fine. The number of seconds can be 
changed according to the personal wishes of the driver before compiling 
the source code.

For my Libretto it is working perfect!

Thank you for the ideas again and may be the coders can include such a 
"choice" (how far away from the next waypoint the speechoutput will be 
given) in the current version.

Thomas.

P. S.: I changed the color of the banner which appears at the display if 
there is a way-name.dsc with text at every waypoint to RED instead of 
the default GRAY. It is much better to recognize!


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    politics.lenini...    audio.emagic.ex...    tex.texinfo.gen...    handhelds.linux...    ietf.sipping/20...    lang.erlang.gen...    cygwin.talk/200...    yellowdog.gener...    mozilla.devel.l...    xfree86.newbie/...    openbsd.ports/2...    db.oracle.devel...    kde.kalyxo.deve...    user-groups.lin...    bbc.cvs/2003-04...    gnu.libtool.bug...    redhat.k12osn/2...    emulators.wine....    freebsd.devel.d...    search.xapian.g...    java.izpack.use...    network.mrtg.us...    windows.total-c...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe