Mycroft-gui on my Mark-II - first light

Hi,
at the moment this is mainly software building instructions and they are posted on my trac wiki (see the OP) and I constantly update them. As soon as there would be code changes I will probably fork the mycroft-gui project and add the building inbstructions there.
Have fun - Guhl

1 Like

This is so cool!

You’re very welcome to contribute back any build documentation to the mycroft-gui project.

Also I might point out the https://github.com/mycroftai/mycroft-devices repo with the debos build recipe for our WIP image. This is currently arm64 architecture and will only work with the Pi4. We’ll likely be switching back to the armhf to get support for some hardware acceleration.

Instead of building/using the entire plasma stack you can look at deploying mycroft-gui on top of plasma-nano https://github.com/KDE/plasma-nano also adding specific shell configuration https://github.com/MycroftAI/mycroft-gui-mark-2

Scripts from these should also help if building with above:


https://github.com/MycroftAI/mycroft-devices/tree/master/overlays/mark2/etc/xdg // add to your image at same paths
https://github.com/MycroftAI/mycroft-devices/tree/master/scripts //to run at time of build

The skill that controls volume and gui enclosure: https://github.com/MycroftAI/skill-mark-2

If building on top of picroft it would be easier to upgrade picroft buster to debian testing so you can use system qt packages without having to rebuild qt. http://www.linuxandubuntu.com/home/upgrading-debian-from-stable-to-testing

@AIIX Am I correct in understanding that; “mycroft-gui” is what you currently use on bigscreen and therefor for normal landscape screens? While “mycroft-gui-mark-2” is the portrait versioni what is used on the Mark-2? Both doing the same / being the same, the GUI for Mycroft?

I am also looking into implementing the GUI within MycroftOS. What would you recommend for such a “normal” OS that just utilizes a widescreen landscape HDMI screen?

Mycroft GUI consist of two parts one an application that houses the mycroft skillview and second the library which provides the skillview. Both are part of the mycroft-gui repository.

The mark-2 prototype runs plasma-nano with the above mycroft-gui-mark-2 shell package that embeds the skillview directly into the shell so it runs as part of the shell and not inside the mycroft-gui application.

To better explain the “mycroft-gui-mark-2” package is a shell package for plasma nano that embeds the mycroft skillview onto the shell itself and also provides configuration to set the orientation, it provides support for a virtual keyboard, and provides some basic GUI interface for settings like wifi. All of this is provided in this package as plasma-nano is a much reduced package with lesser dependencies compared to what plasmashell provides on the desktop, The orientation is basically of the skillview and the shell, it shouldn’t be needed on a normal screen unless someone wants to build some custom enclosure with a rotated screen.

There really isn’t a direct concept of landscape/portrait mode since the skillview simply can utilize the whole screen if embed in a shell or whatever window like the GUI application, the skills should simply adjust to the screen/resolution, (it largely depends on skill devs to create response designs with qml, all of the current skills that implement a GUI are responsive so they should have no issues being displayed in any form factor / orientation )

Plasma Bigscreen is also based on plasma-nano but we use the mycroft-gui application to display the voice apps/skills in a window rather than embedding the skillview into the shell itself as bigscreen has a larger usecase of being able to use multiple applications.

1 Like

Thanks for the quick response. Much appreciated.

I think with “running directly into shell” you mean, straight onto the linux framebuffer instead of a full fledged X11/Wayland KDE desktop right?

In that case, that is exactly what I also have in mind for MycroftOS as everything runs on the framebuffer. No window manager or desktop environment what so ever. So if that is the case; mycroft-gui-mark-2 it is then!

This intrigues me. So you basically the whole “wifi setup wizard” stuff is not needed anymore if you use this GUI? If I remember correctly, plasma uses NetworkManager for it’s network setup right? Or does it talk to and / or configure the wpa_supplicant stuff straight away?

Sorry for bugging you, but now you are here… :smiley:

By the shell I mean plasmashell or the reduced version of it plasma-nano, it still requires X/Wayland. Window management is optional but for something like virtualkeyboard it could be required.

This as well uses network manager but the WiFi setup GUI has been added to the gui containment on the mycroft-gui-mark-2 package and doesn’t require the systemsettings or plasma network manager applet which would normally be found on desktop.

1 Like

Perfect!

Enough information to start cracking (although it might take a while before I can start timewise).

Will report back if I run into problems.

1 Like

Hi AIIX,

thanks for the response and all these very important insights.
I will have a thorough look at all this and rebuild my software stack based on that.
I’ll probably keep keep my self build QT/KDE but the plasma-nano is something that I was not aware of.

Have - fun Guhl

@guhl While waiting for my compile run to compile the KF5 framework for my project, I was reading through your sound section on your wiki.

I see you are installing some python packages, create a python script and using systemd to run that script, just to set the hardware volume to max 30 and let pulseaudio control the 0 - 30 section by pushing all alsa to pulseaudio similar as I do in my project.

Looking at the skill-mark-2 repo, you can just set that volume by a linux command;
https://github.com/MycroftAI/skill-mark-2/blob/master/init.py#L266

So you do not need that whole python script and associated libraries if you use this command;

i2cset -y 1 0x4b 30

If you combine this with a udev rule that runs a command as soon as it sees the usb respeaker device, you do not need systemd as well. Just create a “10-usb-sound.rules” within “/etc/udev/rules.d” with the following content;

SUBSYSTEM=="usb", ATTR{idVendor}=="2886", ATTR{idProduct}=="0018", RUN+="i2cset -y 1 0x4b 30"

I don’t have a respeaker device so can’t test it for you, but if you could please be so kind to test and report back to me. We both benefit from it as it would allow me to support that device within my project without the whole hardware set/get stuff that the Mycroft dev’s are doing within that mark 2 skill.

EDIT: Oh, hang on. that hardware volume is for the Adafruit. Oh well, the principle is the same. You just need to change the SUBSYSTEM and the ATTR vendor/product variables to the adafruit ones. Will see if I can dig them up from google, otherwise just dump that command straight into your systemd service :wink:

@j1nx thanks for the tip with i2cset I tested this and it works.

But I do not see how the udev rule should be set up / working on Subsystem USB.
The Adafruit is not connected to USB but only to I2C .
But what I did is:
Create a /etc/udev/rules.d/10-i2c-sound.rules with the content:

SUBSYSTEM==“i2c”, ATTR{name}==“bcm2835 I2C adapter”, RUN+=“/usr/sbin/i2cset -y 1 0x4b 30”

This is kind of blindly executing the command as soon as the I2C controller is seen but I do not see how I could use udev to checked if the AdaFruit is really there. The only thing I can get by running:

udevadm info -a -p /sys/bus/i2c/devices/i2c-1

is

looking at device ‘/devices/platform/soc/3f804000.i2c/i2c-1’:
KERNEL==“i2c-1”
SUBSYSTEM==“i2c”
DRIVER==“”
ATTR{name}==“bcm2835 I2C adapter”
looking at parent device ‘/devices/platform/soc/3f804000.i2c’:
KERNELS==“3f804000.i2c”
SUBSYSTEMS==“platform”
DRIVERS==“i2c-bcm2835”
ATTRS{driver_override}==“(null)”
looking at parent device ‘/devices/platform/soc’:
KERNELS==“soc”
SUBSYSTEMS==“platform”
DRIVERS==“”
ATTRS{driver_override}==“(null)”
looking at parent device ‘/devices/platform’:
KERNELS==“platform”
SUBSYSTEMS==“”
DRIVERS==“”

but the good think is: I works! So I think this is definitely a better solution as it kicks in a lot earlier than the systemd user service and the cracking sounds are not really disturbing during boot.

I will add that to the trac wiki

btw: trying to build the KDE plasma-workspace is driving my crazy. I did successfully build plasma-nano but I think I actually need to build plasma-workspace to start a plasma-shell.
But to be totally true I have very little knowledge of KDE. Maybe we find a way to work together on that before I loose my nerves.
I am not really sure why it is necessary to run this on plasma in the first place. In Sailfish OS where also everything is QML, Wayland and QT based we don’t use KDE as far as I see.

Thanks and have fun - Guhl

Yeah, sorry about the USB confusion I wasn’t reading properly, hence my edit, but guess was still unclear. :wink:

Anyhow…

Nice that you at least can run the command when it sees and loads the broadcom I2C adaptor. That is fine for you as you know for sure your ADA is there, but might be a bit more problematic for my supporting it in MycroftOS like that. If something else is connected to the I2S I expect monkey business.

Perhaps something is shown in “dmesg” as that is low level kernel stuff. Just run the command; dmesg and scroll through the message in search for I2S stuff. Perhaps you can get the IdVendor and IdProduct from there. If there is any offcourse…

About Plasma-Workspace: Reading through the code, it is only needed for the config headers and is used for Reboot and Shutdown code. So you can enable halt or reboot the device from the GUI.

If you strip that out and just use some enclosure Python code to handle the reboot and halt voice command, I guess you don’t need it.

Have a look at this commit;

Am posting my complete step by step guide to building a custom image I experimented with for the raspberry pi4 using ubuntu 18.04 minimal server and KDE Neon as base which includes all the required development packages to build Mycroft-GUI, Plasma-Nano, Mycroft-Gui-Mark-2 and other dependencies all from master branch without having to rebuild Qt or any other major KDE framework, or having to modify any repository . Link To Step By Step Guide: https://github.com/AIIX/Documentation/blob/master/Custom-RPI4-MycroftImage.md

This should also help anyone who’s building a custom OS/Image for the RPI4 to get an overview of the structure of the image and config files required.

5 Likes

@AIIX
Wow, this is super helpful!

If I would have had this earlier it would have saved me a probably a week of time but I am very thankful that you did not post it earlier because it also would have cost me a week of learning and experience!

Thanks for your support - have fun - Guhl

2 Likes

Hi,

I know, the pictures are not good, but this is the mycroft-gui running on plasma-nano on my PI3 based mark2 build:
gui_on_plasma_1 gui_on_plasma_2

This based on the build log of @AIIX and I re-documented it here Trac-Wiki mycroft-gui-mark-2_sys This is still work in progress but I will document my progress there.

I first tried to do this with Ubuntu server 20.04 but I could by no means get the SDDM up. So I used the same 18.04 image as AIIX.

Still a lot to polish but this is a by far easier way to get the GUI up than building all QT and KDE from sources.

Thanks again @AIIX !

Have fun - Guhl

3 Likes

@guhl Looking gooooooooood!

I think I speak for more if I say; We are all awaiting the video showcase of your Mark-2 patiently :wink:

@j1nx would you have an idea how to manage screen rotation with plasma/wayland/X11?
If I do the screen rotation in config.txt as shown above the screen is rotated until SDDM kicks in but then the PI crashes (did not investigate logs yet).
Is there a standard way on how to do screen rotation in X11/xrandr,… on the PI3?
Have fun - Guhl

xrandr --rotate left
Maybe?!

No, not by hard. Digging (deep) into memory, you most likely need to readout your modeline of your screen and setup a X11 configuration files with it.

I guess, the google words could be; “linux desktop portrait mode” (or something similar)

try setting the software rotation in mycroft-gui-mark-2 file to ‘Normal’ and rebuild and install: https://github.com/MycroftAI/mycroft-gui-mark-2/blob/cb5cf4da122b0fdfa023687ab8272a15558d3ae5/lookandfeel/contents/plasmoidsetupscripts/org.kde.mycroft.mark2.js#L2 additionally it seems you are still running the mycroft gui application and not the embed skill view in plasma-nano so it wont have affect on mycroft-gui application but on the shell itself

The possible rotation config values are defined here https://github.com/MycroftAI/mycroft-gui-mark-2/blob/2e50c204cf0911c400a4c0127d7ca1a20217269c/containments/mark2/package/contents/config/main.xml