This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Open CPN 5.6.0 + Pypilot 0.34
#1
Hi, my Pi4 got into a bit of a mess and so I started again from scratch with the OpenPlotter image (2020-12-16-OpenPlotter-v2-Moitessier-HAT-img).  I updated all the CPN apps and all worked OK, but this image has Pypilot 0.16 so the Pypilot plugin did not work.  I upgraded Pypilot to 0.34 and the plugin now works but I cannot get Pypilot to switch to GPS mode when I add a "navigate to here" marker in OpenCPN.  I have an output TCP connection from OpenCPN to localhost port 20220 and I can see the APB, XTE etc messages are being sent but I cannot change the Pypilot mode from Compass to GPS.  I tried stopping the Pypilot service and running it from the command line, but it fails (see below).
Also, but not strictly relevant in this thread, I am having problems getting OpenCPN to talk to SignalK via the standard connection on port 3000.  If I connect my GPS/AIS serial input to OpenCPN, I get all the NMEA data in OpenCPN but nothing showing in SignalK.  If I connect the serial input to SignalK instead, I can see the NMEA data in SignalK but not in OpenCPN. Then, after a short time, OpenCPN stops responding.  Just wondered if anyone else has seen this?  SignalK is version 1.42.0.

Regards
David


pi@openplotter:~ $ pypilot
autopilot start 14423.772857179
world magnetic model not available
ERROR loading wind.py cannot import name 'HeadingOffset' from 'pypilot.autopilot' (/usr/local/lib/python3.7/dist-packages/pypilot/autopilot.py)   cannot import name 'HeadingOffset' from 'pypilot.autopilot' (/usr/local/lib/python3.7/dist-packages/pypilot/autopilot.py)
imu process 4398
nmea process 4402
listening on port 20220 for nmea connections
loading servo calibration /home/pi/.pypilot/servocalibration
WARNING: using default servo calibration!!
gps process 4406
Available Pilots: ['basic', 'basic2', 'basic3', 'absolute', 'simple']
warning: failed to open special file /dev/watchdog0 for writing
         cannot stroke the watchdog
made imu process realtime
Using settings file RTIMULib.ini
Settings file RTIMULib.ini loaded
Detected MPU9250/MPU9255 at standard address
Using fusion algorithm Kalman STATE4
IMU Name: MPU-925x
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
pypilotServer process 4409
server setup has 5 pipes
autopilot init complete 14424.177461026
servo probe ('/dev/ttyAMA0', 38400) 14424.182427248
autopilot iteration running too slow 0.08478064400151197
autopilot iteration running too slow 0.07496016299955954
arduino servo found ['/dev/ttyAMA0', 38400]
serialprobe success: /home/pi/.pypilot/servodevice ['/dev/ttyAMA0', 38400]
sensor found rudder servo /dev/ttyAMA0
MPU-925x init complete
autopilot iteration running too slow 0.10753929099882953
server add socket ('127.0.0.1', 55388)
read imu running too _slowly_ 0.0562051729993982 0.05
autopilot iteration running too slow 0.0664099459991121
imu rate set to rate 20
read imu running too _slowly_ 0.06087739800022973 0.05
autopilot iteration running too slow 0.061878312000771984
setting initial gyro bias [1.884, -2.999, -1.133]
server add socket ('127.0.0.1', 55390)
EEPROM SIGNATURE ok
Process Process-3:
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pypilot/nmea.py", line 760, in nmea_process
    self.poll(timeout)
  File "/usr/local/lib/python3.7/dist-packages/pypilot/nmea.py", line 809, in poll
    self.receive_nmea(line, sock)
  File "/usr/local/lib/python3.7/dist-packages/pypilot/nmea.py", line 610, in receive_nmea
    if source_priority[self.last_values[name + '.source']] >= tcp_priority:
KeyError: 'water.source'
Traceback (most recent call last):
  File "/usr/local/bin/pypilot", line 11, in <module>
    load_entry_point('pypilot==0.34', 'console_scripts', 'pypilot')()
  File "/usr/local/lib/python3.7/dist-packages/pypilot/autopilot.py", line 467, in main
    ap.iteration()
  File "/usr/local/lib/python3.7/dist-packages/pypilot/autopilot.py", line 459, in iteration
    time.sleep(dt)
  File "/usr/local/lib/python3.7/dist-packages/pypilot/autopilot.py", line 205, in cleanup
    raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
closing autopilot
Reply
#2
Thanks for this.

There was some fallout from my changes which should have been in a development branch. I am trying to get things stable and running again and will be more careful in the future. I committed some changes to hopefully address the error you encountered.
Reply
#3
Hi Sean, fantastic!! I re-installed Pypilot and it now all works :-)
Many thanks
David
Reply
#4
Hello, I know that this is not 100% related but I just updated pypilot to the latest branch and I noticed the error message in this post
"autopilot iteration running too slow" Also as a result my system time changes which messes up all kinds of things including grafana / influxdb entries.

Here is a snippet of the pypilot log from console.

server setup has 5 pipes
autopilot init complete 3937.704534135
serialprobe removing gps device /dev/serial/by-id/usb-u-blox_AG_-_www.u-blox.com_u-blox_7_-_GPS_GNSS_Receiver-if00
autopilot iteration running too slow 0.07609626000021308
imu rate set to rate 20
autopilot iteration running too slow 0.0731601289999162
autopilot iteration running too slow 0.10802329600028315
autopilot iteration running too slow 0.07999840799993763
autopilot iteration running too slow 0.10239894400001504
autopilot iteration running too slow 0.08598913000014363
autopilot iteration running too slow 0.09905955599970184
autopilot iteration running too slow 0.08724144400002842
autopilot iteration running too slow 0.09849811200001568
autopilot iteration running too slow 0.08956190700018851
server add socket ('127.0.0.1', 50810)
autopilot iteration running too slow 0.0870612959997743
autopilot iteration running too slow 0.09823418499991021
sensor found wind tcp IIsocket0
autopilot iteration running too slow 0.08962061099964558
autopilot iteration running too slow 0.09609831499983557
gps filter update failed 'track'
sensor found gps tcp GPsocket0
autopilot iteration running too slow 0.09376961099997061
autopilot iteration running too slow 0.09124011099993368
gpsd connected
autopilot iteration running too slow 0.0931714439998359
GPSD devices ['/dev/ttyACM0']
autopilot iteration running too slow 0.09263896299989938
autopilot iteration running too slow 0.09222213000020929
autopilot iteration running too slow 0.0930564069999491
autopilot iteration running too slow 0.09243533300013951
autopilot iteration running too slow 0.09362888900022881
autopilot iteration running too slow 0.09627683400003662
sensor found gps gpsd /dev/ttyACM0
autopilot iteration running too slow 0.09093440700007704
autopilot iteration running too slow 0.09521529699986786
autopilot iteration running too slow 0.09176622200038764
autopilot iteration running too slow 0.09404022200033069
autopilot iteration running too slow 0.09171348100016985
autopilot iteration running too slow 0.09325070399972901
autopilot iteration running too slow 0.09308372200030135
autopilot iteration running too slow 0.09342292600013025
autopilot iteration running too slow 0.09474131500019212
autopilot iteration running too slow 0.09217877799983398
autopilot iteration running too slow 0.09440688799986674
autopilot iteration running too slow 0.09198733299990636
calibration loaded, starting 7795
autopilot iteration running too slow 0.09355476000018825
autopilot iteration running too slow 0.07115864800016425
autopilot iteration running too slow 0.11029348200008826
autopilot iteration running too slow 0.07866861100001188
autopilot iteration running too slow 0.10498753699994268
autopilot iteration running too slow 0.08244877800007089
autopilot iteration running too slow 0.10063949999994293
servo probe ('/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0', 38400) 3942.813236595
server/client is running too _slowly_ 0.07543136999993294
autopilot iteration running too slow 0.1483275919999869
autopilot iteration running too slow 0.08656553699984215
autopilot iteration running too slow 0.09746625900015715
autopilot iteration running too slow 0.08836625899994033
autopilot iteration running too slow 0.0967533339999136
autopilot iteration running too slow 0.09199374099989654
autopilot iteration running too slow 0.09415555599980507
signalk process 7802
autopilot iteration running too slow 0.0925476659999731
signalk failed to read token /root/.pypilot/signalk-token
autopilot iteration running too slow 0.09383538800011593
signalk zeroconf service add avnav._http._tcp.local. _http._tcp.local.
signalk zeroconf service add openplotter._http._tcp.local. _http._tcp.local.
signalk server found 10.10.10.1:3000
signalk zeroconf service add avnav-server._http._tcp.local. _http._tcp.local.
signalk probe... 10.10.10.1:3000
autopilot iteration running too slow 0.09249929600036921
signalk zeroconf service add OctoPrint instance on octopi._http._tcp.local. _http._tcp.local.
autopilot iteration running too slow 0.0935058330001084
autopilot iteration running too slow 0.09367818500004432
autopilot iteration running too slow 0.09230385199998636
signalk found ws://10.10.10.1:3000/signalk/v1/stream?subscribe=none
arduino servo found ['/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0', 38400]
serialprobe success: /root/.pypilot/servodevice ['/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0', 38400]
sensor found rudder servo /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
autopilot iteration running too slow 0.09770479600001636
signalk post {'state': 'PENDING', 'requestId': 'b297df89-0c87-47ce-9a2f-50e904105e39', 'statusCode': 202, 'href': '/signalk/v1/requests/b297df89-0c87-47ce-9a2f-50e904105e39', 'ip': '::ffff:10.10.10.1'}
signalk request access url http://10.10.10.1:3000/signalk/v1/reques...e904105e39
autopilot iteration running too slow 0.09031570300021485
autopilot iteration running too slow 0.09552233399972465
autopilot iteration running too slow 0.09150098100008108
autopilot iteration running too slow 0.09406051900032253
autopilot iteration running too slow 0.09201735099986763
autopilot iteration running too slow 0.0938120370001343
autopilot iteration running too slow 0.09237607400018533

Its not consistent, I was able to execute from console pypilot and i twas running smooth, but some other times it throws these errors. The last time started it, the whole raspberry pi rebooted.
Reply
#5
not sure about the pi rebooting.... This is not a fault of pypilot but something else.

As for the iteration too slow, it is more of a warning. There is something wrong here. Perhaps a core needs to be set aside for pypilot? Was it able to set the processes with realtime priority? It should have plenty of processing power to do the calculations. A full output from the start would be helpful.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)