Programming Mark1 directly from your computer (no Github needed)

Hi folks,

After a year or so I have unpacked my Mark1 again in an effort to automate my new house and learn some extra programming in the process :slight_smile: My goal is to set up the Mark1 and be able to program it quickly without using Github, since I don’t want to keep pushing and pulling stuff in order to test the functionality of it (I intend to use a lot of the hardware features of the Mark1 so testing on my laptop is in many cases not an option). I am not a programming wiz by any means so right from the start I found myself running into some problems.

The Mark1 itself is running fine, I installed the latest image for it and updated the software without any problems. To reach the files on the Mark1 I tried using the SSH-extension of VSCode (which I’m using as my default programming program) to connect to it, but it seems like Jessie is to old to support it (I can SSH into it using the command line though). As an alternative I managed to mount the raspberry pi in my Linux WSL that I run on Windows so I can see and edit the code directly from there. The problem I’m currently facing with this approach is that VScode does not seem to recognize the Mycroft libraries and I haven’t been able to find a lot of documentation about it online, so I’m kind of in the dark about all the functionalities the Mycroft library provides.

To solve my problem I would like to tap into your knowledge and ask you the following questions:

  • Do you think this is the right approach for me, or is there another approach that I didn’t think of to achieve the quick programming/debugging/testing I would like to have?
  • If so, is there anyone out there who might be able to help me with correctly using the Mycroft libraries in VSCode (or point me to a place where I can find the complete documentation)?

Thanks in advance, looking forward to starting my project!

As an alternative to VSCode you can try the Theia-IDE skill

1 Like

Thank you for your reply, that looks great! Unfortunately the page states that Mark1 is no longer supported in that skill :frowning:

Sorry, its been a while that I used the skill on my Mark-I and didn’t notice this change.

Don’t know what resources you have available, but for Mycroft development I currently use a Ubuntu-18.04 VM running in VirtualBox (on MacOS) - maybe that is an option for you?

1 Like

I’m currently also using Ubuntu 18.04 on a VM. My main problem is that I’m having trouble accessing the code on my Mark1 for code-completion. This is not necessary for the execution itself since that still happens on the Mark1 but it does allow me to check how I should program it. An alternative would be to have proper documentation somewhere online but I wasn’t able to find that as well. An example of what I’m trying to do is to change the eye-color of my Mark1 when it goes into sleep-mode. For this I need to know how to set it (by using some functionality of mycroft.enclosure), however I can’t seem to find which function/property to use.

How do you do your development exactly? Do you have a program (like VSCode) that uses autocompletion or do you have another way to check how to call upon mycroft’s functionalities?

In my Ubuntu-VM I use VSCode with a local Mycroft instance (installed from the GitHub repo). This setup won’t work when developing specifically for the Mark-I enclosure of course.

As the Theia-IDE worked on Mark-I in a previous version you might want to check out an older commit of the repository. Maybe the author @andlo can help you out identifying the exact commit that will work?

1 Like

If it just some simple coding that you want to edit on your windows pc but execute on the Mark1, this is what I use;

https://blog.sleeplessbeastie.eu/2015/07/27/how-to-edit-files-using-notepad-plus-plus-over-ssh-file-transfer-protocol/

2 Likes

Regarding your quest for documentation, here are two links that should be helpful, both found on the mycroft.ai website with some digging:
https://mycroft-ai.gitbook.io/docs/skill-development/displaying-information/mark-1-display
https://mycroft-core.readthedocs.io/en/master/
But I hope Mr. @gez-mycroft will comment and correct or supplement my suggestions.

Regarding your development set up, I think I share your desire for a very direct and streamlined experience. I have made certain concessions in my approach, but I really enjoy it. Here is a quick description:

enable ssh on a mark1. Then use whatever native convenient ssh client you have to get a shell session as user “pi” (and if your OS supports mdns, you can just use “mark1.local” as hostname). Change user to mycroft (perhaps sudo su - mycroft) and now you can quickly and easily cd /opt/mycroft/skills and user msk to create a new skill and just edit your skills hot and live right there! Mycroft will automatically reload the skill every time you save, and you can almost immediately test it. So fast and efficient. Although, be cautious, you could also accidentally damage a core skill and make it hard to recover. In my case I edit with vim, there are other console/tty based editors but I don’t know if you could replace all the features of vscode. Git is immediately available if and when you want it, but it is unnecessary for the edit-test-repeat work cycle.
Now launch a second ssh client session logging in with pi again, but immediately launch mycroft-cli-client where you will see debug and logs scrolling by so you can quickly and easily get more details on result of your skill code edits.
This works great for me, but there may be a deal breaker in there somewhere for you.

1 Like

I’ve never done much tinkering on the Mark 1 enclosure code but the easiest way to change the eye color would be to use this function in the Mark 1 Skill

We’re still supporting the Mark 1 and updating it with the latest from Mycroft but to be honest it’s not going to get a lot of additional dev time. We are a small team and need to stay focused on the Mark II.