snipsco / snips-issues

Feel free to share your bugs with us.
14 stars 5 forks source link

Cannot load JSON Respeaker file in led_animation_1.6.3 #163

Closed Hermesfrank closed 5 years ago

Hermesfrank commented 5 years ago

I have been admonished once prior for using this issue reporting mode, but I have described this in the Forum and have had no response, so please bear with me as I have researched all the dos, Forum(s), have reinstalled, have total restarts from RPi install, and explored the files on git...

What's the issue? A clear and concise description of what the bug is. Also please provide an estimation of its frequency (always, frequently, from time to time, rare)

I am using the generic Relay&Temp&Humidity app...I have an RPi running Raspbian Stretch (not lite) with A SEEED 2-mic hat...my LED_animation does not run, apparently because it cannot load the respective JSON file:

pi@raspberrypi:~ $ snips-skill-server -vvv
[09:45:16.635987] DEBUG:snips_common_cli::cli: conf lookup: snips-skill-server.skill_dir -> Ok(None)
[09:45:16.644948] DEBUG:snips_common_cli::cli: conf lookup: snips-common.skill_dir -> Ok(None)
[09:45:16.645069] DEBUG:snips_common_cli::cli: conf lookup: snips-skill-server.skills_root_dir -> Ok(None)
[09:45:16.645155] DEBUG:snips_common_cli::cli: conf lookup: snips-common.skills_root_dir -> Ok(None)
[09:45:16.646922] INFO :snips_skill_server_lib::runner: searching dir for actions: /var/lib/snips/skills/snips-skill-respeaker
[09:45:16.648017] INFO :snips_skill_server_lib::runner: found action "/var/lib/snips/skills/snips-skill-respeaker/action-led_animation_1.6.3"
[09:45:16.648251] INFO :snips_skill_server_lib::runner: searching dir for actions: /var/lib/snips/skills/snips-app-voicekit
[09:45:16.648821] INFO :snips_skill_server_lib::runner: found action "/var/lib/snips/skills/snips-app-voicekit/action-app_voicekit.py"
[09:45:16.653030] DEBUG:snips_skill_server_lib::runner: [led_animation_1.6][out] thread started
[09:45:16.654611] DEBUG:snips_skill_server_lib::runner: [led_animation_1.6][err] thread started
[09:45:16.659249] DEBUG:snips_skill_server_lib::runner: [app_voicekit][out] thread started
[09:45:16.659765] DEBUG:snips_skill_server_lib::runner: [app_voicekit][err] thread started
.json.json 61069] INFO :snips_skill_server_lib::runner: [led_animation_1.6][err] [16:45:16] [Error] [load_json_file] Can not load ./hardware_specs/./hardware_specs/respeaker_2_mic_hat
[09:45:17.661447] INFO :snips_skill_server_lib::runner: [led_animation_1.6][out] [16:45:16] [Info] [reset_power_pin] Mode has no power pin
[09:45:17.661608] INFO :snips_skill_server_lib::runner: [led_animation_1.6][out] [16:45:16] [Info] [terminate_mqtt_client] Disconnecting mqtt
[09:45:17.661673] INFO :snips_skill_server_lib::runner: [led_animation_1.6][out] [Error] can't send spi message
[09:45:17.662687] DEBUG:snips_skill_server_lib::runner: [led_animation_1.6][err] thread stopped
[09:45:17.662876] DEBUG:snips_skill_server_lib::runner: [led_animation_1.6][out] thread stopped
[09:45:17.710384] WARN :snips_skill_server_lib::handler::nosandbox: child led_animation_1.6 has stopped with status `exit code: 1`
[09:45:17.710630] INFO :snips_skill_server_lib::runner            : restarting action led_animation_1.6 (restart_fails: 0)
[09:45:17.714679] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][err] thread started
[09:45:17.714679] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][out] thread started
.json.json 21536] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][err] [16:45:17] [Error] [load_json_file] Can not load ./hardware_specs/./hardware_specs/respeaker_2_mic_hat
[09:45:18.721865] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][out] [16:45:17] [Info] [reset_power_pin] Mode has no power pin
[09:45:18.722031] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][out] [16:45:17] [Info] [terminate_mqtt_client] Disconnecting mqtt
[09:45:18.722103] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][out] [Error] can't send spi message
[09:45:18.723304] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][err] thread stopped
[09:45:18.723304] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][out] thread stopped
[09:45:18.767022] WARN :snips_skill_server_lib::handler::nosandbox: child led_animation_1.6 has stopped with status `exit code: 1`
[09:45:18.767296] INFO :snips_skill_server_lib::runner            : restarting action led_animation_1.6 (restart_fails: 1)
[09:45:18.771494] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][err] thread started
[09:45:18.771466] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][out] thread started
.json.json 79119] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][err] [16:45:18] [Error] [load_json_file] Can not load ./hardware_specs/./hardware_specs/respeaker_2_mic_hat
[09:45:19.779432] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][out] [16:45:18] [Info] [reset_power_pin] Mode has no power pin
[09:45:19.779576] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][out] [16:45:18] [Info] [terminate_mqtt_client] Disconnecting mqtt
[09:45:19.779639] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][out] [Error] can't send spi message
[09:45:19.780604] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][out] thread stopped
[09:45:19.780605] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][err] thread stopped
[09:45:19.823848] WARN :snips_skill_server_lib::handler::nosandbox: child led_animation_1.6 has stopped with status `exit code: 1`
[09:45:19.824096] INFO :snips_skill_server_lib::runner            : restarting action led_animation_1.6 (restart_fails: 2)
[09:45:19.828813] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][err] thread started
[09:45:19.828780] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][out] thread started
.json.json 36388] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][err] [16:45:19] [Error] [load_json_file] Can not load ./hardware_specs/./hardware_specs/respeaker_2_mic_hat
[09:45:20.836720] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][out] [16:45:19] [Info] [reset_power_pin] Mode has no power pin
[09:45:20.836892] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][out] [16:45:19] [Info] [terminate_mqtt_client] Disconnecting mqtt
[09:45:20.836954] INFO :snips_skill_server_lib::runner            : [led_animation_1.6][out] [Error] can't send spi message
[09:45:20.838130] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][err] thread stopped
[09:45:20.838130] DEBUG:snips_skill_server_lib::runner            : [led_animation_1.6][out] thread stopped
[09:45:20.881080] WARN :snips_skill_server_lib::handler::nosandbox: child led_animation_1.6 has stopped with status `exit code: 1`
[09:45:20.881381] ERROR:snips_skill_server_lib::runner            : action led_animation_1.6 failed 3 times in the last 10 seconds, disabling it

This occurs every time I run the app...

It appears to me that there is some path issue, but I cannot seem to find where the specific call is made to load the file...._/hardware_specs/./hardware_specs/respeaker_2_michat

Can you please take a look at the log and see if you see something?

Thanks, Frank

cpoisson commented 5 years ago

Hi,

Yes sure, I can make an exception this time ;)

Part of this skill is written in C and compiled when you install it.

The file the binary is looking for are the hw description files of the different flavours of piHAT

a little grep in the repo pointed me to this file

The code seems to look for a relative path ./hardware_specs/%s.json and replace %s by the parameter model in the config.ini of your skill (should be model=respeaker_2_mic_hat)

So, my piece of advice are:

By the way, make sure to launch the snips-skill-server using the user _snips-skills, otherwise you could obtain some permission issues.

sudo -u _snips-skills snips-skill-server -v

I'm closing this one, see you on the forum.

Hermesfrank commented 5 years ago

@cpoisson Thanks le pote!

I appreciate your insight - looks like both of my recent issues relate to permissions, so I will bone-up a bit there (not yet a Linux guy) and hopefully figure out a resolution...

I checked the config.ini file and the "model=" is correct (2-mic hat)...I am fairly familiar with C and had already followed the path you cited to the _loadhw.c file, and so then looked at the config.ini file to confirm, but checked again just now to be sure...so, it must be a permission issue as you suggest...I will follow this lead...

Curious though: it appears to me that during the snips install, and subsequent "sam setup audio" section, that if I state that I am using a Respeaker device, that Sam then goes ahead and installs the Respeaker audio scripts, AND, sets up an automatic install of the _ledanimation app that then runs without prompting - i.e., I do not install it as a separate app when I use Sam to install any assistant - even if I delete the snips-skill-respeaker folder from the /var/lib/snips/skills directory, it automatically re-installs when I load a new assistant - my point is, that if there are permissions to deal with that I am missing to run that JSON file, the snips/Sam install should take care of it/them just as it does when installing the app and assistants code - right??

Anyway, I do really appreciate the clues/solutions help...Frank

Hermesfrank commented 5 years ago

Hello @cpoisson

OK, so here's my latest on this issue...

I uninstalled the snips-skill-respeaker folder from the /var/lib/snips/skills directory and did a Sam-based re-install - no change, it still could not read the JSON file...

I uninstalled the folder again and did a manual install per the site you referenced using this:

Firstly, add your current user to the snips-skills-admin group: sudo usermod -a -G snips-skills-admin $USER Secondly, add _snips-skills user to the spi, gpio, audio groups: _sudo usermod -a -G spi,gpio,audio snips-skills Finally, clone the repository and manually run setup.sh: git clone https://github.com/snipsco/snips-skill-respeaker.git cp -r snips-skill-respeaker /var/lib/snips/skills/ cd /var/lib/snips/skills/snips-skill-respeaker ./setup.sh

After the manual install, whenever I went to re-install the assistant, I got the attached in the Node.js window on my PC re the inability to create the virtual envirnment... Node js Log 2019-07-05 01

and, when I re-booted the RPi, I got wild LEDs on the hat and the trigger-word and intent recognition phases did not work for snips...I did not get the can't read the JSON file error when running the snips-skill-server...

So, I again re-installed the LED app via Sam and got back to where I was originally, i.e., can't read the JSON file, but my assistant runs OK...

So, it seems that again I have some sort of user/permission issue but not sure what's going on - do these new clues offer you any suggestion? Maybe I should re-install snips? I hate to go back to a re-install of ROS because I always wind up fighting issues with getting the Respeaker hat to work properly...

Thoughts?

Regards, Frank [BTW, I retract what I said earlier about a forced installation by snips of the led_animation app - that was happening because I never removed it from the directory on the RPi...]

Hermesfrank commented 5 years ago

@cpoisson - Howdy!

OK, so I started from scratch and used a new RPi 3 A+ and a new image of Raspbian Stretch...

Installed the OS first, then the 2-mic-hat and both were working...

Then installed snips and allowed the snips install to also install the 2-mic-hat...when it finished, it appeared that the hat was working - the LEDs initialized and it was "breathing" at idle...

I then installed my app...all looked like it was going fine on the PC/ssh side, but then the LEDs quit...I re-booted...the app worked but I was back to the point when running the snips-skill-server, I got the "...can't load the JSON file..." status...

I checked the permissions on the respeaker directories and files and they are set to Anyone...

I do not think it is my app that breaks things - I guess I could do all over again and see what happens when I install the prime Relay&Temp&Humidity app, or maybe I should try installing the upgraded snips version of that app (Voice Interaction Dev Kit (EN)) and see if maybe that's why you guys revised the original app from SEEED - can you check with whoever did that and ask them if anything going on here makes sense?

Thanks, Frank