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
OpenCPN pypilot plugin disconnected
#1
Hi all,

I have been playing around with openplotter on a RI4. And after a few months I think I got it working quite well. I am running the latest image of openplotter. I have OpenCPN 5.2.4 running together with pypilot 2.1.1. Not only that, but I am able to send GPS data from OpenCPN to pypilot. I got and Arduino Nano connected (working and detected with SYNC in pypilot) but still have to connect that to the motor controller that I bought from Sean, but all seems well, and I think that won't be an issue. 

However, I do encounter one issue with the pypilot plugin in openCPN. It constantly says it's disconnected. I have it pypilot plugin set in the setting to connect to local host (127.0.0.1) and in the opencpn setting I have a read and write connection to post and read on port 20220 (TCP) on localhost (also tried 127.0.0.1 manually no success). Pypilot nmea0183 is connected to signal K using port 20220 and is reading and writing data (receiving GPS from openCPN and writing compass heading which is retrieved by openCPN). But the pypilot plugin seems to stay disconnected. I know now it is not necessary and will continue my project. Buy for the future i want to create (or buy) as tiny pilot and just use the raspberry for plotting charting and sending headings to tinypilot. And using the plugin would be easier. 

I am running pypilot 0.22.7.0 (I had to download it from cloud smith, the plugin manager of openCPN currently has a bug which i reported to the GIT repository and is being fixed as we speak but i got an alternative to download a tar file which worked and plugin is installed and visible)

Any idea what I am missing?
Reply
#2
I believe what you have is the old version of pypilot and the new version of the pypilot opencpn plugin. This is confusing (even for me) because the openplotter-pypilot plugin version 2.1.1 which is what is installed by openplotter will give you pypilot 0.15. So you can either update pypilot directly from git, or it would be great if you could try out my improvements to openplotter-pypilot which are currently being evaluated but hopefully this version will be in openplotter soon.

https://github.com/pypilot/openplotter-pypilot

Just use "sudo python3 setup.py install" and then try running openplotter-pypilot and update pypilot. This gives a bit more control. If you run into trouble let me know, and if you cannot update pypilot from the gui there just try pulling pypilot directly from git
https://github.com/pypilot/pypilot

again "sudo python3 setup.py install"

This should get everything updated to the new version of pypilot which automatically communicates with signalk (once you grant it read/write permission)

note: port 20220 is not signalk, it is nmea0183
Reply
#3
Thanks, I will give it a go. To be sure these are the steps I need to take.

Get clone from repository:

git clone https://github.com/pypilot/pypilot
git clone https://github.com/pypilot/pypilot_data
cp -rv pypilot_data/* pypilot
cd pypilot
python setup.py build
sudo python setup.py install
cd ..
git clone https://github.com/openplotter/openplotter-pypilot
cd openplotter-pypilot
dpkg-buildpackage -b
Install the package:

cd ..
sudo dpkg -i openplotter-pypilot_x.x.x-xxx_all.deb
Run post-installation script:

sudo pypilotPostInstall

Run openplotter-pypilot

openplotter-pypilot
Reply
#4
(2021-06-24, 03:05 AM)seandepagnier Wrote: I believe what you have is the old version of pypilot and the new version of the pypilot opencpn plugin.   This is confusing (even for me) because the openplotter-pypilot plugin version 2.1.1 which is what is installed by openplotter will give you pypilot 0.15.    So you can either update pypilot directly from git, or it would be great if you could try out my improvements to openplotter-pypilot which are currently being evaluated but hopefully this version will be in openplotter soon.

https://github.com/pypilot/openplotter-pypilot

Just use "sudo python3 setup.py install" and then try running openplotter-pypilot and update pypilot.    This gives a bit more control.   If you run into trouble let me know, and if you cannot update pypilot from the gui there just try pulling pypilot directly from git
https://github.com/pypilot/pypilot

again "sudo python3 setup.py install"

This should get everything updated to the new version of pypilot which automatically communicates with signalk (once you grant it read/write permission)

note:  port 20220 is not signalk, it is nmea0183

I have tried both methods i now have pypilot 2.1.1(beta) installed with nog succes...
Reply
#5
the version in git of openplotter-pypilot is 2.2, you got from github/openplotter/openplotter-pypilot not github/pypilot/openplotter-pypilot

It's still being evaluated not included directly in openplotter, so this explains why this step failed.


As for pypilot itself, the install is simplified. You shouldn't need to worry about the data. My instruction:

sudo python3 setup.py install

is slightly different, as you used "python" which is python2, when python3 is needed which would explain why this step failed. It should have given you a message like:
('pypilot requires python version 3. python version is', '2.7.18rc1 (default, Apr 7 2020, 12:05:55) \n[GCC 9.3.0]')
Please try just installing pypilot:

git clone github.com/pypilot/pypilot
cd pypilot
sudo python3 setup.py install

post the output from this if it fails
Reply
#6
(2021-06-25, 04:43 AM)seandepagnier Wrote: the version in git of openplotter-pypilot is 2.2, you got from github/openplotter/openplotter-pypilot not github/pypilot/openplotter-pypilot

It's still being evaluated not included directly in openplotter, so this explains why this step failed.


As for pypilot itself, the install is simplified.  You shouldn't need to worry about the data. My instruction:

sudo python3 setup.py install

is slightly different, as you used "python" which is python2, when python3 is needed which would explain why this step failed.   It should have given you a message like:
('pypilot requires python version 3.  python version is', '2.7.18rc1 (default, Apr  7 2020, 12:05:55) \n[GCC 9.3.0]')
 Please try just installing pypilot:

git clone github.com/pypilot/pypilot
cd pypilot
sudo python3 setup.py install

post the output from this if it fails

Yes, I used python3 after I got the error message. I also had to install the dependency python3-all and some other for the dkpg build (i have some experience with pyhon and linux). I tried both methods didn't work, then i posted that i could get it to connect, and I still have pypilot 2.1.1 when looking at the pypilot window.

So after I have read your reply, I did the following again:

$git clone https://github.com/pypilot/pypilot

- Successfully created the PyPilot folder (had to delete the old one first using $rm pypilot)

$cd pypilot

-changed the directory to /python

$sudo python3 setup.py install

- whole install process ending with this message:

                 Installed /usr/local/lib/python3.7/dist-packages/pypilot-0.24-py3.7-linux-armv7l.egg
                 Processing dependencies for pypilot==0.24
                 Finished processing dependencies for pypilot==0.24

Then to open pypilot I do the following:

$openplotter-pypilot

This gives the following message and opens pypilot with 2.1.1 in the header of the window

                 Settings file not found. Using defaults and creating settings file
                 Failed to open SPI bus 0, select 0
                 Failed to open SPI bus 0, select 1
                 No IMU detected
                 Using fusion algorithm RTQF
                 wrong external apps format: unexpected EOF while parsing (<string>, line 0)
                 wrong external apps format: unexpected EOF while parsing (<string>, line 0)

As you can see this pypilot is not working correctly as now it says NA everywhere and is nothing is working, so something when wrong to fix this I run the following command (this reverts the dependencies back to the old settings somehow and does not build upon the most recent install but rather builds on the old one):

$sudo pypilotPostInstall

-This give the final message:

                 Installed /usr/local/lib/python3.7/dist-packages/pypilot-0.16-py3.7-linux-armv7l.egg
                 Processing dependencies for pypilot==0.16
                 Finished processing dependencies for pypilot==0.16
                 DONE
                 Creating config files...
                 DONE
                 Adding pypilot, pypilot_boatimu and openplotter-pypilot-read services...
                 DONE
                 Setting version...
                 DONE

now pypilot is working again as it should but the issue of not being able to connect is still there, somewhere after the install i have to do something to get pypilot working again but I don't know what or how. The $sudo pypilotPostInstall just reverts everything back to the old installation.

Any suggestions or ideas?
Reply
#7
YEEEEEEYY

It works (kind of)

$pypilot -- autopilot
followed by a reboot helped, pypilot is online getting data from imu and connected to controller. Opening pypilot plugin in opencpn shows a connected control and i can control AP from there now.

However, I have a new error; as soon as i activate a waypoint and opencpn sends gps data the connection is intermittent to pypilot (connects disconnects, connects and so on) and autopilot (the controller itself) freezes and unfreezes every second.
 
I get the following error message on signal K: TcpProvider: connect ECONNREFUSED 127.0.0.1:20220 


Looking at the plugin it connects and disconnects. As soon as i deactivate the route in opencpn all is normal. The previous install didn't have this problem and GPS data was sent and adjusted for and working effortless. I think it is because port 20220 is being used by opencpn and pypilot at the same time, giving some issues (this is an assumption based what I can see for now).

Thanks for all the help I think I'm almost there.
Reply
#8
you stumbled on a typo in the code...

usually python is more forgiving, but in this case an accidental comma caused it to crash so I have fixed it in git now, just update pypilot again from git (git pull) and install again and it should be ok

Thanks for the testing, and sorry about this.
Reply
#9
(2021-06-26, 07:50 AM)seandepagnier Wrote: you stumbled on a typo in the code...

usually python is more forgiving, but in this case an accidental comma caused it to crash so I have fixed it in git now, just update pypilot again from git (git pull) and install again and it should be ok

Thanks for the testing, and sorry about this.

Thank you very much for your time and effort, I will continue testing it. It works and I am happy with the system (for now  Big Grin)

For someone reading through this in the future, after installing open pypilot using the application and pres refresh.
Close the application and run the following command to check if everything is working:

pi@openplotter:~ $ pypilot -- autopilot

This should give some code and keep running, such as checking the imu etc. You can close that now and reboot after that all should be fine!.

Happy sailing all!
Reply
#10
pypilot does not take arguments, so "pyplot -- autopilot" would do the same as just running "pypilot"
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)