vicha

  • *
  • 6
GPS Data (UBX)
« on: July 26, 2017, 03:00:44 pm »
Hey guys,

Question regarding GPS data (UBX) protocol specifically and GPS in general. When connecting a GPS module to the flight controller, for example Flexi port (GPS / 19200 / UBX in my case), how does the communication work? Does the flight controller request for a packet or just wait for the GPS module to start streaming data?

The reason I am asking is because im trying to replicate GPS frames from a UBLOC GPS module (UBX protocol) using an Arduino. So when I connect the arduino through the flexi port, it would detect it as a GPS module.

Mateusz

  • *
  • 808
Re: GPS Data (UBX)
« Reply #1 on: July 26, 2017, 03:23:24 pm »
Afaik Revo configures GPS by setting model and some parameters and than just reads the packets.

vicha

  • *
  • 6
Re: GPS Data (UBX)
« Reply #2 on: July 26, 2017, 03:37:41 pm »
Thanks for the quick reply Mateusz. Yeah I had a feeling as well, just not entirely sure which data it looks for exactly to consider it as a "GPS module".

On my Arduino, im just streaming 4 different UBX frames (UBX-NAV-POSLLH, UBX-NAV-DOP, UBX-NAV-SOL, UBX-NAV-VELNED) repeatedly every 200ms.

Anyone have an idea where to look for this data in the librepilot source?

Re: GPS Data (UBX)
« Reply #3 on: July 26, 2017, 03:45:45 pm »
flight/modules/GPS/*

The Ublox GPSs run in one of two modes depending on Ublox version.  For newer versions it uses a PVT packet.  For older versions it gathers three different packets and makes sure they came from the same internal calculation (calculation moment in time).  There are other packets that are used as well.  ubx_autoconfig.c is the file that tells the GPS which packets to send automatically and how often to send them.

vicha

  • *
  • 6
Re: GPS Data (UBX)
« Reply #4 on: July 26, 2017, 04:08:53 pm »
flight/modules/GPS/*

The Ublox GPSs run in one of two modes depending on Ublox version.  For newer versions it uses a PVT packet.  For older versions it gathers three different packets and makes sure they came from the same internal calculation (calculation moment in time).  There are other packets that are used as well.  ubx_autoconfig.c is the file that tells the GPS which packets to send automatically and how often to send them.

This is exactly what I am looking for, thanks a lot TheOtherCliff.

I quickly browsed the ubx_autoconfig.c, and it shows two available versions ubx6 & ubx7. I guess I was on the right track for making my arduino a version 6 ubx replica. It seems ubx7 looks more efficient and easier to replicate  ;D. I'll give it a shot and let you guys know whats up! Thanks again.

vicha

  • *
  • 6
Re: GPS Data (UBX)
« Reply #5 on: July 27, 2017, 08:44:35 am »
Good news! I managed to get Librepilot to accept my Arduino as a GPS module. Right now it is a bit unstable (keeps changing from NO GPS to NO FIX) but I do see values change in the System -> Data Object properties tab.

Could the instability be due to the rate I'm sending my frames? In the ubx_autoconfig.c, the .rate (.rate = 1) is in what unit (s, ms, ns, hz)?

vicha

  • *
  • 6
Re: GPS Data (UBX)
« Reply #6 on: July 27, 2017, 02:29:44 pm »
Okay, progress is good so far. Its a stable No Fix on Librepilot (fully accepted my Arduino as a GPS module  ;D). All I had to do was disable UBXAutoConfig and everything was fine. The issue now is that its status is always "NO FIX" which should change by modifying the data on the frames. Will update as soon as done.

Mateusz

  • *
  • 808
Re: GPS Data (UBX)
« Reply #7 on: July 27, 2017, 03:13:30 pm »
Okay, progress is good so far. Its a stable No Fix on Librepilot (fully accepted my Arduino as a GPS module  ;D). All I had to do was disable UBXAutoConfig and everything was fine. The issue now is that its status is always "NO FIX" which should change by modifying the data on the frames. Will update as soon as done.

What are you trying to do ? Add Mag sensor data to the GPS stream ? It would be pretty cool, someone did that but never shared the code and code is buggy. Most DJI GPS clones use that though.
One could also apply some filtering with additional sensors, if there was an accel, and there was couple of meters spike, such read could be rejected, unfortunetly some of these spikes introduce systematic error, jump and slowly going back to original possition, which is hard to distinguish as a noise. Perhaps better thing to do is to change patch antenna into helical one, which has less multi-path reflections:)

vicha

  • *
  • 6
Re: GPS Data (UBX)
« Reply #8 on: July 27, 2017, 03:27:26 pm »
Hey Mateusz! That magnetometer idea is pretty nifty, should check it out sometime! However that's actually not my goal.

I'm currently working on a project to control multiple mini quads to perform a show. I'm using the OPTITRACK camera motion system to track each drone in 3D space. I translate the x, y, z positions into lat,lon,alt values and send it into the drone through GPS frames (faking gps frames).

I've gone through several solutions to control multiple mini quads (ROS / CRAZYFLIE/ MAVROS etc...) and found them to be too clumsy.

Re: GPS Data (UBX)
« Reply #9 on: July 27, 2017, 03:38:00 pm »
So you are doing some local flying with FC set to something like PositionHold mode and you giving the quad the opposite of where you want it to go?  Like you give it a GPS coordinate that is to the south and it thinks it is too far south and so travels north to compensate?

Well the good thing about this is you can move the whole swarm by moving the "base" GPS coordinate and you can try this with any FC that uses Ublox GPS.

FYI: You will probably need to tune the FC GPS PIDs in System -> Settings -> VtolPathFollowerSettings for a harder quicker more accurate (less smooth) PositionHold.  Also maybe ALtitude*Settings.