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
Pypilot, can I control it over 20220 port?
#1
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.
Reply
#2
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.
Reply
#3
(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

   
Reply
#4
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.
Reply
#5
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!
--
Larry - s/v Katie Lee Passport 45 Ketch (For Sale) - somewhere in Taiwan
Reply
#6
(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.
Reply
#7
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.
Reply
#8
(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
Reply
#9
(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.
Reply
#10
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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)