RTK and Navio

So here’s an update:

CONFIG:
“Vinnie” the Landrover:
Frame: Motorized wheelchair. New batteries - 24v system
Motor controller: Sabertooth 2x25, mixed mode RC, microprocessor mode
Telemetry/communications: highpower Wifi (have also tried 933MHz radios, and will probably end up with 4G because of crosstalk/interference)
RTK: NavIO RAW on rover, will probably switch to NavIO+ very soon. Skytraq raw receiver at base; base in house, running strsvr (from RTKLIB) on indoors machine which also runs Mission Planner. The “both-apm.conf” file is attached to this to show you how it is all set up.
RC radio: cheap FlySky 6 channel, with channel 7 on the receiver actually receiving channel 6 from the RC transmitter, and parameters in Mission Planner adjusted accordingly. I aim to get rid of the RC radio entirely soon and just use the 4G telemetry set up for control. But for now it is easier to test.

Attached are the “both-apm.conf” file for configuring rtkrcv, and my rc.local file (which autostarts everything).

Remember to make sure you start rtkrcv FIRST, and wait a bit (sleep 20)… otherwise APMrover2.elf won’t run with the -E switch (btw Igor, shouldn’t it be the case that if APMrover2.elf doesn’t find the second GPS named at the -E switch, that it allows the APMrover2.elf file to still execute, but with a message to that effect? Would be much better that way…)

You can watch rtkrcv at telnet:(RPi IP):12347

Local files are created in a local “temp” directory with info from rtkrcv also.

Problems to be solved:

  1. failsafe — with Sabertooth in this mode, there is no local failsafe for the motors, which means that when APMrover2 loses radio signal (or failsafe’s for whatever other reason), the Sabertooth just keeps doing whatever is was doing before (bad idea, IMO). So I have to add another failsafe to shut down the power or something. ANy ideas?

  2. long-range telemetry (probably pretty easy with some config changes, as soon as I can bring myself to pay for a 4G account for this project) (any ideas? It needs to be reliable to about 1-2km)

  3. cm RTK resolution — I won’t really know what the resolution is until I get the rover outside and play with it awhile (snow on the ground now). I have heard there is a “usage issue” regarding the way (float vs int) things are sent to Mission Planner… Anybody got any more info on this? Anybody trying RTK on a quad or plane?

Here is the both-apm.conf file:

console-passwd =admin
console-timetype =gpst # (0:gpst,1:utc,2:jst,3:tow)
console-soltype =dms # (0:dms,1:deg,2:xyz,3:enu,4:pyl)
console-solflag =1 # (0:off,1:std+2:age/ratio/ns)
inpstr1-type =tcpsvr # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http,10:spi)
inpstr2-type =tcpcli # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http,10:spi)
inpstr3-type =ftp # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http,10:spi)
inpstr1-path =127.0.0.1:12345
inpstr2-path =192.168.0.6:50011
inpstr3-path =cddis.gsfc.nasa.gov/gps/products/%W/igu%W%D%hb.sp3.Z
inpstr1-format =ubx # (0:rtcm2,1:rtcm3,2:oem4,3:oem3,4:ubx,5:ss2,6:hemis,7:skytraq,14:sp3)
inpstr2-format =skytraq # (0:rtcm2,1:rtcm3,2:oem4,3:oem3,4:ubx,5:ss2,6:hemis,7:skytraq,14:sp3)
inpstr3-format =sp3 # (0:rtcm2,1:rtcm3,2:oem4,3:oem3,4:ubx,5:ss2,6:hemis,7:skytraq,14:sp3)
inpstr2-nmeareq =off # (0:off,1:latlon,2:single)
inpstr2-nmealat =0 # (deg)
inpstr2-nmealon =0 # (deg)
outstr1-type =tcpsvr # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr)
outstr2-type =file # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr)
outstr1-path =127.0.0.1:12346
outstr2-path =/home/pi/rtkdata/sol2_%Y%m%d%h%M.pos
outstr1-format =nmea # (0:llh,1:xyz,2:enu,3:nmea)
outstr2-format =nmea # (0:llh,1:xyz,2:enu,3:nmea)
logstr1-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr)
logstr2-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr)
logstr3-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr)
logstr1-path =/home/pi/rtkdata/rov_%Y%m%d%h%M.log
logstr2-path =/home/pi/rtkdata/ref_%Y%m%d%h%M.log
logstr3-path =/home/pi/rtkdata/cor_%Y%m%d%h%M.log
misc-svrcycle =10 # (ms)
misc-timeout =30000 # (ms)
misc-reconnect =30000 # (ms)
misc-nmeacycle =5000 # (ms)
misc-buffsize =32768 # (bytes)
misc-navmsgsel =rover # (0:all,1:rover,1:base,2:corr)
misc-startcmd =
misc-stopcmd =
file-cmdfile1 =/home/pi/RTKLIB-master/data/ubx_spi_raw_5hz.cmd
file-cmdfile2 =/home/pi/RTKLIB-master/data/skytraq_raw_5hz.cmd
file-cmdfile3 =
pos1-posmode =kinematic # (0:single,1:dgps,2:kinematic,3:static,4:movingbase,5:fixed,6:ppp-kine,7:ppp-static)
pos1-frequency =l1 # (1:l1,2:l1+l2,3:l1+l2+l5)
pos1-soltype =combined # (0:forward,1:backward,2:combined)
pos1-elmask =15 # (deg)
pos1-snrmask =20 # (dBHz)
pos1-dynamics =on # (0:off,1:on)
pos1-tidecorr =off # (0:off,1:on)
pos1-ionoopt =brdc # (0:off,1:brdc,2:sbas,3:dual-freq,4:est-stec)
pos1-tropopt =saas # (0:off,1:saas,2:sbas,3:est-ztd,4:est-ztdgrad)
pos1-sateph =brdc # (0:brdc,1:precise,2:brdc+sbas,3:brdc+ssrapc,4:brdc+ssrcom)
pos1-exclsats = # (prn …)
pos1-navsys =3 # (1:gps+2:sbas+4:glo+8:gal+16:qzs+32:comp)
pos2-armode =off # (0:off,1:continuous,2:instantaneous,3:fix-and-hold)
pos2-gloarmode =off # (0:off,1:on,2:autocal)
pos2-arthres =5
pos2-arlockcnt =0
pos2-arelmask =0 # (deg)
pos2-aroutcnt =5
pos2-arminfix =10
pos2-slipthres =0.05 # (m)
pos2-maxage =30 # (s)
pos2-rejionno =30 # (m)
pos2-niter =1
pos2-baselen =0 # (m)
pos2-basesig =0 # (m)
out-solformat =llh # (0:llh,1:xyz,2:enu,3:nmea)
out-outhead =on # (0:off,1:on)
out-outopt =off # (0:off,1:on)
out-timesys =gpst # (0:gpst,1:utc,2:jst)
out-timeform =tow # (0:tow,1:hms)
out-timendec =3
out-degform =deg # (0:deg,1:dms)
out-fieldsep =
out-height =ellipsoidal # (0:ellipsoidal,1:geodetic)
out-geoid =internal # (0:internal,1:egm96,2:egm08_2.5,3:egm08_1,4:gsi2000)
out-solstatic =all # (0:all,1:single)
out-nmeaintv1 =0 # (s)
out-nmeaintv2 =0 # (s)
out-outstat =off # (0:off,1:state,2:residual)
stats-errratio =100
stats-errphase =0.003 # (m)
stats-errphaseel =0.003 # (m)
stats-errphasebl =0 # (m/10km)
stats-errdoppler =1 # (Hz)
stats-stdbias =30 # (m)
stats-stdiono =0.03 # (m)
stats-stdtrop =0.3 # (m)
stats-prnaccelh =1 # (m/s^2)
stats-prnaccelv =0.1 # (m/s^2)
stats-prnbias =0.0001 # (m)
stats-prniono =0.001 # (m)
stats-prntrop =0.0001 # (m)
stats-clkstab =5e-12 # (s/s)
ant1-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm)
ant1-pos1 =34.87031095 # (deg|m)
ant1-pos2 =-98.21211167 # (deg|m)
ant1-pos3 =400 # (m|m)
ant1-anttype =
ant1-antdele =0 # (m)
ant1-antdeln =0 # (m)
ant1-antdelu =0 # (m)
ant2-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm)
ant2-pos1 =0 # (deg|m)
ant2-pos2 =0 # (deg|m)
ant2-pos3 =0 # (m|m)
ant2-anttype =
ant2-antdele =0 # (m)
ant2-antdeln =0 # (m)
ant2-antdelu =0 # (m)
misc-timeinterp =off # (0:off,1:on)
misc-sbasatsel =0 # (0:all)
file-satantfile =/home/pi/RTKLIB-master/data/igs05.atx
file-rcvantfile =/home/pi/RTKLIB-master/data/igs05.atx
file-staposfile =/home/pi/RTKLIB-master/data/station.pos
file-geoidfile =
file-dcbfile =/home/pi/RTKLIB-master/data/P1C1_ALL.DCB
file-tempdir =/home/pi/rtkdata
file-geexefile =
file-solstatfile =
file-tracefile =

and add these to your rc.local file:

sudo /home/pi/RTKLIB-master/bin-rpi/rtkrcv -s -p 12347 -o /home/pi/RTKLIB-master/bin-rpi/both-apm.conf &

sleep 20

sudo /home/pi/ardupilot/APMrover2/APMrover2.elf -A udp:192.168.0.6:14550 -E tcp:127.0.0.1:12346 > /home/pi/startup_log &

1 Like

PS…

I can already tell that the RPi standard B+ is not going to have enough juice to do everything that needs to be done.

I have an RPi2, but probably will switch to Odroid platform for Vinnie (the land part) and use the RPI or RPi2 for the quad.

1 Like

@timkaiser

The APM prohibits this behavior. If you provide an address for the switch, it’d better be working.
It’s not difficult to ignore that constraint, though. But I don’t think it’s that necessary. isn’t it?

The same trouble here. The weather is kinda messy, so that’s not feasible to test outside.

I’ll look into the issue in the next couple of days as soon as I got some spare time.

The obs() count does tick, doesn’t it?

1 Like

Yes… if you look at the rtkrcv through telnet (I have mine set on port 12347), you can see the obs counter tick on both the rover GPS and the base GPS. So it is getting observations. What I am wondering is in what format the output fix is sent and whether that is the problem. Doesn’t seem like it should be, though. I don’t think my .sp3 corrections are coming through though…

1 Like

Hey guys,

I’m trying to use RTK lib with my NAVIO+ for postprocess positioning. NAVIO+ is equipped with Ublox M8N and to use that receiver along with RTK lib you have to acquire TRK-MEAS and TRK-SFRBX msgs (correct me if I’m wrong) and a few others that are not an issue. I tried looking at Ublox M8N documentation and there is not a single word about TRK msgs (class 0x03). Only information I found abut them is on link. Is there any other site, that you know of, with information about this type of messages? Also do you have some advice on how to process received msgs form Ublox in order to covert it to RINEX format that is expected in RTK postprocess?

1 Like

Antun,

You are right, you need TRK-MEAS ad TRK-SFRBX messages for RTK, they are not officially supported by u-blox. These messages were found by enthusiasts, they were meant to be used for debug purposes.

You can convert them to RINEX using RTKLib converter.

@AntunVukicevic
there are several other people doing the same (RTKLIB with Ublox m8n) in this forum:

@igor.vereninov @No_Peppermint

Tnx a lot for informations and help guys :slight_smile: gonna keep you informed about progress!

@george.staroselskiy any news on the Increase accuracy of co-ordinates (Replace COMMAND_LONG with COMMAND_INT in general with a translation layer) · Issue #1907 · ArduPilot/ardupilot · GitHub issue?

I tried running RTK in single mode per the docs at http://docs.emlid.com/Navio-dev/rtklib/
The number of messages received is zero, i.e. obs(0)

The GPS is confirmed to be working using the Navio branch of APM, and by using U-center with the ublox-spi-to-tcp command included in the RTK branch.

I’m running the real-time raspbian from http://docs.emlid.com/Downloads/Real-time-Linux-RPi2/

Any suggestions on where to check next?

Hello to everyone.
This is my first post here even if I followed the Navio+ and RTK implementation since several months.

I already set up an RC car with RPi-B+ plus Navio+ and Tallysman TW3040 GNSS antenna, the base antenna is a TW3040 plus USB NEO6-T dongle connected to the pc.

Since the RPi-B+ hasn’t enough juice to run ArduRover2 and RTKlib at the same time as clearly noted by @timkaiser I run the RTKlib on the base antenna pc while the Ardurover2 runs as usual on the rc car.

Everything works well with Ardurover2 alone (Ardurover2 reads gps data directly on the SPI): connection with Mission Planner, planning of a mission with waypoints, Automode etc…

Problems rise up when I try to connect an external/secondary gps to Ardurover with the gps position calculated by RTKlib.

Basically I followed all the advises of Emlid team and @timkaiser also, that I would like to thank you as well, since the setup is basically very similar.

What I did is to connect the external/secondary gps in 2 way and with both I encountered an issue:

  • first attemp: secondary gps:
    run socat to redirect the RPi port from 12345 to 12347
    run RTKnavi on base antenna pc with output on 12346 port
    run Ardurover2 on RPi with -E:12346 to connect the output data coming from pc to the secondary gps port of Ardurover2

  • results: Position fine with very good accuracy but the ground speed of GPS1 and ground speed of GPS2 is very large, more than 300 m/s. Ardurover try to brake (reverse motor) in order to reduce the measured speed.

  • second attemp: external gps
    run strsvr on RPi to send Navio+ gps data to the antenna station pc on port 12346
    run RTKnavi on antenna station pc that send back RTK data on port 12347
    run Ardurover2 on RPi with -B:12347 to read gps data as an external gps. No issue related to hardware (SPI) since strsvr read the SPI while Ardurover2 reads tcp ip port releasing the hardware (SPI) resource

  • results: Position fine with high accuracy, Ground Speed of GPS1 (secondary GPS not used at all) equal to 0.000 even if I mover the Rover . Ardurover2 is not able to follow the waypoints when I used this GPS arrangement.

There is something that I could tune in order to proprerly have Ardurover2 works along with RTKlib gps data? Am I missed somethings?

By the way I already purchased an RPi 2 in order to increase the computational power. I think putting Ardurover on a core and the RTKlib on a different one I can completely avoid the regular pc on the antenna station.

Thank you for all the work that you have already done. This is very very great!

@generaldin Hi, there’s one thing to note - APM does not release SPI when you use external GPS because it continues to read IMU sensor, that’s why APM and RTKLIB won’t work simultaneously.

Thank you @mikhail.avkhimenia .
It’s very interesting what you said.
I tried to start strsvr while Ardurover2 runs with secondary GPS (-E command) and it was clearly not good solution because everything stuck: no GPS data on Mission Planner connected to Ardurover and no gps data coming out from strsvr.

The behavior changed when I tried to start strsvr server and Ardurover2 with external GPS (-B command). In this case RTK grade positions is calculated and good while strsvr is able to send data to pc and Ardurover is able to receive RTK data from pc tcp port. So I guessed Ardurover release hardware resources in case of external GPS. (By the way as I pointed out before Ardurover is not able to follow waypoints with RTK external gps, speed is always zero. I don’t think that speed is the reason of fault but it’s an evidence of something that it’s not working well).

@mikhail.avkhimenia from your words should I guess that I will not ever be able to have a fully functional prototype of rc car with Ardurover2 and RTK grade position working on RPi plus Navio+ ?

It is possible to read SPI from two different programs (APM & RTKLIB) but it may lead to locks and terrible performance. It would require a complicated integration of APM and RTKLIB and that would be very very hacky.
It would be easier just to use external hardware (like Reach or another receiver).

Actually I don’t want to read SPI from two different programs. It would be sufficient to read SPI by one program only (RTKlib or APM) then send gps data to RTKnavi on pc (or on RPi 2 itself in future implementation) and then read back the calculated RTK position by the APM that will guide the rc car through waypoints.

Just as @timkaiser did with @igor.vereninov suggestions.

If what you say is true (and I think so) that Ardurover still occupies the SPI resource even with external GPS command so I cannot understand why I have bad ground speed while:

  • Ardurover read GPS data from SPI and reroutes to tcpip port 12345
  • socat reroutes tcpip port from 12345 to 12347 (actually is a non-sense operation but working without it I’m not able to see something coming out from port 12345 directly)
  • RTKnavi on pc collects data from port 12347 and USB antenna station (neo 6 dongle) and send back RTK position on port 12346
  • Ardurover reads RTK data from port 12346 as secondary gps

Everything should be ok with this arrangement (one program only that read SPI) but for some reason the ground speed is wrong (more than 300 m/s) and Ardurover try to reduce speed putting the motor in reverse. (To be clear: RTK wihtout APM works very well)

any suggestions about that?

1 Like

Hi,

Yesterday I figured out what was wrong with APM plus RTK. After several attempts I realized that the M8N installed on Navio+ can handle TRK-MEAS TRK-SFRBX message for RTK only at 1Hz. This is also mentioned here http://community.emlid.com/t/connect-u-blox-neo-6t-usb-to-ethernet by @mikhail.avkhimenia . APM sets gps rate at 5Hz by default of course and that’s the source of wrong ground speed described above.
There is a thread here RTKLIB-Anwendungen mit u-blox M8 - Seite 2 - Geospector GPS-Forum (vormals kowoma GPS-Forum) says M8N is capable to handle raw messages at 5Hz (even 10Hz) disabling glonass and SBAS.
How can I do it after the initializiation made by APM’s gps driver? Should I change the driver and compile it again or I can disable glonass and SBAS by injecting command with u-center or something else.
Actually I know that it would be more simple if I connect a new receiver on the usb but the use of M8N on the Navio+ is more elegant and compact. (BTW when will be available a new usb dongle on the store?)

1 Like

Hello!

I have read through all the RTK related threads and would like to ask a couple questions to clarify some points…

Question 1: So the main issue with running RTKLIB on the same hardware as APM is poor performance due to SPI limitations? Or is the issue the two programs running at the same time, puts too demand on the raspi2? Or both?

Question 2: If someone (like me) wanted to experiment with RTKLIB before purchasing REACH, would it be possible to run RTKLIB on a seperate pi on the aircraft w/ a NEO-6T via FTDI/USB and feed this to the pi running APM? I assume performance would not be as good as REACH, but for inexpensive low level tests would this be possible?

Question 3: All the references I see to RTKLIB use are for ArduRover. RTKLIB would be applicable to ArduCopter as well correct? I see REACH is, is there something special/unique about REACH that allows for use with ArduCopter?

Question 4: When using REACH or some other external hardware, does APM use the RTK GPS position information ONLY and does not use the on board GPS at all? Or Are both used at the same time?

Sorry if any of these questions are painfully obvious!

Thank you in advance for any assistance :smiley:

Regards,
J

1 Like

There are problems with simultaneous access of GPS from RTKLIB and IMU from APM. While they are theoretically solvable with some hacks, the main problem is that M8N on Navio is not suited for raw data output. Yes, there are also hacks to partially pull raw data from it, but we as a manufacturer can’t rely on it, so we do not support it.

You can run console version of RTKLIB on any Linux computer with connected raw data receiver for experiments.

Reach will work with any vehicle type.

APM can work with two GPS receivers, keeping one as a backup in case the RTK one goes off.

2 Likes

Perfect, this was very helpful. Thank you Mikhail!

1 Like

Is there any update on this? It seems critical to geting high accuracy out of APM.

1 Like