I need You help with SPEED parameter of location sensor because I receive stragne ( to low ) readings. I have found some information on forum that I need to x 1.944 the result to receive km/h. BUT final result is still to low according to real car speed ( almost 2 times ).
Where did you get the conversion factor of 1.944 Lucas? I think you are converting m/sec to knots, not km/hour.
The 'speed' provided by the LocationSensor is 'average' speed between two successive LocationChanged events. The reported value is not instantaneous speed. Understanding the difference between average and instantaneous may be the reason you do not achieve the results you expect. You need to understand the speed units - the LocationSensor reports speed in m/sec units), convert to km/hr if you want speed in kilometers (1000 meters) and also be aware m/sec must be addressed to convert kilometers/ hour . m/sec * km/1000m * 60 sec/min * 60 min/hour = km/hour .
To convert m/sec to km/hr use this formula:
18 * m/sec / 5 = km/h.
1 meter/second is equal to 3.6 km/h or 1.944 knots .
Does this help Lucas?
Have you read:
If you have not yet read the discussions, they may provide a better understanding of what you are trying to achieve.
Good luck. Just use the correct conversion factor.
Dear @craVe_DRIVE (Lucas),
I've recently used the LocationSensor to enrich my own Digital Dashboard (AI2 coded) on my car.
The device I'm using is a Lenovo 8" tablet (connected via BT the the EOBD port of my car) fitted with GPS sensor.
I use these blocks to configure the LocationSensor :
in the Screen1_Init procedure I set:
locationsensor Distance = 0 => no minumum distance to fire the event
locationsensor timeInterval = 1000 => 1 second minimum trigger time (comment: it should be according to the theory, but typically it rises far less than 1 second when the GPS has started to fix the points, at least this is the performance on my Lenovo pad)
locationsensor Enabled = True
In the LocationChanged event the following blocks:
As @SteveJG said, please be careful on the conversion factor ! (it must be 3.6 to convert from m/s to Km/h).
As I told, this code is fitted on my pad where I acquire on the vehicle's CAN bus also the speed computed by the Engine Control Unit. The two speeds are fairly comparable, (also with 1 decimal) after the GPS has successufully started to fix the points. As @SteveJG also said, the sensor needs at least two consecutive fixes to compute the speed. This can cause a little discrepancy between the two speeds (GPS vs CAN) in fast accelerations (positive or negative) since the GPS is a bit slower, in these cases, but in "normal" conditions (i.e. if you don't drive "fast and furious" ) the GPS speed is following the "true" one with a good dynamics.
Lastly: when I stop the car (i.e. at the stoplight) the CAN speed goes to 0 immediately, while the GPS's one shows still two decreasing values before getting 0. The opposite when you restart: the GPS speed still shows 0 for a couple of seconds when the CAN speed already shows values greater than 0.
My hint is to don't care about this little and fast disappearing discrepancy and to better keep your attention to the road instead ...
Best wishes !!!
Which blocks exactly? Can you provide a screenshot?
Did you enable GPS?
Does gps show in property AvailableProviders?
Did to set provider to gps and lock the provider?
Aternatively,
you could take a look to the following extensions:
com.KIO4_NmeaMessage.aix by @Juan_Antonio (web site KIO4.com) and/or to com.KIO4_LocationSensor..