Lost the option to select GPS mode - Printable Version

+- OpenMarine (
+-- Forum: Pypilot (
+--- Forum: General discussion (
+--- Thread: Lost the option to select GPS mode (/showthread.php?tid=4166)

Lost the option to select GPS mode - tax - 2022-08-04


Been having some fun with this awesome little project the last couple of weeks, ups and downs.

Took me some time to figure out one of my main problems, the IMU. (Now using a MPU-6050 with HMC5883).

After that was sorted out I did some trials with PID tuning and everything was working great. I could create routes with opencpn on my laptop that was connected via the pypilot plugin and pypilot followed with great accuracy! What a time to be alive!
Both GPS mode and Compass mode was working without any issues.

A couple of days later while doing further tuning at sea, I noticed that I can no longer activate GPS mode. Everywhere I try, web-ui, pypilot plugin/client from opencpn, I can only select Compass mode.
The Pypilot plugin in opencpn doesn't even list anything else except Compass.

I've ran out of ideas to try and wonder if anyone can help me get the GPS mode working.
Tried the oldest and the newest tinypilot images, clean setup. And just to try rule it out, I replaced the Rasberry Pi Zero. (As it wasn't the same now as when everything was working)

My setup is a custom one (used parts from my early autopilot attempts + drones and other projects)
XY-160D motor controller (vnh2sp30 in motor.ino on arduino nano).
* custom IMU with a MPU-6050 and a connected HMC5883
* linear actuator (no potentiometer/feedback)
* PI Zero W

Logs from console (running pypilot interactively)

autopilot start 1418.13315
ERROR loading cannot import name 'HeadingOffset'   cannot import name 'HeadingOffset'
ERROR loading cannot import name 'HeadingOffset'   cannot import name 'HeadingOffset'
imu process 4189
made imu process realtime
Using settings file RTIMULib.ini
Settings file RTIMULib.ini loaded
Detected MPU9150 at standard address
Using fusion algorithm Kalman STATE4
IMU Name: MPU-9150
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
warning, failed to make calibration process idle, trying renice
nmea process 4196
listening on port 20220 for nmea connections
loading servo calibration /home/tc/.pypilot/servocalibration
WARNING: using default servo calibration!!
gps process 4198
Detected MPU-6050 with HMC5883
Available Pilots: ['simple', 'basic', 'absolute']
warning: failed to open special file /dev/watchdog0 for writing
        cannot stroke the watchdog
pypilotServer process 4201
autopilot init complete 1419.668622
servo probe ('/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AI02PMX6-if00-port0', 38400) 1419.699065
MPU9150 init complete
server/client is running too _slowly_ 0.06582600000001548
server setup has 5 pipes
server add socket ('', 55400)
imu rate set to rate 20
read imu running too _slowly_ 0.05076099999996586 0.05
setting initial gyro bias [0.38, -2.105, -0.173]
imu rate set to rate 20
server add socket ('', 55402)
server add socket ('', 49464)
arduino servo found ['/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AI02PMX6-if00-port0', 38400]
serialprobe success: /home/tc/.pypilot/servodevice ['/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AI02PMX6-if00-port0', 38400]
too long write pipe 0.02442002296447754 pypilotServer pipe0[1] 698
server add socket ('', 55404)
server, remove socket ('', 55402)
server, remove socket ('', 55404)
read imu running too _slowly_ 0.029142999999976382 0.05
gpsd connected
GPSD devices []
server add socket ('', 55408)
server add socket ('', 55410)
sensors is running too _slowly_ 0.34602499999982683
signalk process 4197
signalkread token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXZpY2UiOiJweXBpbG90LTI1MTcwMjk3NDg5IiwiaWF0IjoxNjI4MjQ0MjkyLCJleHAiOjE2NTk4MDE4OTJ9.64SjpKncbuBgWYlyWYfFQ9JCkl9TOO-4OOVpBPRgG6s
nmea client invalid value
calibration loaded, starting 4188
read imu running too _slowly_ 0.026904999999942447 0.05
read imu running too _slowly_ 0.030866000000060012 0.05
read imu running too _slowly_ 0.02627800000004754 0.05
read imu running too _slowly_ 0.025616000000127315 0.05
read imu running too _slowly_ 0.03086099999995895 0.05

RE: Lost the option to select GPS mode - seandepagnier - 2022-08-04

How is the gps connected?

pypilot likely does not get gps data.

For example, try executing:
pypilot_client gps.source

or check the gps source in the statistics of the plugin

If opencpn has gps, it is a matter of forwarding it to pypilot usually.

another thing... the hmc5883 is magneto resistive. This is much more sensitive than the hall sensors most people are using, but less repeatable. The extra precision is not actually useful for an autopilot either (perhaps useful to detect magnetic objects etc)

So the compass may vary more than a typical setup, I dont have a lot of feedback of users with hmc5883 so would be interesting to hear more.

RE: Lost the option to select GPS mode - tax - 2022-08-04


The answer to that question was: The GPS wasn't connected!
I had forgotten to check the "Forward NMEA" option in opencpn, doh!
(Didn't think of my reinstall of the PC due to some other software/hardware related issues)

Before I checked that option it was listed as none in the statistics page and now it's set to tcp.
And now I can select GPS mode in the ui's again.

About the HMC5883, initially I was running an LSM9DS1 but for some reason or the other, while doing my early trial and errors, things didn't work at all. Back then I thought it was the PID values that was out of order, but then noticed on the desk at home that I didn't get repeatable results with that one. Noting down it's value, then shifting it 90 degrees and back again it never added up. Might have been calibration issues.

My second attempts was with the duo MPU-6050 and a connected HMC5883 (had some issues with orienting the modules), but this time I had also moved away from the trial and error approach and read everything I could find (like the excellent workbook). On the water I did multiple 360 turns and after a adjustment (-87 degrees) it matched the boats compass perfectly. It's mounted (taped) with a 50cm cable away from anything metal.

Had quite successful runs over longer distances keeping the heading I had picked.

Will test the LSM9DS1 sometime again now that I have the basic setup working and just doing one change, the IMU.

Have had a hard time finding any reasonable priced IMU. The LSM9DS1 wasn't cheap from a local dealer in Sweden.

Best regards!