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
Getting wind mode and GPS mode into pypilot
#11
(2023-01-01, 02:15 PM)seandepagnier Wrote: pypilot is usually a server but it can act a a nmea client too.   You just need to configure the router ip and port, it is under the web control  (web interface)   or editing config file.

OK, I got that too. Currently I run opencpn dave register version on the android tablet even though I don't use it for cruising (I prefer Navionics), I just use it to route the NMEA sentences to the pypilot TCP/20220 port and pypilot seems to accept all options compass, wind, etc. so I am good to go for the moment. The opencpn dashboard is also good to have (can't find an equivalent in Navionics).

So thank you very much for your help superheros!
Reply
#12
Did you try the web control of pypilot?   Under configuration and put the router ip and port it listens for nmea


Attached Files Image(s)
   
Reply
#13
Hello, no I did not, and it works! however the IP address is not permanent and flips back to something else ending with 7777 after pypilot shutdown. How can I get the proper ip:port permanent please?
EDIT : alright I found it, it is in the pypilot.conf file
Everything is just fine now, thank you!
Reply
#14
did you have to edit pypilot.conf to make it work?
Reply
#15
(2023-01-03, 12:50 AM)seandepagnier Wrote: did you have to edit pypilot.conf to make it work?

Yes I did, however it is not stable I cannot have it work again today:
I have pypilot as server : 192.168.14.1 and the router as client 192.168.14.5 (fixed) and can browse both of them properly.
The NMEA IP address in pypilot configuration that you pointed now stays at 192.168.14.5:20220 which is the correct value I believe. Even though tracking TCP/192.168.14.5:20220 I can see the NMEA frames in the opencpn debugging windows the pypilot interface will not allow gps or wind and flips back to compass.
It always works fine with the opencpn NMEA input/output configuration though.
Reply
#16
To debug a thing like this, I'd recommend running pypilot at the prompt, and share the output. Ssh into Tinypilot (for instance, using putty.exe), username tc password pypilot, then stop pypilot using sudo sv stop pypilot, then run it at the prompt by simply typing pypilot.
Reply
#17
(2023-01-03, 04:41 PM)ironman Wrote: To debug a thing like this, I'd recommend running pypilot at the prompt, and share the output. Ssh into Tinypilot (for instance, using putty.exe), username tc password pypilot, then stop pypilot using sudo sv stop pypilot, then run it at the prompt by simply typing pypilot.

Yes I was thinking about it so here it is, router is OFF servo is OFF at the beginning:

tc@pypilot:~$ pypilot
autopilot start 948.387925158
ERROR loading wind.py cannot import name 'HeadingOffset'   cannot import name 'HeadingOffset'
ERROR loading gps.py cannot import name 'HeadingOffset'   cannot import name 'HeadingOffset'
imu process 4209
made imu process realtime
Using settings file RTIMULib.ini
Settings file RTIMULib.ini loaded
Detected ICM20948 at standard address
nmea process 4214
Using fusion algorithm Kalman STATE4
IMU Name: ICM-20948
listening on port 20220 for nmea connections
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
loading servo calibration /home/tc/.pypilot/servocalibration
WARNING: using default servo calibration!!
gps process 4217
Available Pilots: ['simple', 'basic', 'absolute']
warning: failed to open special file /dev/watchdog0 for writing
         cannot stroke the watchdog
pypilotServer process 4219
warning, failed to make calibration process idle, trying renice
server setup has 5 pipes
autopilot init complete 948.654382918
servo probe ('/dev/ttyAMA0', 38400) 948.663298908
server add socket ('127.0.0.1', 45092)
server add socket ('127.0.0.1', 45094)
server, remove socket ('127.0.0.1', 45094)
server add socket ('127.0.0.1', 45096)
server, remove socket ('127.0.0.1', 45096)
ICM-20948 init complete
read imu running too _slowly_ 0.05209078099994713 0.05
imu rate set to rate 20
read imu running too _slowly_ 0.04691062500000953 0.05
setting initial gyro bias [-0.751, 0.087, -0.2]
server add socket ('127.0.0.1', 45098)
server add socket ('192.168.14.86', 53826)
server add socket ('127.0.0.1', 45100)
gpsd connected
GPSD devices []
servo probe ('/dev/ttyAMA0', 38400) 953.774554479
server/client is running too _slowly_ 0.10645432299997992
calibration loaded, starting 4208
signalk process 4215
signalkread token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXZpY2UiOiJweXBpbG90LTI1MTcwMjk3NDg5IiwiaWF0IjoxNjI4MjQ0MjkyLCJleHAiOjE2NTk4MDE4OTJ9.64SjpKncbuBgWYlyWYfFQ9JCkl9TOO-4OOVpBPRgG6s
servo probe ('/dev/ttyAMA0', 38400) 957.823874373
servo probe ('/dev/ttyAMA0', 38400) 962.900630725
server/client is running too _slowly_ 0.05045807299995886
servo probe ('/dev/ttyAMA0', 38400) 967.936990098
servo probe ('/dev/ttyAMA0', 38400) 971.984797232
nmea client failed to connect 192.168.14.5:20220
servo probe ('/dev/ttyAMA0', 38400) 977.066596813
read imu running too _slowly_ 0.04700609400003941 0.05
servo probe ('/dev/ttyAMA0', 38400) 982.074974416
server/client is running too _slowly_ 0.04760973899999499
servo probe ('/dev/ttyAMA0', 38400) 986.135207175
servo probe ('/dev/ttyAMA0', 38400) 991.230073527
server/client is running too _slowly_ 0.0520073960000218
read imu running too _slowly_ 0.026483645999974215 0.05
servo probe ('/dev/ttyAMA0', 38400) 996.271159827
server/client is running too _slowly_ 0.051145676999908574
servo probe ('/dev/ttyAMA0', 38400) 1000.335089357
server/client is running too _slowly_ 0.0483534369999461
servo probe ('/dev/ttyAMA0', 38400) 1005.396100396
server/client is running too _slowly_ 0.04603171899998415
servo probe ('/dev/ttyAMA0', 38400) 1010.407309926
servo probe ('/dev/ttyAMA0', 38400) 1014.449195758
read imu running too _slowly_ 0.04685984299999291 0.05
servo probe ('/dev/ttyAMA0', 38400) 1019.525769349
server/client is running too _slowly_ 0.046461093999937475
read imu running too _slowly_ 0.04178817700005766 0.05
servo probe ('/dev/ttyAMA0', 38400) 1024.527944347
server, remove socket ('127.0.0.1', 45092)
server add socket ('127.0.0.1', 45110)
servo probe ('/dev/ttyAMA0', 38400) 1028.569859502
read imu running too _slowly_ 0.04185791700001573 0.05
servo probe ('/dev/ttyAMA0', 38400) 1033.626742573
servo probe ('/dev/ttyAMA0', 38400) 1038.639927415
servo probe ('/dev/ttyAMA0', 38400) 1042.701055799
servo probe ('/dev/ttyAMA0', 38400) 1047.763775901
#servo ON
arduino servo found ['/dev/ttyAMA0', 38400]
serialprobe success: /home/tc/.pypilot/servodevice ['/dev/ttyAMA0', 38400]
EEPROM SIGNATURE ok
servo calibration invalid False
read imu running too _slowly_ 0.03157364599996981 0.05
#Router ON (client mode)
sensor found gps tcp AIsocket0
nmea client connected 192.168.14.5:20220
sensor found wind tcp WIsocket1
failed to write pypilot.conf [Errno 13] Permission denied: '/home/tc/.pypilot/pypilot.conf'
sensor wind lost tcp WIsocket1
sensor found wind tcp WIsocket1
pypilot socket failed to send to 192.168.14.5:20220 1
pypilot socket failed to send to 192.168.14.5:20220 10
failed to write pypilot.conf [Errno 13] Permission denied: '/home/tc/.pypilot/pypilot.conf'
pypilot socket failed to send to 192.168.14.5:20220 100
nmea client lost connection
sensor wind lost tcp WIsocket1
nmea client connected 192.168.14.5:20220
sensor found wind tcp WIsocket0
read imu running too _slowly_ 0.026491927000051874 0.05
server add socket ('127.0.0.1', 45124)
server, remove socket ('127.0.0.1', 45124)
nmea client lost connection
nmea client failed to connect 192.168.14.5:20220
failed to write pypilot.conf [Errno 13] Permission denied: '/home/tc/.pypilot/pypilot.conf'
read imu running too _slowly_ 0.03162364600007095 0.05
failed to write pypilot.conf [Errno 13] Permission denied: '/home/tc/.pypilot/pypilot.conf'
read imu running too _slowly_ 0.026465780999842536 0.05
sensor wind lost tcp WIsocket0
sensor found wind tcp WIsocket0
failed to write pypilot.conf [Errno 13] Permission denied: '/home/tc/.pypilot/pypilot.conf'
sensor wind lost tcp WIsocket0
sensor found wind tcp WIsocket0
^CTraceback (most recent call last):
  File "/usr/local/bin/pypilot", line 11, in <module>
    load_entry_point('pypilot==0.32', 'console_scripts', 'pypilot')()
  File "/usr/local/lib/python3.6/site-packages/pypilot/autopilot.py", line 450, in main
  File "/usr/local/lib/python3.6/site-packages/pypilot/autopilot.py", line 442, in iteration
    time.sleep(dt)
  File "/usr/local/lib/python3.6/site-packages/pypilot/autopilot.py", line 195, in cleanup
    raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
closing autopilot
tc@pypilot:~$ 

The point is it seems to work fine now...
Reply
#18
Well, this means that something ain't cooking in your kitchen:

nmea client lost connection
nmea client failed to connect 192.168.14.5:20220

What, I don't know. Sean might have more insight.

The following is probably the reason why it does not save your settings:

failed to write pypilot.conf [Errno 13] Permission denied: '/home/tc/.pypilot/pypilot.conf'

What I think happened is that you recovered an old version of pypilot.conf using sudo or something; that makes it owned by root which means that tc user cannot write it anymore. To correct this, try sudo chmod a+w ~/.pypilot/pypilot.conf or equivalent.

The two things might be interrelated - you never know. Try to get rid of the failed write first and take it from there.
Reply
#19
It seems you are getting gps from a client and wind from a server?

Are there two connections or?     I have not tested the nmea client receiving both wind and gps so it could be an error.   can you log some of your nmea messages?

Or maybe your router is disconnecting pypilot's client.
Reply
#20
Sorry please disregard the log posted above, I forgot i had opencpn running in the meantime with the NMEA connections ON! I am re-doing it properly...

So here we are, I fixed the pypilot.conf issue, router is OFF and servo is ON at the beginning:

tc@pypilot:~$ sudo sv stop pypilot
ok: down: pypilot: 0s
tc@pypilot:~$ pypilot
autopilot start 257.745779797
ERROR loading wind.py cannot import name 'HeadingOffset' cannot import name 'HeadingOffset'
ERROR loading gps.py cannot import name 'HeadingOffset' cannot import name 'HeadingOffset'
imu process 4186
nmea process 4191
listening on port 20220 for nmea connections
made imu process realtime
Using settings file RTIMULib.ini
Settings file not found. Using defaults and creating settings file
Detected ICM20948 at standard address
Using fusion algorithm Kalman STATE4
IMU Name: ICM-20948
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
loading servo calibration /home/tc/.pypilot/servocalibration
WARNING: using default servo calibration!!
gps process 4194
Available Pilots: ['simple', 'basic', 'absolute']
warning: failed to open special file /dev/watchdog0 for writing
cannot stroke the watchdog
warning, failed to make calibration process idle, trying renice
pypilotServer process 4196
server setup has 5 pipes
autopilot init complete 258.013293338
servo probe ('/dev/ttyAMA0', 38400) 258.022901828
server add socket ('127.0.0.1', 35378)
server add socket ('127.0.0.1', 35380)
arduino servo found ['/dev/ttyAMA0', 38400]
serialprobe success: /home/tc/.pypilot/servodevice ['/dev/ttyAMA0', 38400]
ICM-20948 init complete
read imu running too _slowly_ 0.06269718700002613 0.05
imu rate set to rate 20
read imu running too _slowly_ 0.05710453099999313 0.05
setting initial gyro bias [-0.751, 0.087, -0.2]
server add socket ('127.0.0.1', 35382)
read imu running too _slowly_ 0.031576614999949015 0.05
gpsd connected
GPSD devices []
EEPROM SIGNATURE ok
calibration loaded, starting 4185
sensors is running too _slowly_ 0.07680781200002684
read imu running too _slowly_ 0.025872551999952975 0.05
signalk process 4192
signalkread token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXZpY2UiOiJweXBpbG90LTI1MTcwMjk3NDg5IiwiaWF0IjoxNjI4MjQ0MjkyLCJleHAiOjE2NTk4MDE4OTJ9.64SjpKncbuBgWYlyWYfFQ9JCkl9TOO-4OOVpBPRgG6s
nmea client failed to connect 192.168.14.5:20220
server, remove socket ('127.0.0.1', 35380)
server add socket ('127.0.0.1', 35388)

# Router is switched ON

nmea client connected 192.168.14.5:20220
sensor found gps tcp AIsocket0
sensor found wind tcp WIsocket0
server, remove socket ('127.0.0.1', 35388)
server add socket ('127.0.0.1', 35394)
server, remove socket ('127.0.0.1', 35394)
server add socket ('127.0.0.1', 35396)
read imu running too _slowly_ 0.031569634999982554 0.05
pypilot socket failed to send to 192.168.14.5:20220 1
pypilot socket failed to send to 192.168.14.5:20220 10
servo calibration invalid False
read imu running too _slowly_ 0.026525311999989754 0.05
pypilot socket failed to send to 192.168.14.5:20220 100
nmea client lost connection
sensor gps lost tcp AIsocket0
sensor wind lost tcp WIsocket0
nmea client connected 192.168.14.5:20220
sensor found gps tcp AIsocket1
sensor found wind tcp WIsocket1
server, remove socket ('127.0.0.1', 35396)
pypilot socket failed to send to 192.168.14.5:20220 1
pypilot socket failed to send to 192.168.14.5:20220 10
pypilot socket failed to send to 192.168.14.5:20220 100
nmea client lost connection
sensor gps lost tcp AIsocket1
sensor wind lost tcp WIsocket1
nmea client connected 192.168.14.5:20220
sensor found gps tcp AIsocket2
sensor found wind tcp WIsocket2
server add socket ('127.0.0.1', 35402)
pypilot socket failed to send to 192.168.14.5:20220 1
pypilot socket failed to send to 192.168.14.5:20220 10
pypilot socket failed to send to 192.168.14.5:20220 100
nmea client lost connection
nmea client connected 192.168.14.5:20220
sensor gps lost tcp AIsocket2
sensor wind lost tcp WIsocket2
sensor found gps tcp AIsocket3
sensor found wind tcp WIsocket3
read imu running too _slowly_ 0.026561561999983496 0.05
pypilot socket failed to send to 192.168.14.5:20220 1

So it seems to work but it is not stable, pypilot interface looks OK I can switch from compass to anything back and forth, engage disengage etc.
Sean: the router cannot work as client only, a WIFI AP is always started (192.168.4.1 default IP)

Here is what comes from the router TCP/192.168.14.5:20220 (Opencpn log)

<GREEN>20:31:20 (TCP:192.168.14.5:20220) $AIGSV,3,2,11,31,30,204,47,29,29,068,48,27,23,270,41,23,18,140,47*6B<0x0D><0x0A>
<GREEN>20:31:20 (TCP:192.168.14.5:20220) $AIGSV,3,3,11,05,14,043,43,25,04,129,28,10,01,165,*57<0x0D><0x0A>
<GREEN>20:31:20 (TCP:192.168.14.5:20220) $AIRMC,193120.000,A,4330.7166,N,00407.9883,E,0.01,0.00,030123,1.8,E,A*12<0x0D><0x0A>
<GREEN>20:31:20 (TCP:192.168.14.5:20220) !AIVDM,1,1,,B,13IVTI?000PBt9VHrOKQW4b`0<0>,0*2F<0x0D><0x0A>
<GREEN>20:31:21 (TCP:192.168.14.5:20220) $AIGSA,A,3,02,16,26,18,23,27,31,05,29,,,,1.66,0.90,1.39*1E<0x0D><0x0A>
<GREEN>20:31:21 (TCP:192.168.14.5:20220) $AIGSV,3,1,11,26,77,289,48,18,74,102,51,16,41,308,45,02,37,050,46*6B<0x0D><0x0A>
<GREEN>20:31:21 (TCP:192.168.14.5:20220) $AIGSV,3,2,11,31,30,204,47,29,29,068,48,27,23,270,41,23,18,140,47*6B<0x0D><0x0A>
<GREEN>20:31:21 (TCP:192.168.14.5:20220) $AIGSV,3,3,11,05,14,043,43,25,04,129,28,10,01,165,*57<0x0D><0x0A>
<GREEN>20:31:21 (TCP:192.168.14.5:20220) $AIRMC,193121.000,A,4330.7166,N,00407.9883,E,0.00,0.00,030123,1.8,E,A*12<0x0D><0x0A>
<GREEN>20:31:22 (TCP:192.168.14.5:20220) $AIGSA,A,3,02,16,26,18,23,27,31,05,29,,,,1.66,0.90,1.39*1E<0x0D><0x0A>
<GREEN>20:31:22 (TCP:192.168.14.5:20220) $AIGSV,3,1,11,26,77,289,48,18,74,102,51,16,41,308,45,02,37,050,46*6B<0x0D><0x0A>
<GREEN>20:31:22 (TCP:192.168.14.5:20220) $AIGSV,3,2,11,31,30,204,47,29,29,068,48,27,23,270,41,23,18,140,47*6B<0x0D><0x0A>
<GREEN>20:31:22 (TCP:192.168.14.5:20220) $AIGSV,3,3,11,05,14,043,43,25,04,129,28,10,01,165,*57<0x0D><0x0A>
<GREEN>20:31:22 (TCP:192.168.14.5:20220) $AIRMC,193122.000,A,4330.7166,N,00407.9883,E,0.00,0.00,030123,1.8,E,A*11<0x0D><0x0A>
<GREEN>20:31:23 (TCP:192.168.14.5:20220) $AIGSA,A,3,02,16,26,18,23,27,31,05,29,,,,1.66,0.90,1.39*1E<0x0D><0x0A>
<GREEN>20:31:23 (TCP:192.168.14.5:20220) $AIGSV,3,1,11,26,77,289,48,18,74,102,50,16,41,308,45,02,37,050,46*6A<0x0D><0x0A>
<GREEN>20:31:23 (TCP:192.168.14.5:20220) $AIGSV,3,2,11,31,30,204,47,29,29,068,48,27,23,270,41,23,18,140,47*6B<0x0D><0x0A>
<GREEN>20:31:23 (TCP:192.168.14.5:20220) $AIGSV,3,3,11,05,14,043,43,25,04,130,28,10,01,165,*5F<0x0D><0x0A>
<GREEN>20:31:23 (TCP:192.168.14.5:20220) $AIRMC,193123.000,A,4330.7166,N,00407.9883,E,0.00,0.00,030123,1.8,E,A*10<0x0D><0x0A>
<GREEN>20:31:23 (TCP:192.168.14.5:20220) $WIMWV,298.0,R,4.6,N,A*22<0x0D><0x0A>
<GREEN>20:31:24 (TCP:192.168.14.5:20220) $AIGSA,A,3,02,16,26,18,23,27,31,05,29,,,,1.66,0.90,1.39*1E<0x0D><0x0A>
<GREEN>20:31:24 (TCP:192.168.14.5:20220) $AIGSV,3,1,11,26,78,288,48,18,74,102,50,16,41,308,45,02,37,050,46*64<0x0D><0x0A>
<GREEN>20:31:24 (TCP:192.168.14.5:20220) $AIGSV,3,2,11,31,30,204,47,29,29,068,48,27,23,270,41,23,18,140,47*6B<0x0D><0x0A>
<GREEN>20:31:24 (TCP:192.168.14.5:20220) $AIGSV,3,3,11,05,14,043,43,25,04,130,27,10,01,165,*50<0x0D><0x0A>
<GREEN>20:31:24 (TCP:192.168.14.5:20220) $AIRMC,193124.000,A,4330.7166,N,00407.9883,E,0.01,0.00,030123,1.8,E,A*16<0x0D><0x0A>
<GREEN>20:31:25 (TCP:192.168.14.5:20220) $AIGSA,A,3,02,16,26,18,23,27,31,05,29,,,,1.66,0.90,1.39*1E<0x0D><0x0A>
<GREEN>20:31:25 (TCP:192.168.14.5:20220) $AIGSV,3,1,11,26,78,288,48,18,74,102,50,16,41,308,45,02,37,050,46*64<0x0D><0x0A>
<GREEN>20:31:25 (TCP:192.168.14.5:20220) $AIGSV,3,2,11,31,30,204,47,29,29,068,48,27,23,270,41,23,18,140,47*6B<0x0D><0x0A>
<GREEN>20:31:25 (TCP:192.168.14.5:20220) $AIGSV,3,3,11,05,14,043,43,25,04,130,27,10,01,165,*50<0x0D><0x0A>
<GREEN>20:31:25 (TCP:192.168.14.5:20220) $AIRMC,193125.000,A,4330.7166,N,00407.9883,E,0.01,0.00,030123,1.8,E,A*17<0x0D><0x0A>
<GREEN>20:31:26 (TCP:192.168.14.5:20220) $AIGSA,A,3,02,16,26,18,23,27,31,05,29,,,,1.66,0.90,1.39*1E<0x0D><0x0A>
<GREEN>20:31:26 (TCP:192.168.14.5:20220) $AIGSV,3,1,11,26,78,288,48,18,74,102,50,16,41,308,45,02,37,050,46*64<0x0D><0x0A>
<GREEN>20:31:26 (TCP:192.168.14.5:20220) $AIGSV,3,2,11,31,30,204,47,29,29,068,48,27,23,270,41,23,18,140,47*6B<0x0D><0x0A>
<GREEN>20:31:26 (TCP:192.168.14.5:20220) $AIGSV,3,3,11,05,14,043,42,25,04,130,26,10,01,165,*50<0x0D><0x0A>
<GREEN>20:31:26 (TCP:192.168.14.5:20220) $AIRMC,193126.000,A,4330.7166,N,00407.9883,E,0.00,0.00,030123,1.8,E,A*15<0x0D><0x0A>
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)