I have a GNSS ZED-F9P with an ESP32 MicroMod and my code is a combination of Example15_NTRIPClient and Example10_GetHighPrecisionPositionAndAccuracy of the SparkFun_u-blox_GNSS_v3 library.
When I use Serial everything works fine and I get something like “RTCM pushed to ZED: 935”.
But I want to use rosserial instead of Serial to output the position data via ROS messages to the rest of my robot system - the RTCM data is still pushed to the ZED with a WiFiClient named ntripClient just like in the original example code and just like in the exact same code with Serial instead of rosserial.
Unfortunately, in the rosserial version of my code, I have to wait over 30 seconds until the RTCM data is available over the WiFiClient after the serverRequest was send, while the Serial version takes only 50 milliseconds for that.
I attached my code as a zip, it needs a secrets.h file with all the credentials like Example 15 or 10.
Does anybody know why using rosserial is slowing down my WiFiClient or the response from the NTRIP server so much?
I would double-check any and all timing-related portions of the code, ensure the baud rates match up, etc…it sounds like something is causing a hang-up/delay somewhere
Does pushing/pulling data from other sources work more quickly/as expected?
I am not very experienced with Arduino or C/C++, and so I mistakenly took snprintf as something Serial related and deleted them since rosserial and Serial don’t mix well. So credentials have not been sent in the right format or at all and I am surprised that I even got correction data at all every 30s with that.
After I fixed that, I usually get a full RTCM frame every 400-1100 ms, depending on the source for the correction data. That’s still way more than the 50 ms that the original Example_15 takes, but less than one-thirtieth of what I had before.
I tried to improve that by reducing the buffer size of rosserial, to no effect.
But I changed the code so that the loop doesn’t wait for the RTCM data to become available any more, since I need new position data more often than every 400 ms at best.
Thanks for your help and if anybody has an idea why my code still takes longer until RTCM data is available please share!