OpenMarine

Full Version: enabling pypilot HAT service
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello,
I have been using Pypilot as the main electric autopilot on my 40 foot keeler for a few of years now.  It's awesome.
I've just purchased a second rPi and pypilot hat. 
I have installed the latest OpenPlotter and Pypilot software on my rPi3.
It's all going great, but I am struggling to enable the pypilot hat service.  I tick the box but the tick goes away by itself.
I have read lots of posts and threads but still can't make it work.
It's not the end of the world, i can control the autopilot using the pypilot control.  But i'd like to see numbers on the LCD and be able to use the remote.
Please help!
Josh
I have exactly the same problem. Can't figure out why. In the past the HAT would work perfectly, when I used the tinypilot software.

I use OpenPlotter 64bit – is that maybe the problem? Would the 32bit work?
i will look into it.
what if you issue

sudo service pypilot_hat start
Thanks. I chose 32 bit OpenPlotter, not for any real reason. What factors should influence that choice?
I tried issuing service pypilot_hat enable yesterday based on another thread. Will try 'start' today with fingers crossed.

Unfortunately that didn't solve it Sean.
The command 'sudo service pypilot_hat start' was accepted without error message.
But then sudo service pypilot_hat enable returned error message 'service not recognized'
Ticking the enable hat control box in pypilot app, it still vanishes off own accord and message below says
Pypilot hat detected but service not enabled.
Thanks again
Josh
did it start working when you started it from commandline?

did you try sudo systemctl enable?
Another test: enable the debugging mode in openplotter-settings, open a terminal, run "openplotter-pypilot", check Enable HAT Control and copy here any error you get in the terminal.
I just did a clean install of openplotter an pypilot and got this. Mind you, I don't have the hat hardware attached:


pi@openplotter:~ $ pypilot_hat
hat start 1277.089485117
have gpio for raspberry pi
hat import done 1277.181298514
loading config file: /home/pi/.pypilot/hat.conf
config failed: [Errno 2] No such file or directory: '/home/pi/.pypilot/hat.conf'
failed to load /proc/device-tree/hat/custom_0 : [Errno 2] No such file or directory: '/proc/device-tree/hat/custom_0'
assuming original 26 pin tinypilot with nokia5110 display
Traceback (most recent call last):
  File "/usr/local/bin/pypilot_hat", line 33, in <module>
    sys.exit(load_entry_point('pypilot==0.42', 'console_scripts', 'pypilot_hat')())
  File "/usr/local/lib/python3.9/dist-packages/pypilot/hat/hat.py", line 687, in main
    hat = Hat()
  File "/usr/local/lib/python3.9/dist-packages/pypilot/hat/hat.py", line 348, in __init__
    self.write_config()
  File "/usr/local/lib/python3.9/dist-packages/pypilot/hat/hat.py", line 502, in write_config
    if self.client and not 'modes' in self.config:
AttributeError: 'Hat' object has no attribute 'client'


The pypilot service itself is running ok.

When I copy an old hat.conf, I get this:


pi@openplotter:/media/pi/rootfs/home/pi/.pypilot $ cp hat.conf /home/pi/.pypilot/hat.conf

pi@openplotter:/media/pi/rootfs/home/pi/.pypilot $ pypilot_hat
hat start 1663.329849163
have gpio for raspberry pi
hat import done 1663.417218144
loading config file: /home/pi/.pypilot/hat.conf
failed to load /proc/device-tree/hat/custom_0 : [Errno 2] No such file or directory: '/proc/device-tree/hat/custom_0'
cannot update firmware until version is known
host localhost
lcd process on 7108
lcd driver default False False 1663.452981103
hat init complete 1663.46100852
7109 (process ID) old priority 0, new priority 19
failed to load lirc No module named 'lirc'
no lirc available No module named 'pylirc'
web failed to run process: cannot import name 'Markup' from 'flask' (/usr/local/lib/python3.9/dist-packages/flask/__init__.py)
7109 (process ID) old priority 19, new priority 19


Subsequently installing pypilot from git gives me the same message "cannot import name 'Markup' from 'flask'" so I am inclined to think the issue here lies with the master branch.
I do not have a pypilot hat either. Maybe I should buy one from Sean when he gets back to business.
I'd be happy to maintain a 'release' fork from the master, and aid in the testing process. Anybody has a spare hat around - I'll be happy to buy it off of you. Sean, what do you think?
(2023-10-02, 11:53 PM)joshkemp@xtra.co.nz Wrote: [ -> ]Hello,
I have been using Pypilot as the main electric autopilot on my 40 foot keeler for a few of years now.  It's awesome.
I've just purchased a second rPi and pypilot hat. 
I have installed the latest OpenPlotter and Pypilot software on my rPi3.
It's all going great, but I am struggling to enable the pypilot hat service.  I tick the box but the tick goes away by itself.
I have read lots of posts and threads but still can't make it work.
It's not the end of the world, i can control the autopilot using the pypilot control.  But i'd like to see numbers on the LCD and be able to use the remote.
Please help!
Josh
Hi!
I had this same problem.
Try make new directory: firmware in ~/.pypilot home directory
eg:
mkdir /home/pi/.pypilot/firmware
Pages: 1 2