Animated Eyes Bonnet for Raspberry Pi - Restart over SSH

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
guacharo
 
Posts: 4
Joined: Mon Sep 13, 2021 11:37 pm

Animated Eyes Bonnet for Raspberry Pi - Restart over SSH

Post by guacharo »

Hello,

I was successfully able to configure the Animated Eyes Bonnet by following the guide here:
https://learn.adafruit.com/animated-sna ... pberry-pi/

In the guide the way its suggested to switch the graphics is to edit /boot/Pi_Eyes/eyes.py and reboot.

I would like to be able to stop the existing eye configuration and start a new one via SSH automatically.

I have 2 simple helper scripts that attempt to kill everything by hand and start a new process (By reusing the last section currently in /etc/rc.local.

cat start_eyes.sh
#!/bin/bash
sudo pkill -f eyes.py
sudo pkill -f dragon_eyes.py
sudo killall fbx2
sudo /boot/Pi_Eyes/fbx2 -i &
cd /boot/Pi_Eyes
sudo python3 eyes.py --radius 240 &
exit 0

When I launch this script, I get the following error.
Traceback (most recent call last):
File "eyes.py", line 223, in <module>
mykeys = pi3d.Keyboard() # For capturing key presses
File "/usr/local/lib/python3.7/dist-packages/pi3d/Keyboard.py", line 257, in Keyboard
return CursesKeyboard() if use_curses else SysKeyboard()
File "/usr/local/lib/python3.7/dist-packages/pi3d/Keyboard.py", line 19, in __init__
curses.cbreak()
_curses.error: cbreak() returned ERR

Is there a recommended way to start a new instance of eyes.py and fbx2 over SSH, without having to do a full restart?

Thanks in advance!

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Animated Eyes Bonnet for Raspberry Pi - Restart over SSH

Post by mikeysklar »

I would try to comment out the mykeys lines (there are three) in eyes.py which might be enough to stop the keyboard requirement.

https://github.com/adafruit/Pi_Eyes/blob/master/eyes.py

It looks like you have the right idea of killing off and restarting processes. I don't see a more elegant solution.

User avatar
guacharo
 
Posts: 4
Joined: Mon Sep 13, 2021 11:37 pm

Re: Animated Eyes Bonnet for Raspberry Pi - Restart over SSH

Post by guacharo »

Hello,

I commented out the following lines first:

#mykeys = pi3d.Keyboard() # For capturing key presses
#k = mykeys.read()
#mykeys.close()

But the code complained about the
NameError: name 'k' is not defined

So I commented the rest of the if statement as well:

#if k==27:
#mykeys.close()
#DISPLAY.stop()
#exit(0)

I am now able to switch eye configs via my scripts.

Each time after I run the helper script the only error that pops up is:
glGetError 0x500

But the graphics switch as expected.

Thank you for the assistance, and have a great day!

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Animated Eyes Bonnet for Raspberry Pi - Restart over SSH

Post by mikeysklar »

Cool I'm glad that worked so now you can run the eyes headless (ha ha).

You might be able to get rid of that last error message "glGetError 0x500".

Look for something like this in the scripts that are running and comment it out,

Code: Select all

glEnable(GL_TEXTURE_2D)

User avatar
guacharo
 
Posts: 4
Joined: Mon Sep 13, 2021 11:37 pm

Re: Animated Eyes Bonnet for Raspberry Pi - Restart over SSH

Post by guacharo »

Hi,

Thanks for the assistance! The eyes are indeed headless. Regarding that last error, I don't see anything referencing glEnable

$ grep "glEnable(GL_TEXTURE_2D)" *.py
$ grep "glEnable" *.py

Not a huge issue. Ive gotten around it by redirecting output to /dev/null.

$ sudo ./start_dragon_eyes.sh > /dev/null 2>&1
$ sudo ./start_eyes.sh > /dev/null 2>&1

Ill make sure to post a followup with a video once this project is complete.

User avatar
guacharo
 
Posts: 4
Joined: Mon Sep 13, 2021 11:37 pm

Re: Animated Eyes Bonnet for Raspberry Pi - Restart over SSH

Post by guacharo »

Hello,

As promised, here is a video showing the eyes switching every 10 seonds in a loop.

https://drive.google.com/file/d/1yhBOgO ... p=drivesdk

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Animated Eyes Bonnet for Raspberry Pi - Restart over SSH

Post by mikeysklar »

Nicely done. Thanks for sharing the video. The eyes look great in the skull.

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”