-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Create common GSOF library #27058
Create common GSOF library #27058
Conversation
Flight tests complete. |
28ef39a
to
76f87b5
Compare
5abfae8
to
d8771a8
Compare
uint32_t | ||
AP_GSOF::SwapUint32(const uint8_t* src, const uint32_t pos) const | ||
{ | ||
uint32_t u; |
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.
can just return be32toh_ptr()
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.
If it's ok, I plan to convert all these in a follow up PR. This was moving the code to a library in an attempt not to change anything.
AP_GSOF::SwapUint16(const uint8_t* src, const uint32_t pos) const | ||
{ | ||
uint16_t u; | ||
memcpy(&u, &src[pos], sizeof(u)); |
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 use be16toh_ptr()
float | ||
AP_GSOF::SwapFloat(const uint8_t* src, const uint32_t pos) const | ||
{ | ||
union { |
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.
please use be32tofloat_ptr()
double | ||
AP_GSOF::SwapDouble(const uint8_t* src, const uint32_t pos) const | ||
{ | ||
union { |
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.
be64todouble_ptr()
} | ||
|
||
double | ||
AP_GSOF::SwapDouble(const uint8_t* src, const uint32_t pos) const |
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.
I know it's existing code but we normally done use CamelCase... or maybe it's Pascal case.
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.
or remove the function
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.
Ditto above
Valgrind results:
|
Valgrind doesn't work on the autotest right now:
|
8435afc
to
3dec5f3
Compare
@peterbarker I am still facing the valgrind problem after rebasing. Can you try running the test on your system? |
3dec5f3
to
59e078a
Compare
I just rebased on master, the valgrind test doesn't work still. Considering this was already flight tested successfully, can we merge it? AP_GSOF doesn't call |
Need to fix CI:
|
This works:
This doesn't.
Until we have a better option for loading in a data file, I'm disabling the binary file test. |
@Ryanf55 where are we up to with this? |
I've met the requests of last dev call from Randy. The changes of functions to use the functions in spare-endian is ready for a follow PR. This has been flown and has unit tests. Therefore, I would like to request a merge. |
* Add tests too Signed-off-by: Ryan Friedman <[email protected]>
* Add tests too Signed-off-by: Ryan Friedman <[email protected]>
* Add tests too Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
c25b6c9
to
8af24af
Compare
Purpose
Factor out the parser into its own library so we can use it in EARHS for the PX1. Do it with as little change to the code as possible.
Testing Done
SITL test flights in a few different modes on copter and plane. I've also tested on the bench hardware connected to SITL. and a flight test.
What changed
95% of the code is the same as before, the only difference is that the number of expected packets (the
valid
count), is now exposed up to higher levels. The parser used to hard-code 5 different packet types, which breaks down in EARHS.Otherwise, the parser no longer depends directly on types in AP_GPS, so there are now a function in AP_GPS_GSOF called
pack_state_data
to go from the packed GSOF data into the AP_GPS struct.Longer term, I'd like to switch to a bitfield on which packets were received per DCOL frame.
Next up
Add the EARHS. To see the WIP branch, see here: https://github.com/Ryanf55/ardupilot/tree/27033-gsof-add-eahrs-driver
Issue