OpenMarine
Pypilot, can I control it over 20220 port? - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: Pypilot (https://forum.openmarine.net/forumdisplay.php?fid=17)
+--- Forum: General discussion (https://forum.openmarine.net/forumdisplay.php?fid=18)
+--- Thread: Pypilot, can I control it over 20220 port? (/showthread.php?tid=1873)

Pages: 1 2


Pypilot, can I control it over 20220 port? - partyvi - 2019-07-07

I installed openplotter+opencpn on raspberry 3+arduino motor controller 
Works great. Now I am looking to add dedicated keyboard for autopilot.

I am going to make module with real buttons to control autopilot without clicking mouse and touchscreen.

Is Pypilot can be controlled some external way. Probably I can reverse engineer how open on plugin is doing this, but probably some documentation exists.
Point me on it please.


RE: Pypilot, can I control it over 20220 port? - seandepagnier - 2019-07-09

The pypilot_lcd script is designed to drive an lcd over spi pins, and read from a keypad on gpio pins. It can also read from an IR sensor and soon from 433mhz radio transmitter.

Otherwise you can control it from tcp. The port 20220 is only used for nmea so only autopilot route commands.


RE: Pypilot, can I control it over 20220 port? - wdee - 2019-07-10

(2019-07-09, 03:14 AM)seandepagnier Wrote: The pypilot_lcd script is designed to drive an lcd over spi pins, and read from a keypad on gpio pins.   It can also read from an IR  sensor and soon from 433mhz radio transmitter.

Otherwise you can control it from tcp.  The port 20220 is only used for nmea so only autopilot route commands.

Is it not possible to achieve some limited control over the web-app-interface to pypilot to achieve incremental/decrement of heading?

I.E.,  shown in attachment figure

I would rather address signalK via web or directly, though

Does that web-app need some sort of security token to prevent hack-in?

Dont really want to rely on network-security all the time for app-security

[attachment=479]


RE: Pypilot, can I control it over 20220 port? - seandepagnier - 2019-07-10

Port 20220 is used for nmea0183 communication and is useful for route following since opencpn can send these messages.

Instead, you can control heading changes and everything else from tcp port 21311. This is exactly how pypilot_lcd works. You can run it with the screen disabled, and it will still read from gpio and send commands to the autopilot over the network. Normally it connects to the localhost but it can be configured to use a remote host.

There is currently no app-level security, instead for now, you can use an encrypted wifi network. It's a nice idea but I'm not really sure what the use case is.


RE: Pypilot, can I control it over 20220 port? - svkatielee - 2019-07-10

I have not worried about WiFi security with my sensors on the boat because most of these small devices are only able to connect a few meters away through the teak/fiberglass hull and all. In practice, I can sometimes connect to my boat when in a marina from the boat in the next slip, but seldom from 2 slips away. And I don't usually anchor that close to other boats either.

I usually connect to the internet through my cellphone and that I do secure. But I know and I trust my neighbors not to hyjack my GPS or AIS signal while docked.

I try not to sail close enough to other boats underway that it could be a problem!


RE: Pypilot, can I control it over 20220 port? - partyvi - 2019-07-14

(2019-07-10, 12:13 AM)wdee Wrote:
(2019-07-09, 03:14 AM)seandepagnier Wrote: The pypilot_lcd script is designed to drive an lcd over spi pins, and read from a keypad on gpio pins.   It can also read from an IR  sensor and soon from 433mhz radio transmitter.

Otherwise you can control it from tcp.  The port 20220 is only used for nmea so only autopilot route commands.

Is it not possible to achieve some limited control over the web-app-interface to pypilot to achieve incremental/decrement of heading?

I.E.,  shown in attachment figure

I would rather address signalK via web or directly, though

Does that web-app need some sort of security token to prevent hack-in?

Dont really want to rely on network-security all the time for app-security

Unfortunately Web interface is not working well on my installation, i am able to open page and it even reacts on commands but main screen is not updates after buttons activated. Neither other tabs. Is it known issue? I did not worry it does not work due i did not plan to  use it but probably i will do. 
Does somebody had similar malfunction?

(2019-07-10, 12:44 AM)seandepagnier Wrote: Port 20220 is used for nmea0183 communication and is useful for route following since opencpn can send these messages.

Instead, you can control heading changes and everything else from tcp port 21311.  This is exactly how pypilot_lcd works.  You can run it with the screen disabled, and it will still read from gpio and send commands to the autopilot over the network.  Normally it connects to the localhost but it can  be configured to use a remote host.

There is currently no app-level security, instead for now, you can use an encrypted wifi network.  It's a nice idea but I'm not really sure what the use case is.

Thanks, is somewhere specification for the commands on 21311 port? If so, point me on it, please.


RE: Pypilot, can I control it over 20220 port? - seandepagnier - 2019-07-14

If would be best to study the current 4 implementations to see how they communicate. They all use port 21311:

1) pypilot/ui/autopilot_control.py - python control client
2) pypilot/lcd/lcd.py - spi lcd, gpio keypad and ir remote
3) pypilot/webapp/webapp.py - python/javascript control from website, web interface for pypilot using web sockets
4) pypilot_pi - opencpn plugin for pypilot. This reimplements all of the communication in c++.


I would pick which one of the above most closely matches your goals to read the source code first.


RE: Pypilot, can I control it over 20220 port? - partyvi - 2019-07-19

(2019-07-14, 05:22 PM)seandepagnier Wrote: If would be best to study the current 4 implementations to see how they communicate.  They all use port 21311:

1)  pypilot/ui/autopilot_control.py -  python control client
2)  pypilot/lcd/lcd.py -  spi lcd, gpio keypad and ir remote
3)  pypilot/webapp/webapp.py  -  python/javascript control from website, web interface for pypilot using web sockets
4)  pypilot_pi - opencpn plugin for pypilot.  This reimplements all of the communication in c++.


I would pick which one of the above most closely matches your goals to read  the source code first.

Thanks to everyone. Smile


RE: Pypilot, can I control it over 20220 port? - gustavo - 2021-09-28

(2019-07-19, 01:34 AM)partyvi Wrote:
(2019-07-14, 05:22 PM)seandepagnier Wrote: If would be best to study the current 4 implementations to see how they communicate.  They all use port 21311:

1)  pypilot/ui/autopilot_control.py -  python control client
2)  pypilot/lcd/lcd.py -  spi lcd, gpio keypad and ir remote
3)  pypilot/webapp/webapp.py  -  python/javascript control from website, web interface for pypilot using web sockets
4)  pypilot_pi - opencpn plugin for pypilot.  This reimplements all of the communication in c++.


I would pick which one of the above most closely matches your goals to read  the source code first.

Thanks to everyone. Smile

Hi all. I have the same issue that partyvi.The web interface is not working in my instalation (Rpi 3+, and open plotter, arduino nano motor controller L298N). Buttons reacts but the main page dont upgrade anything.
When I  tried in the terminal "pypilot_hat" it answer that not is a command.So until now I can´t  make a keypad to control autopilot.
I will apreciate some orientation.

(2019-07-19, 01:34 AM)partyvi Wrote:
(2019-07-14, 05:22 PM)seandepagnier Wrote: If would be best to study the current 4 implementations to see how they communicate.  They all use port 21311:

1)  pypilot/ui/autopilot_control.py -  python control client
2)  pypilot/lcd/lcd.py -  spi lcd, gpio keypad and ir remote
3)  pypilot/webapp/webapp.py  -  python/javascript control from website, web interface for pypilot using web sockets
4)  pypilot_pi - opencpn plugin for pypilot.  This reimplements all of the communication in c++.


I would pick which one of the above most closely matches your goals to read  the source code first.

Thanks to everyone. Smile

Hi all. I have the same issue that partyvi.The web interface is not working in my instalation (Rpi 3+, and open plotter, arduino nano motor controller L298N). Buttons reacts but the main page dont upgrade anything.
When I  tried in the terminal "pypilot_lcd" it answer that not is a command.So until now I can´t  make a keypad to control autopilot.
I will apreciate some orientation.


RE: Pypilot, can I control it over 20220 port? - ironman - 2021-10-04

I built my own UI that connects directly to the pypilotServer; see link below. In my case I connect through IPC but the same can be done through the 21311 socket. The meat of the code is in handleKey() at line 233:

https://github.com/marcobergman/pypilot_ray