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
#1
Hi Sean and everyone,

I am struggling with trying to get wind mode and GPS mode into pypilot.
I am running pypilot on tinypilot, last version, and I am using a WIFI router (NMEA4WIFI from Luis Vieira). I managed to get both GPS info from my AIS device and wind info from my ST30 both in NMEA0183 on the WIFI network generated by the router, I can see these data into opencpn on a separate PC. 

I configured pypilot in client mode and can access the pypilot web interface through the router WIFI network. In the router WIFI network I open the TCP port 20220 (please see configuration attached). 

However I cannot select neither GPS nor Wind mode in pypilot web interface, it always gets back to compass. I believe I am almost done at this point but cannot understand what is missing, so a little help would be highly appreciated!
MBJ

       
Reply
#2
From what I understand you have opened up a socket listener 20220/TCP on your router, but that won't work - you need to actively create a connection to the pypilot's 20220/TCP socket. This would require specifying pypilot's IP address. It does not seem to me that it can be done with that router.

However, if you have OpenCPN, you can use that to forward the NMEA messages to pypilot. For that, you first need to configure your pypilot with a fixed IP address through its web interface, if you haven't already done so. Then you can either create a data connection in OpenCPN to that IP address, output to tcp socket 20220, with at least RMC and APB messages for GPS mode and MWV messages for Wind modes. This allows you to troubleshoot using OpenCPN's NMEA debug window. Alternatively, you can check Forward NMEA in the OpenCPN PyPilot plugin configuration.
Reply
#3
Hello Ironman,
Thank you for your help, I believe the router does not listen to port TCP/20220 but sends what you choose for the other devices to listen to (in my case inputs P1 and P4). It does the same with the port UDP/2000 and this is how opencpn on PC and Navionics on android get NMEA data from (and both work). The router can manage UDP and TCP at the same time (I checked that).

What i tried lately is:
1 - swap pypilot and router roles in the WIFI network connection so going from Pypilot-client/router-server to Pypilot-server/router-client and got exactly the same result, opencpn on PC and navioncis on android get NMEA data right away but only compas mode is available in pypilot

2 - from the router I wired a NMEA0183/USB converter into the RPi 3B where pypilot runs and changed the router configuration accordingly and got the exact same result. I tried to change USB ports with no better results. Here is the HW used: https://fr.aliexpress.com/item/1005004255880503.html

If nothing obvious comes to mind I believe I will have to ssh pypilot end get some logs, listen to ports, etc.
Reply
#4
This is what I get when listening to port 20220 on the router:

tc@pypilot:~$ telnet 192.168.14.5 20220
$AIGSA,A,3,02,12,18,29,20,31,25,32,11,26,22,,1.36,0.81,1.08*18
$AIGSV,3,1,11,29,89,342,46,25,56,082,49,31,56,295,46,02,48,137,50*69
$AIGSV,3,2,11,22,26,258,43,12,26,090,47,11,19,043,40,26,19,290,38*61
$AIGSV,3,3,11,18,17,174,43,32,14,226,29,20,06,069,39*54
$AIRMC,172319.000,A,4330.7159,N,00407.9874,E,0.02,0.00,311222,1.8,E,A*10
$WIMWV,105.0,R,10.6,N,A*10
!AIVDM,1,1,,A,D02;bN1R<Lfp00M6EsDu6D0,2*4E

And on pypilot:

tc@pypilot:~$ telnet 192.168.14.1 20220
$APXDR,A,-0.148,D,PTCH*5B
$APXDR,A,-3.025,D,ROLL*40
$APHDM,7.379,M*39
$APXDR,A,-0.201,D,PTCH*55
$APXDR,A,-2.827,D,ROLL*4B
$APHDM,7.144,M*35
$APXDR,A,-0.220,D,PTCH*56
$APXDR,A,-2.665,D,ROLL*43
$APHDM,6.991,M*34
Reply
#5
it could be that gps or wind data is not valid?

If you have the data in opencpn you can forward it to pypilot through a tcp connection on port 20220

If you did stop pypilot with "sudo sv down pypilot" you could run
nc -l 20220 to see if anything connects and sends nmea and if it does post it because your particular messages may not be interpreted.

You need specific gps and wind sentences
Reply
#6
(2022-12-31, 06:36 PM)seandepagnier Wrote: it could be that gps or wind data is not valid?

If you have the data in opencpn you can forward it to pypilot through a tcp connection on port 20220

If you did stop pypilot with "sudo sv down pypilot"   you could run
nc -l 20220    to see if anything connects and sends nmea and if it does post it because your particular messages may not be interpreted.

You need specific gps and wind sentences

Hi Sean,
We sent both our messages almost at the same time, you can see above the NMEA sentences I have. I'd rather not use opencpn for sailing, i use an android tablet instead with navionics and the pypilot web interface (and remote too).
Reply
#7
Anyway.. it is obvious of 2 things. Your router is listening on 20220 and so is pypilot.

It is impossible to connect them if they are both servers.

What you would need to do is either connect to in a browser to pypilot:
http://192.168.14.1 and set the nmea client and port to your router

Or make your router act as a client to pypilot.

With signalk everything is autodiscovered and detected but not nmea.

You can also connect opencpn to both router and pypilot and check both input and output on the connection and use opencpn to route the data. This may be useful also in testing to determine the problem even if you do not want to rely on opencpn running.
Reply
#8
OK Ironman you were right I believe, I did as you said and trough opencpn it works fine, I can select any of the 4 available options in the pypilot web interface, compass, GPS, wind and true wind. See below.
I have pypilot configured as server (master) and the router configured as client to pypilot and as master as well by itself

The question now is what to do to reach the same result without opencpn (which means PC on in my case) ?

1 - modify pypilot in such a way it can listen to the router UDP or TCP port and forward it to its own TCP:20220 port (what opencpn does as of now)
2 - try to get the NMEA sentences into pypilot trough the RS422/USB converter from the router

I don't know what RS422/USB converter is worth, so I would try option 1 first if you could point me to the files that must be modified and what commands to look into.

And best wishes for this new year, gentle winds and desert beaches for all! 

   
Reply
#9
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.
Reply
#10
Aha brilliant! That's new to me. When was that added?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)