Testing and feedback og Google AIY voicekit skill

When requesting assistance with testing out your Skill, be sure to provide the following information:

How to install SKILL NAME

msk install https://github.com/andlo/picroft-google-aiy-voicekit-skill

This skill is made for Picroft Lightning which is Picroft on Rasbian stretch and should install and initialize “out of the box”.

If you are running another installation of Mycroft and the skill isnt initialize properly, it could be that the mycroft user dont have access to the GPIO which is needed to control led and button. You then need to add the mycroft user to the gpio group with the command

sudo usermod -g gpio mycroft

How to test SKILL NAME

  • Does it install ?
  • Does ligt turn on when saying Hey Mycrof ?
  • Shortpress get him listing
  • Longpress gets hi stopping whatever he is dooing

Where feedback on SKILL NAME should be directed a

Please give feedback here or open a issue on GitHub.

2 Likes

Here are my test results for installation on Debian-Jessie-Picroft image with latest apt-get upgrades and Picroft 18.8.3:

  • Does it install ?
    required the usermod as specified above, otherwise installation was smooth

  • Does light turn on when saying Hey Mycroft ?
    Yes.

  • Shortpress get him listening
    Yes.

  • Longpress gets him stopping whatever he is dooing
    Yes.

2 Likes

I have a suggestion to make the kit more responsive. I have noticed that very quick ‘taps’ are often missed and have to be repeated 2 or 3 times in order to register. This is expected using the 100 ms polling that you are doing. I made a lame 2-line change that seems to fix this as shown below:

def initialize(self):
try:
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(LED, GPIO.OUT)
GPIO.setup(BUTTON, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.add_event_detect(BUTTON, GPIO.FALLING, bouncetime = 500)
except GPIO.error:
self.log.warning(“Can’t initialize GPIO - skill will not load”)
self.speak_dialog(“error.initialise”)
finally:
self.schedule_repeating_event(self.handle_button,
None, 0.1, ‘GoogleAIY’)
self.add_event(‘recognizer_loop:record_begin’,
self.handle_listener_started)
self.add_event(‘recognizer_loop:record_end’,
self.handle_listener_ended)

def handle_button(self, message):
    longpress_threshold = 2
    **if GPIO.event_detected(BUTTON):**
        self.log.info("GPIO.event_detected")
        pressed_time = time.time()
        while not GPIO.input(BUTTON):
            time.sleep(0.2)
        pressed_time = time.time() - pressed_time
        if pressed_time < longpress_threshold:
            self.bus.emit(Message("mycroft.mic.listen"))
        else:
            self.bus.emit(Message("mycroft.stop"))

Is there some reason why you relied on polling rather than GPIO event detect? Although my fix seems to work, I heard some oddly random vocal nonsense out of the speaker when I rebooted my AIY enclosure. Later, when I tried to reproduce it, it was gone.

1 Like

Hi @randalgay
The reason - I beleave - is that this is one of my first skills and I have learned a lot sinse. Ill ge bak to the skill soon and look at it again and having your suggestions in mind.

Great! I know the feeling since I am working on my first skill myself. I was just wondering if you had tried other methods and abandoned them due to side effects that they were causing in other parts of the system. I tried a more ambitious fix using a GPIO event handler and it did not work at all. The code seemed to be right, but the event was not firing as it should. Not worth pursuing if this works as expected.

1 Like

I have made your changes into the skill - it works great :slight_smile: Many thanks for that.

I will send update to mycroft market right away.

1 Like