Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding docker to brain-monitor #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

titusfx
Copy link

@titusfx titusfx commented Mar 16, 2019

This is throwing an Error Width must be multiple of 2. But I'm not able to create a develop branch and a feature branch so you can test it before merge.
You need to have docker, and docker-compose in order to use those files. With a simple
docker-compose up should work this first version.

@dashersw
Copy link
Owner

I get an error called invalid ELF header when I do a docker-compose up. I think it needs further investigation. Does it work on your local machine, though?

@dashersw
Copy link
Owner

I also didn't get a Width must be multiple of 2 error 🤔

@dashersw
Copy link
Owner

OK, there are a couple of issues — you shouldn't be mounting the whole folder under /app because that will also mount any locally installed npm packages under node_modules. When I remove node_modules and stop mounting the volume, I can get to the Error: Width must be multiple of 2! part.

I don't know what the goal of this development is, though. brain-monitor requires a screen to function — it prints the brainwaves on the screen. It doesn't make much sense to run it inside a docker container.

@titusfx
Copy link
Author

titusfx commented Mar 26, 2019

The goal is to run your core lib on a docker ( not only brain-monitor), but that also implies that doesn't matter where I'm deploying it, it will deploy well. And you will never get OS problems again. For instance, your readme is for Mac OS only.

Brain-monitor sends the data to a console and you can see it inside the docker without any problem. In any case, you can mount devices on a docker. In fact, the headset will be on it as well.

About how to mount node modules, it depends. In any case, I'm trying to deploy it without errors first and then get a fine solution.

@dashersw
Copy link
Owner

dashersw commented Mar 26, 2019

The core lib is wits, and it actually works in Docker with your example. brain-monitor requires a tty that has a width, it's not simply a console.log — that's why it doesn't work and you get the error Width must be multiple of 2.

If you replace the contents of index.js with

const mind = require('wits')
mind.open()
mind.read(console.log)

you will see that it will work.

@dashersw
Copy link
Owner

Also, mounting node_modules doesn't depend on anything, it simply doesn't work. When you do an npm install on wits or any project that has wits as a dependency, it will compile native C modules. The output of the compilation will be different on Mac and Linux.

Say, you have a Mac, you clone the project, and do npm install. Later, you run docker-compose up, which, as in your example, mounts the node_modules folder. In this case, you will get an error that says Error: /app/node_modules/wits/build/Release/emotiv.node: invalid ELF header. This is because the docker image expects Linux binaries under node_modules, but because we ran npm install on Mac, the binaries are Mac-specific.

That's why you can't mount a Mac-compiled node_modules to a Linux docker image.

@titusfx
Copy link
Author

titusfx commented Mar 30, 2019

Its depends, sure that what you are saying is important, because we need to run first on the docker so the installation of npm will compile native C module. But this doesn't make any difference if you later want to install something or checkout something that you have access to. For developing purposes is think is easier for the CI.

For the gui is simple to associate. My First initative is with your core lib, and if you are saying that is working, that's great news.

In any case, for making brain monitor show a screen could be made as well. This could be one way: http://wiki.ros.org/docker/Tutorials/GUI

@dashersw
Copy link
Owner

dashersw commented Apr 7, 2019

indeed, wits is working inside Docker (provided that one can attach the USB).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants