-
Notifications
You must be signed in to change notification settings - Fork 97
Python: Numba based SBP parsing [ESD-1154] #656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
|
Changes for Python 2.7. Not sure how legit these are. After this Python 3.5 still failing |
|
Changes for py3 |
|
Floating point parsing produces different results than the original I have a log from one TTFF run and fix reported in the json file from sbp2json.py serial_link.py Latter matches with Haskell |
|
Solution for above: |
|
String handling doesn't cope with the settings NULL delimiter |
|
|
|
Possible solution for the settings NULL delimiter issue: |
|
At the end of every Example: |
This doesn't work with |
|
Something like this instead: |
|
Regarding the newline on the payload value. https://buildmedia.readthedocs.org/media/pdf/pybase64/latest/pybase64.pdf
To mitigate it and convert to str object at the same time: |
|
Some failure happening and empty JSON object is printed in case of few messages sbp2json.py Expected Note also |
8efa20d to
bbae725
Compare
da9e562 to
601e04e
Compare
|
In case of CRC failure, few following messages are lost compared to non-jit sbp2json. |
76b960d to
1112801
Compare
3666963 to
60ee7f4
Compare
silverjam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this superseded by #667? Should we close this?
| } | ||
| """ | ||
|
|
||
| module_name = "parse_float_c" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Echoing comments on #667, it looks like we need to pick one of the options from here: https://cffi.readthedocs.io/en/latest/cdef.html and implement it so that we don't have to manually invoke this script prior to using sbp.jit.
| while len(data) < size: | ||
| d = self._read(size - len(data)) | ||
| if self._broken: | ||
| if not d or self._broken: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be an optional behavior? Do we know this will affect the console and it's command line utilities?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs investigation.
|
#667 currently contains exactly the same commits as this PR so in that sense this can be closed. |
|
Closing in favor of #667 |
This is paired with the following
piksi_toolsPR: swift-nav/piksi_tools#985Design notes
Numba based parsing for SBP classes. Adds various
numbaacceleratedget_*functions used to parse SBP data.Parsing floats
Floats are parsed using a module generated by another library,
cffi-- https://cffi.readthedocs.io/en/latest/ -- this is used to generate a Python native module that can parse and re-assemble float and double values from a stream of bytes. This was done becausenumbawas unable to generate code that could do the necessary bit banging.To generate this module, run the following:
This will generate
parse_float_c.so(andparse_float_c.c) which will be loadable by Python.Next steps
The next step from here would be to make the various
MsgWhatever.parse_membersmethods able to be JIT generated. This would require some more clever use ofTuple(( ... ))for the return values of the.parse_membermethod.Testing results
Without JIT’d
unpack/parse(with JIT’dcrcroutine though):With JIT’d
crc/unpack/parse:Haskell
sbp2jsonfor reference: