Comments (13)
Yep, I added the comment when I wrote the code. However, the numerical error is insignificant in contrast to the error GPS has on its own. So, what would be a better option is adding the Kalman filter from the Maps example to the actual library to infer the true state.
I think the way the coordinates are calculated at the moment is super precise. I work with strings on the input and what might introduce the imprecision is the division by 60 at the end. But actually, you have the same problem when converting a rational number to a double.
from gps.js.
Hi Thomas,
thanks! That's a pretty good idea! Actually I avoided using fraction.js for exactly the reason of keeping the dependencies small. I would not make a breaking change on this, but as an optional feature, I will implement this.
Robert
from gps.js.
That was my guess as well which is why I was happy to find Fraction.js. I would assume it would still use Fraction.js for returning normal numbers with a fixed precision just like it is possible with something like decimal.js?
from gps.js.
It is! Fraction.js implements the valueOf() method, so that 123 + fracObj
works. From that perspective, there are no differences to be expected. But when I introduce Fraction.js as a regular dependency, it is a breaking change, since some users might check for fracObj instanceof Number
or something.
from gps.js.
So, I'm not quite sure how to implement it. When I require
the dep in the main gps.js file, things get ugly. One option would be to create a new main.js file, which modifies the number parser. This way gps.js still can be used in browsers without the need of a require
-environment.
from gps.js.
Okay, I think I found a way. Do you think it makes sense to get all numbers as fraction then?
Do you have an example where the coord parser does not work? I actually avoided numerical parsing to circumvent exactly these problems.
from gps.js.
On a feature branch, running the test suite results in this (this is just for demonstration, it can be fixed later):
- "lat": {
- "d": 8000
- "n": 99633
- "s": -1
- }
- "lon": {
- "d": 37500
- "n": 4906783
- "s": 1
- }
+ "lat": -12.454125
+ "lon": 130.84754666666666
The longitude is interesting here, as it has a period of 6. However, I wonder where this precision gain is necessary. The error is < 1e-15
. There are certainly other problems on GPS precision.
from gps.js.
I would still expect numbers to come out but without the calculation that can occur with plain node math. So just a normal number with a maximum precision. In that way there is no breaking change. So Fraction.js is only used internally to do the calculations.
from gps.js.
Okay, makes sense. But could you give an example where the current string-parsing approach misses accuracy? I wouldn't embed the whole library then, but try to calculate everything with rational numbers.
from gps.js.
Actually now I re-calculated the numbers again myself and it looks correct. I was first set of by a number that ended with a lot of sixes and then a seven which made it look incorrect.
I apologise for the confusion. Nonetheless the idea still might be valid. I see you have a comment on this in your parser already anyway.
from gps.js.
I agree with you. Thanks for the swift answers. Much appreciated.
from gps.js.
But what do you think about a state estimator right within the state
object? At the moment, latitude and longitude and speed are just collections of the underlaying data. More interesting would be a filter to give a more robust position. I added a naive implementation only for maps now, but this could help improve your case as well.
from gps.js.
I agree with you that it would be a cool addition and definitely useful in real-work applications!
I think it is a matter of whether it is within the scope of this package. But as the author you of course have the power to expand the scope from a parser of NMEA sentences to something a bit more.
Personally I think it would be cool and if you don't add it directly I will probably add it myself using your maps example.
from gps.js.
Related Issues (20)
- "Satelites" should be spelled "satellites" HOT 3
- Using with gpsd HOT 1
- Serial port closes after some time and gps.js randomly throws errors HOT 5
- Types are missing on npm release HOT 1
- Invalid GGA Fix For new GPS HOT 3
- zed-f9P ardusimple compatibility HOT 64
- Invalid GLL length HOT 2
- solution for make the weft more reliable ? HOT 9
- Invalid GGA length HOT 1
- GPS.DISTANCE returns distance in km rather than meters as specified in the function protoype. HOT 2
- can you add altitude to kalman filter? HOT 1
- Error: Invalid RMC length HOT 6
- TS typo HOT 1
- GSV merge is inconsistent, "blinking" satsVisible / it disappears and reappears. HOT 28
- Updating state based on multiple sentences HOT 6
- regarding previous Issue on kalman filter HOT 5
- Issue parsing BDGSV HOT 1
- GDOP and Hv HOT 9
- Adding state['heading'] for $GPHDT HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gps.js.