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 data into Pypilot
#11
(2022-08-16, 03:23 PM)seandepagnier Wrote: Does gps make it through signalk to pypilot? Yes. I am able to follow a route defined in OpenCPN automatically. I also managed to switch between Compass and GPS from the web interface.

Did you grant read/write permissinons or only read? Read AND write.

Do you still get the errors of "nmea client lost connection" ? Yes

(2022-08-16, 09:45 AM)ironman Wrote: Does the timestamp of environment.wind.angleApparent update? Is there a steady Connection activity (deltas/second) in the signalk dashboard? Having a value in the dashboard does not mean that the data keeps on flowing... There are instrument panel webapps for signalk available - do you see wind there?

Recompiling pypilot does not seem opportune - your output suggests a recent enough version to me.

Some opencpn plugins did not seem to pick up on the (relatively) new signalk connection. I believe either the dashboard or the tactics dashboard did at least.

Yes. Timestamps update every 10 seconds for the NMEA data


Attached Files Image(s)
   
Reply
#12
My guess about GPS mode working for you is that pypilot only receives the GPS data from the package of nmea messages that opencpn generates when a route has been activated.
Reply
#13
In trying to replicate this, I found a problem with the pypilot signalk connection, which I added as an issue in the pypilot github. This might have been related to the failure to use the native signalk connection, although then I would have expected this to appear in your logging.

So for the time being, the use of sk-to-nmea0183, as I described earlier, might be the only viable option.
Reply
#14
Thanks a lot for your effort to help me, Sean and Ironman. I will try the nmea0183 solution for now.
Reply
#15
the nmea client error is because you have set the nmea client... Suggest clearing this in the configuration (you can do from web) or setting nmea.client to blank

I will test/verify the wind data in signalk in the next week or so. It used to work. I am a bit sick today.
Reply
#16
Sean. I now removed the nmea client in the web interface. That helped on the complaints about the nmea connections, but the wind data is still missing. See screenshots.
Could there be other issues further upstream in the nmea traffic? Im noticing that openCPN also appears to miss access to the Wind data... Could there be some particular format to my NMEA sentences concerning wind? The setup is a straight forward brand new B&G setup, successfully imported to SignalK... I don't see what could be the issue here... 

BTW. It appears that pypilot connects to Victron as well as WISENET-QNO-7020R-E4302235E2A9 (battery monitor and masthead camera, respectively). Could that create some sort of "interference" with the wind data?

BTW2. All the "too long write pipe ..." and "read imu running too _slowly_ " messages... Any issues, or completely normal?

Leif


Code:
EEPROM SIGNATURE ok
gpsd connected
GPSD devices []
server add socket ('127.0.0.1', 56366)
read imu running too _slowly_ 0.035087999999859676 0.05
server add socket ('127.0.0.1', 56368)
sensors is running too _slowly_ 0.34103699999991477
signalk process 4068
signalkread token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXZpY2UiOiJweXBpbG90LTI1MTcwMjk3NDg5IiwiaWF0IjoxNjQ5NDQyMzY2LCJleHAiOjE2ODA5OTk5NjZ9.e7tqDVSlizLRBdWMKClwzpElwAkgM6BQK7frFViNDlY
signalk zeroconf service add endeligpi._http._tcp.local. _http._tcp.local.
signalk server found 192.168.1.242:80
signalk zeroconf service add Victron._http._tcp.local. _http._tcp.local.
signalk zeroconf service add WISENET-QNO-7020R-E4302235E2A9._http._tcp.local. _http._tcp.local.
signalk probe... 192.168.1.242:80
signalk found ws://192.168.1.242/signalk/v1/stream?subscribe=none
signalk connected to ws://192.168.1.242/signalk/v1/stream?subscribe=none
calibration loaded, starting 4059
too long write pipe 0.033670902252197266 pypilotServer pipe4[1] 21
too long write pipe 0.029482126235961914 pypilotServer pipe4[1] 21
too long write pipe 0.026315689086914062 pypilotServer pipe4[1] 21


Attached Files Image(s)
               
Reply
#17
The message about too long to write is not harmful if it occurs during startup or rarely. It does occur normally during startup.

If it constantly occurs all the time, it is an indication that pypilot processes are getting stuck in system calls trying to send data around and this can impact the ability to calculate things and make the autopilot work. So unfortunately its not really a bug in pypilot although perhaps things could be improved to mitigate the issue, but it is a limitation of the platform. If you get this too much and can disconnect things and simplify the setup, please let me know what caused it.

I dont think pypilot connects to your victron. It may list it and probe it (pypilot doesnt know if the victron has a signalk server... if it did have one, it could use it but it shouldnt cause issue)

You are using a setup I dont have a way to test personally which explains why there could be issues. It seems your wind data is n2k, and getting converted to signalk somehow. There is never any nmea0183 for wind. This should be "ok" but obviously it is not working for you. With signalk you cannot use opencpn to forward data, it can only forward nmea0183. So in this case you would have to rely on the direct connection from pypilot to signalk.

If you are not able to get wind data in opencpn from signalk either.. I am speculating that perhaps the bug is in converting n2k to signalk itself? The only code in OpenCPN that processes signalk wind data is the dashboard plugin, so dont expect anything else to work.

It also maybe possible to get the signalk server to output nmea0183. In this case you could feed this into pypilot/opencpn, but it is not the preferred method. I would like to improve pypilot, so it may be something simple and inconsistent.

Wind data updating every 10 seconds is not good enough for autopilot to steer to wind in my opinion, and without improving the output rate, I would not expect good results. pypilot will timeout data sources after 4 seconds.... so that it can switch to compass mode or gps depending on other factors. My wind sensors output 10 or 20 times per second, but generally you need at least 1 output per second for reasonable autopilot use. You could mod pypilot to not timeout after 4 seconds and perhaps get marginal results, but its not a good change for everyone.

If you can modify the signalk.py and uncomment the #print line in the debug definition, it will print much more information regarding signalk. Sometimes the signalk format changes, or it can't parse it somehow, and if its a case I have not produced then its likely to cause a problem. It seems that you are getting gps into pypilot via tcp, so you have nmea0183 for gps, just not wind.

Let me know what you find, and I think we can get this working so I am really interested to know the exact cause of the issue.
Reply
#18
(2022-08-16, 11:38 PM)ironman Wrote: So for the time being, the use of sk-to-nmea0183, as I described earlier, might be the only viable option.

And to make it a bit less cryptic, here's the screendump of the signalk settings that allow generating nmea0183 messages from the signalk database, and sending them from signalk straight into pypilot's 20220 port.

To install the plugin, go to appstore, available, choose all, search for signalk-to-nmea0183, click the download/install button, wait until finished, restart the server, then configure. The messages I seem to be sending are APB, MWV, and RMB; this seems odd because I think RMC should be included as well:

[Image: 185674766-dd447abc-66ad-4e71-a805-28a557a222d7.png]

The add a data connection; replace 10.10.10.3 with your pypilot's ip address.

[Image: 185674698-cf15747b-149f-4c73-8b24-36fe94262fb8.png]
Reply
#19
Thanks Ironman. 
I tried to set up the nmea0183 solution, with all settings as in your setup... Got error in SK, and even pypilot crashed. See screenshots.

(2022-08-19, 01:38 PM)seandepagnier Wrote: If you are not able to get wind data in opencpn from signalk either..   I am speculating that perhaps the bug is in converting n2k to signalk itself?    The only code in OpenCPN that processes signalk wind data is the dashboard plugin, so dont expect anything else to work.

Actually, i managed to view wind data in openCPN, using the dashboard plugin. The update rate here seems great, with updates several times per second (>4). 

I guess that means that signalK is not the issue anyway...

Now I will try to enable the debug info  you suggested...

Code:
tc@pypilot:/mnt/mmcblk0p2/tinypilot/pypilot/pypilot$ sudo nano signalk.py
I modified signalk.py (see screenshot), but running the pypilot remains unchanged. I guess i'll have to rebuild the pypilot in order to effectuate the debug output??? 

If I do that, I suspect that I will run into issues that I experienced last time i tried, using these commands (taken from https://github.com/pypilot/workbook/wiki...r-the-hood)


Code:
cd
mkdir pypilot-update
cd pypilot-update/
git clone git://github.com/pypilot/pypilot
git clone --depth 1 git://github.com/pypilot/pypilot_data
cp -rv pypilot_data/* pypilot
cd pypilot
. pypilot.build

I can certainly try that again, but I will first go sailing... with an (almost) perfectly functioning pypilot :-)


Attached Files Image(s)
               
Reply
#20
Yay!

you found a bug. It tries to compensate the wind sensor from boat motion but this did not work as the calculation had a typo.. I fixed just now. Since the boat rolling or pitching creates an apparent wind... The easiest way is to change wind.sensors_height to 0 for now.

This seems to indicate wind would have worked, but you had the wind.sensors_height nonzero. Did you change it before, or do you remember?



You do not need to rebuild pypilot to test code changes. Once you edit signalk.py or any file, you can simply:
cd
cd pypilot/pypilot
python3 autopilot.py

to run out of the current tree rather than the installed location.

This indicates you were getting wind data into pypilot via nmea. Still does not explain why wind didnt work with signalk directly.. I will try some tests.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)