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 steals serial GPS from signalk
#11
At least your daemon listens to me ;-)
Reply
#12
(2024-03-26, 11:26 AM)ironman Wrote: At least your daemon listens to me ;-)

I don't want it or need it though!  Big Grin

Renamed /lib/systemd/system/gpsdctl@.service with .bak. That shut it up  Cool
Can't disable it in systemd for some reason. 

Code:
pi@openplotter:~ $ sudo systemctl status gpsdctl@ttyACM0.service
Unit gpsdctl@ttyACM0.service could not be found.

Leave it for a while now & see what happens .....
Reply
#13
Agreeing to disagree, then I would do it like this:

Code:
pi@openplotter:~ $ sudo systemctl stop gpsd
Warning: Stopping gpsd.service, but it can still be activated by:
  gpsd.socket
pi@openplotter:~ $ sudo systemctl disable gpsd
Removed /etc/systemd/system/sockets.target.wants/gpsd.socket.
Reply
#14
(2024-03-26, 04:28 PM)ironman Wrote: Agreeing to disagree, then I would do it like this:

Code:
pi@openplotter:~ $ sudo systemctl stop gpsd
Warning: Stopping gpsd.service, but it can still be activated by:
  gpsd.socket
pi@openplotter:~ $ sudo systemctl disable gpsd
Removed /etc/systemd/system/sockets.target.wants/gpsd.socket.

Doesn't work. There's gpsd.socket as well which will start up gpsd and gpsdctl@.service which will start it as well and  can't be disabled using systemctl. 
Seems stable now, been running for a while. Can't see the point of pypilot being in charge of the gps then sending it to signalk to send out on 10110. Makes no difference now if pypilot is running or not, everything still gets GPS. 
 Pypilot now looks like it gets position over tcp from signalk same as wind data. 
Code:
server setup has 6 pipes
sensor found gps tcp GPsocket0 Tue Mar 26 11:59:58 2024
ICM-20948 init complete
sensor found wind tcp IIsocket0 Tue Mar 26 11:59:58 2024

Seems to work fine so far...  Undecided
Reply
#15
I intended pypilot to be flexible to support any possible data configurations...

What you are probably experiencing is hotplug rules that kick off gpsd when a gps device is plugged in. In this case, pypilot is supposed to be smart enough to realize if a device is manage by gpsd, and not try to access it, but instead read gps from gpsd.

Yes pypilot could in theory directly read the gps, send it to signalk and signalk could send it out 10110. I dont think this is all that useful as pypilot would also send it out 20220. It is really up to the user, but maybe we need to determine what scenarios are not useful but are somehow occuring to try to prevent them?

Having signalk manage the gps is also a possibility, with pypilot getting the gps data directly from signalk, but it seems maybe you have pypiot set with a client socket to signalk nmea? This is also possible, but it should be possible for pypilot to get gps directly from signalk without it being converted to nmea.

I have always thought the most sensible solution is to have gpsd manage the gps. That way it will work even if the gps is set into binary mode (sirf) and will work regardless of if pypilot is running or not. I am not sure if signalk server manages this well, but it would be nice if it could also get gps from gpsd, and so in this way, the gps would work with or without signalk-server, and similarly for opencpn and so forth.
Reply
#16
(2024-03-26, 11:34 PM)seandepagnier Wrote: I intended pypilot to be flexible to support any possible data configurations...

What you are probably experiencing is hotplug rules that kick off gpsd when a gps device is plugged in.    In this case, pypilot is supposed to be smart enough to realize if a device is manage by gpsd, and not try to access it, but instead read gps from gpsd.

Yes pypilot could in theory directly read the gps, send it to signalk and signalk could send it out 10110.  I dont think this is all that useful as pypilot would also send it out 20220.  It is really up to the user, but maybe we need to determine what scenarios are not useful but are somehow occuring to try to prevent them?

Having signalk manage the gps is also a possibility, with pypilot getting the gps data directly from signalk,  but it seems maybe you have pypiot set with a client socket to signalk nmea?  This is also possible, but it should be possible for pypilot to get gps directly from signalk without it being converted to nmea.

I have always thought the most sensible solution is to have gpsd manage the gps.  That way it will work even if the gps is set into binary mode (sirf) and will work regardless of if pypilot is running or not.  I am not sure if signalk server manages this well, but it would be nice if it could also get gps from gpsd, and so in this way, the gps would work with or without signalk-server, and similarly for opencpn and so forth.
Thnkx for the reply Sean, reading that I think it's all working as intended, what seemed to be happening is that gpsd was always running but when pypilot talks to gpsd then gpsd woke up and  the signalk connection to the gps serial device was interrupted.
I tried a signalk connection to gpsd, need to have another look but it seemed to forward the nmea data to port 10110 but not convert anything to signalk.
At the moment I forced gpsd to stay off by renaming /lib/systemd/system/gpsdctl@.service to /lib/systemd/system/gpsdctl@.service.bak
Been running stable since then but a bit of a messy hack, still - it works  Cool
Reply
#17
I did the same (rename gspdctl@.service) and rebooted but now pypilot won't start. This doesn't matter to me right now because I'm able to use pypilot_boatimu for the data I need, but I thought I would report the error here.

autopilot start 203.38940278
world magnetic model not available
imu process 1093
nmea process 1097
listening on port 20220 for nmea connections
made imu process realtime
Using settings file RTIMULib.ini
Settings file RTIMULib.ini loaded
Detected ICM20948 at option address
Using fusion algorithm Kalman STATE4
IMU Name: ICM-20948
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
loading servo calibration /home/wjquigs/.pypilot/servocalibration
WARNING: using default servo calibration!!
gps process 1103
Available Pilots: ['basic', 'absolute']
pypilotServer process 1106
pypilotinit complete 203.601066498
load file /home/wjquigs/.pypilot/pypilot.conf
store_file /home/wjquigs/.pypilot/pypilot.conf.bak 203.618 False
server setup has 6 pipes
serialprobe removing gps device /dev/serial/by-id/usb-u-blox_AG_-_www.u-blox.com_u-blox_7_-_GPS_GNSS_Receiver-if00
zeroconf addresses ['192.168.86.26', '127.0.0.1'] 2
signalk zeroconf service add opencpn._http._tcp.local. _http._tcp.local.
ICM-20948 init complete
gps filter process 1105
imu rate set to rate 20
IMU all sensor axes verified
setting initial gyro bias [0.51, 0.27, -0.6]
signalk zeroconf service add Brother HL-L2370DW series._http._tcp.local. _http._tcp.local.
gpsd connected
GPSD devices []
calibration loaded, starting 1091
server/client is running too _slowly_ 0.079926496000013
signalk process 1100
signalkread token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXZpY2UiOiI3ZjhiYjM3YS0yMjVkLTQxMGItYmJjMC01M2ZkNDgxZTlmNGIiLCJpYXQiOjE3MTExMjczMTB9.ueM0YTOkOKZnNGAwR4LFp8Ft_zVQoNAxuvdgz65lX28
signalk server found 127.0.0.1:3000
signalk found ws://127.0.0.1:3000/signalk/v1/stream?subscribe=none
signalk connected to ws://127.0.0.1:3000/signalk/v1/stream?subscribe=none
Traceback (most recent call last):
File "/usr/local/bin/pypilot", line 33, in <module>
sys.exit(load_entry_point('pypilot==0.51', 'console_scripts', 'pypilot')())
File "/usr/local/lib/python3.9/dist-packages/pypilot/autopilot.py", line 519, in main
ap.iteration()
File "/usr/local/lib/python3.9/dist-packages/pypilot/autopilot.py", line 360, in iteration
self.sensors.poll()
File "/usr/local/lib/python3.9/dist-packages/pypilot/sensors.py", line 391, in poll
self.signalk.poll()
File "/usr/local/lib/python3.9/dist-packages/pypilot/signalk.py", line 327, in poll
self.sensors.write(sensor, data, 'signalk')
File "/usr/local/lib/python3.9/dist-packages/pypilot/sensors.py", line 418, in write
self.sensors[sensor].write(data, source)
File "/usr/local/lib/python3.9/dist-packages/pypilot/sensors.py", line 45, in write
if not self.update(data):
File "/usr/local/lib/python3.9/dist-packages/pypilot/sensors.py", line 219, in update
self.speed.set(data['speed'])
KeyError: 'speed'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python3.9/multiprocessing/popen_fork.py", line 27, in poll
pid, sts = os.waitpid(self.pid, flag)
File "/usr/local/lib/python3.9/dist-packages/pypilot/autopilot.py", line 193, in cleanup
raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
Reply
#18
(2024-03-28, 04:47 PM)barnaclebill22 Wrote: gpsd connected
GPSD devices []

Looks like it's still running though..
You also need to turn it off & disable 2 services >
sudo systemctl stop gpsd
sudo systemctl stop gpsd.socket
sudo systemctl disable  gpsd
sudo systemctl disable  gpsd.socket

GPSD with ne devices might be why it crashed, dunno, worth a try running those & giving it another go. 

On a plus I had pypilot running for real today, nice sail along the bottom of Gran Canaria to hide from some easterly winds in another anchorage - worked great! For so many years I've just had an aries windvane so this is a whole new world!!  Cool Cool Cool
Calibration still not 100% but it seemed to work holding a compass course & wind. What a luxury having the boat point to just off the wind the get the main up. Full marks Sean, what a useful piece of software you've given the world  Big Grin

Think I might need to mount it a bit further back, not quite enough rudder travel to cope with weather helm in the gusts.

[Image: JQFY3N8.jpg]

[Image: yOoczNu.jpg]
Reply
#19
Yes, strange that pypilot says "gpsd connected", because ps -ax shows no gps/d processes running.
Also, it looks like pypilot_boatimu does NOT actually report to SignalK. The messages I was seeing were from when pypilot initialized, before it crashed. Any idea what I can do about KeyError: 'speed'?
Reply
#20
(2024-03-29, 05:12 AM)barnaclebill22 Wrote: Yes, strange that pypilot says "gpsd connected", because ps -ax shows no gps/d processes running.
Also, it looks like pypilot_boatimu does NOT actually report to SignalK. The messages I was seeing were from when pypilot initialized, before it crashed. Any idea what I can do about KeyError: 'speed'?

Speed error might be GPSD  connected, it's looking for speed from GPSD which isn't connected to a GPS. 
From post #16 " Been running stable since then but a bit of a messy hack, "

You still need to run >
Code:
You also need to turn it off & disable 2 services >
sudo systemctl stop gpsd
sudo systemctl stop gpsd.socket
sudo systemctl disable  gpsd
sudo systemctl disable  gpsd.socket

Not a good long term solution though, it was a quick fix to get it running when I couldn't figure out how to disable gspdctl@.service.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)