Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Dead reckoning Pull request #96

Merged
merged 14 commits into from
May 1, 2020
Merged

Dead reckoning Pull request #96

merged 14 commits into from
May 1, 2020

Conversation

edspark
Copy link
Contributor

@edspark edspark commented Apr 20, 2020

This pull request adds the code necessary to use u-blox's dead reckoning modules: ZED-F9R and NEO-M8U.

What's Been Added

Dead Reckoning Modules have a dedicated UBX message class: UBX-ESF (External Sensor Fusion). I've added functions for each ESF message: Status, INS (dynamics), Meas, and Raw. I've also added four example sketches to accomplish using the Dead Reckoning Modules from calibration, to pulling IMU data directly, to querying internal and external sensors, and finally seeing the vehicle's "attitude" (pitch, roll, and heading).

Questions

  • Every ESF message has an iToW field which is ignored in other functions so I didn't include them here. If needed I can add that to the structs I've created.
  • Data from ESF-MEAS can be pulled "number of measures" times, I was curious how best to implement that. Right now I fill a single byte into the relevant struct member. Is there a better way to stream this data?
  • Is there a better name for the example sketch folder other than Dead Reckoning?

Thanks @nseidle

@edspark edspark requested a review from nseidle April 20, 2020 17:24
@PaulZC
Copy link
Collaborator

PaulZC commented Apr 22, 2020

Hi Eli,
Apologies! V1.8.0 of the library has just gone live.
The good news is that the UBX packet checking is a lot more robust than previously. The new packetBuf helps a lot there.
The bad news is that sendCommand now expects a pointer to a packet buffer, not a copy of a packet buffer. Sadly that means that your calls to sendCommand need to change. From this:

if (sendCommand(packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED)

to this:

if (sendCommand(&packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED)

Sorry about that.
Also, looking at your code for getVehAtt, are you sure that works as you expect? I don't have any hardware to run your code on so I'm only going by eye, but checkUblox only checks the incoming serial or I2C data and passes it to process. It doesn't actually request the data. I think you might want to do a sendCommand too? And/or change processUBXpacket so it strips out the data for you - then checkUblox would work for you.
I'm really glad I looked at your code, because I hadn't realized that functions like extractByte and extractLong are hardwired to packetCfg payloadCfg. Which means they won't work on a custom packet. They are private functions - so the user can't see them or use them. So it probably doesn't matter. But I'll check to see if there are any unexpected implications. Worst case, I'll need to update them so they receive a pointer to the packet too.
All the best,
Paul

@edspark
Copy link
Contributor Author

edspark commented Apr 22, 2020

You are absolutely right @PaulZC, I rushed that one out and meant to put a sendCommand in the vehAtt function. I'll make those changes sometime tomorrow. Thanks for being so thorough. :godmode:

@PaulZC
Copy link
Collaborator

PaulZC commented Apr 27, 2020

Hi Eli (@edspark),
First the bad news: unfortunately I broke checkUblox in V1.8.0. You would have seen compiler errors for your dead_reckoning code, complaining about the number of arguments.
Now the good news: this is fixed in V1.8.1 (#101). Your code should compile again!
Apologies for the inconvenience... 😔
Paul

@edspark
Copy link
Contributor Author

edspark commented Apr 30, 2020

I believe this is ready - I merged the latest changes and it compiled successfully. I'm also seeing data coming back correctly. Let me know what else needs to get done @PaulZC, if anything!

@PaulZC
Copy link
Collaborator

PaulZC commented Apr 30, 2020

Hi Eli (@edspark),
If you're happy then I'm happy and will gladly merge the PR. But do you still want to give Nathan the chance to review it first? (The PR is still pending review by Nathan.)
Cheers,
Paul

@edspark
Copy link
Contributor Author

edspark commented May 1, 2020

Ah, I clicked that review button before I knew exactly who you were @PaulZC! I don't think it's entirely necessary for @nseidle but perhaps he has an opinion on the matter.

Copy link
Collaborator

@PaulZC PaulZC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @edspark ,
I don't have hardware to run this on (yet) so I can only give it a visual review. I did notice:
getEsfIns is missing a return(true);. Likewise for getEsfDataInfo and getEsfRawDataInfo.
Can you please add the new functions and constants to keywords.txt?
Most of the Serial.print's in your examples are missing the F() which will increase memory use (without the F they are allocated to RAM). This doesn't matter on the Artemis but is really important on the Uno.
Thanks!
Paul

@edspark
Copy link
Contributor Author

edspark commented May 1, 2020

Fixed print statements, added returns to function requested, and added functions and UBX message constants to keywords.txt. Thanks @PaulZC

@PaulZC
Copy link
Collaborator

PaulZC commented May 1, 2020

Good man! Merging...

@PaulZC PaulZC merged commit dc28c12 into master May 1, 2020
@PaulZC
Copy link
Collaborator

PaulZC commented May 1, 2020

Do you want to delete the branch? (Or do you want me to?)

@edspark edspark deleted the dead_reckoning branch May 1, 2020 17:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants