Opened 9 years ago

Closed 8 years ago

#609 closed defect/bug (fixed)

osd_speed_warner is dysfunctional

Reported by: polarbear_n Owned by: number6
Priority: major Milestone: version 0.2.0
Component: osd/core Version: git master
Severity: Keywords: OSD internal speedwarner GUI
Cc: nick@…

Description

The icon renders as a red circle on white background. No number visible. However I see a tiny corner of a white character '0' overlapping the red rim.

Looking into the code, it appears to draw just the fixed number 60 in default white colour on white background:

char *text="60"; ...; graphics_draw_text(this->item.gr, this->item.graphic_fg_text, NULL, this->item.font, text, p, 0x10000, 0);

'text' is not assigned another value in the draw function, and the item.graphic_fg_text is not assigned any useful colour.

Attachments (6)

osd_core.c.mod (46.2 KB) - added by tegzed 9 years ago.
Patch for initial functional version of speed_warner
attr_def.h.diff (690 bytes) - added by tegzed 8 years ago.
roadprofile.h.diff (30 bytes) - added by tegzed 8 years ago.
previously forgotten diff file for speed warner osd
osd_core.c.speedwarner.diff (6.7 KB) - added by tegzed 8 years ago.
Latest version of osd_core.c for speed warner as of 2010-09-04
roadprofile.c.diff (815 bytes) - added by tegzed 8 years ago.
osd_core.c.diff (1008 bytes) - added by tegzed 8 years ago.
fix to emit announcement only when both percent and fixed limit is exceeded ; No fallback to roadprofile speed if roadprofile maxspeed is not set

Download all attachments as: .zip

Change History (16)

Changed 9 years ago by tegzed

Patch for initial functional version of speed_warner

comment:1 follow-up: Changed 9 years ago by tegzed

Hello!

I have implemented an initial version of speed warner functionality. Please apply the attached patch osd_core.c.diff to use it. This version obtains the allowed speed the same way as osd text template tracking.item.route_speed so tracking needs to be enabled for this to work. It retrieves vehicle speed also from tracking. Currently it displays red circle and announces a warning when the allowed speed is exceeded by a 15km/h limit. When the speed drops below this limit, the circle becomes green. When tracking is not enabled, a gray circle is displayed to signal that the speed warner functionality is disabled. Please check if it's appropriate and if so please check in to svn.

Thanks, David Tegze

comment:2 in reply to: ↑ 1 ; follow-up: Changed 9 years ago by polarbear_n

Replying to http://wiki.navit-project.org/index.php/user:tegzed:

Thanks David for working on this. I have no build environment, so I only had a look into the code, and would like to comment as follows:

  • I like the idea to announce only when significantly over the limit, though a percentage e.g. 10% would be better than a fixed difference
  • the circle should turn red immediately when over the limit
  • the text in the symbol seems untouched from the previous version, i.e. still a white number on white ground, with the 'text' variable initialised to '60' and never changed:

graphics_draw_text(this->item.gr, this->item.graphic_fg_text, NULL, this->item.font, text, p, 0x10000, 0);

Finally we should prepare to switch to a new variable for legal speed, such as discussed in http://trac.navit-project.org/ticket/582#comment:3 once that is implemented.

comment:3 in reply to: ↑ 2 Changed 9 years ago by tegzed

Hello Polarbear_n,

Thanks for your ideas,

  • I was thinking about the percentage based limit before, but I chose the constant limit since at -for example- 50 km/m speed the 10% would only mean 5 km/h which can be exceeded easily :) while at 130km/h it' 13. What about using both a constant and a ratio based check and if both exceed condition is true an announcement is done.
  • It's ok from my side to turn the circle to red as soon as the limit is exceeded
  • Yes, text needs to be displayed correctly, in the next try I will implement this also
  • I will keep track of #582 and if there is an agreement on legal_speed I will include it also.

I also had some discussion with Cp15 about speed_warner and agreed that speed_exceed_limit (constant or ratio based) should be configurable as well as the enabling flag for announcement.

I will implement these changes and include the legal speed retrieval method of #582 when it's ready.

Bye David

comment:4 Changed 8 years ago by tegzed

Hello again,

I have done some improvements on speed warner osd, please check the attached diffs (osd_core.c.diff and attr_def.h.diff). I introduced three new attributes to control speed exceed limit and to enable/disable speach announcement for speed warner(speed_exceed_limit_offset,speed_exceed_limit_percent and announce_on). Both fixed and percentage based speed exceed limits are supported. The speed_exceed_limit_offset and speed_exceed_limit_percent attributes should be used inside the osd tag. When both percentage and fixed limit is exceeded an announcement is done. One can use the maxspeed attribute in roadprofile tag to set country specific max speed for that road type. To determine the allowed speed, OSM speed limit is taken into account in the first place (AF_SPEED_LIMIT) if exists, if not maxspeed attribute is checked in roadprofile. If this does not exist either the speed attribute of roadprofile is used (which is - as Cp15 said - a practical speed of the road).

Changed 8 years ago by tegzed

Changed 8 years ago by tegzed

previously forgotten diff file for speed warner osd

Changed 8 years ago by tegzed

Latest version of osd_core.c for speed warner as of 2010-09-04

comment:5 Changed 8 years ago by number6

<osd enabled="yes" type="speed_warner" w="50" h="50" x="30" y="-300" font_size="350" speed_exceed_limit_offset="15" speed_exceed_limit_percent="10" announce_on="1" label="text_only" />

Is the line you need in navit.xml. label="text_only" means just a text display

Changed 8 years ago by tegzed

comment:6 Changed 8 years ago by number6

  • Owner changed from Singesang to number6
  • Status changed from new to assigned

Feature added in Revision 3583

comment:7 Changed 8 years ago by number6

  • Resolution set to fixed
  • Status changed from assigned to closed

Changed 8 years ago by tegzed

fix to emit announcement only when both percent and fixed limit is exceeded ; No fallback to roadprofile speed if roadprofile maxspeed is not set

comment:8 Changed 8 years ago by tegzed

Hello Number6,

Thanks for committing the patch. I think you have left out the "no fallback to roadprofile.speed " part of the patch (requested by pb_8) that is removing the two lines:

1079	 	                else 
1080	 	                    routespeed=rprof->speed; 

Bye David

comment:9 Changed 8 years ago by number6

  • Cc nick@… added
  • Resolution fixed deleted
  • Status changed from closed to reopened

David,

That was for a different ticket :)

Can you and pb_8 hash out all the details for features, etc. I only want to commit one more patch for this feature - I'd prefer that everything is included in it!

N

comment:10 Changed 8 years ago by number6

  • Keywords OSD internal speedwarner GUI added
  • Resolution set to fixed
  • Status changed from reopened to closed

Resolved.

Note: See TracTickets for help on using tickets.