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
enabling pypilot HAT service
#11
i am really sorry guys... i am having medical problems i am so out of touch. i have had good success with the code and merged to master but without testing every configuration. i should have pushed to beta branch for next time.

i tried to push a fix to the firmware issue
Reply
#12
I'm sorry to read that, I hope you recover soon.
Reply
#13
Hi, I have exactly the same problem. Fried my Pi4 by connecting it directly to 12vDc (oops). Downloaded the latest OpenCPN image into a new Pi4 and then updated Pypilot.  There was no hat.conf file in home/pi/.pypilot.  I copied in an old hat.conf but got the same error messages when I run pypilot_hat. So I cannot use the buttons I have wired to GPIO (I do not have a HAT fitted).  Is it possible to just run the GPIO and web interface on 33333?  Does anyone have a hat.conf file that works with the latest pypilot version?
Cheers
David
Reply
#14
I have tried everything I can think of (including reloading pypilot from github and from OpenCPN) but cannot get pypilot_hat to run either directly or as a service. I tried with no hat.conf and tried with a hat.conf file I copied from the forum:

{"host":"localhost","actions":{"auto":[],"menu":[],"port1":[],"starboard1":[],"select":[],"port10":[],"starboard10":[],"tack":[],"dodge_port":[],"dodge_starboard":[],"engage":[],"disengage":[],"1":[],"-1":[],"2":[],"-2":[],"5":[],"-5":[],"10":[],"-10":[],"compassmode":[],"gpsmode":[],"windmode":[],"truewindmode":[],"center":[],"tackport":[],"tackstarboard":[],"none":[],"pilot_absolute":[],"pilot_basic":[]},"pi.ir":true,"arduino.ir":false,"arduino.nmea.in":false,"arduino.nmea.out":false,"arduino.nmea.baud":4800,"lcd":{},"hat":{"lcd":{"driver":"default","port":"\/dev\/spidev0.0"},"lirc":"gpio4"}}

But I just get:

pi@openplotter:~/.pypilot $ sudo pypilot_hat
hat start 9252.581509633
have gpio for raspberry pi
hat import done 9252.631372467
loading config file: /root/.pypilot/hat.conf
config failed: [Errno 2] No such file or directory: '/root/.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'

Any help would be much appreciated!

I also ran pypilot_hat without the sudo and got:

pi@openplotter:~/.pypilot $ pypilot_hat
hat start 9607.944609552
have gpio for raspberry pi
hat import done 9607.997461213
loading config file: /home/pi/.pypilot/hat.conf
config failed: Expected object or value
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'
Reply
#15
Good news: I managed to get it working! I disabled the lines that were causing the error above in hat.py at line 502

# if self.client and not 'modes' in self.config:
# values = self.client.get_values()
# if 'ap.mode' in values:
# self.config['modes'] = values['ap.mode']['choices']

This allowed hat to run and generate a default hat.conf:

{"host":"localhost","actions":{"pilot basic":[],"pilot absolute":[]},"arduino.adc_channels":[],"pi.ir":true,"arduino.ir":false,"arduino.nmea.in":false,"arduino.nmea.out":false,"arduino.nmea.baud":4800,"lcd":{},"hat":{"lcd":{"driver":"default","port":"\/dev\/spidev0.0"},"lirc":"gpio4"},"modes":["compass","gps","nav","wind","true wind"]}

I then re-instated the original hat.py and enabled pypilot_hat as a service. All now working OK with web page on 33333 so I can set up the gpio push buttons.

:-)
Reply
#16
Thanks for reporting this. I have corrected the code and will test and push it soon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)