Developing acquisition interface

Come here to discuss about OpenViBE in general!
Post Reply
unidesigner
Posts: 5
Joined: Wed Jul 15, 2009 12:49 pm

Developing acquisition interface

Post by unidesigner »

Hi!

First, thanks for your great software. I think it will be a truly competitor to the commercial products available.

So, here my question:
I've got my own custom made EEG and I'd like to interface it to OpenVibe, of course :)
I have to write the classes to interface with the aquisition server. But I need a little help how to get started there.
My EEG devices is USB and is visible as virtual com part, so I would need to interface the com ports. I know
the USB PID/VIP, it this is helpful. Is there any example file which I can use for this.

The protocol used is the NDS NFK256 (working with BioExplorer). Where do I have to adjust this parameters in the class?

Thanks for any help!
Stephan

Chris Veigl
Posts: 6
Joined: Wed Jul 15, 2009 10:43 pm

Re: Developing acquisition interface

Post by Chris Veigl »

Hello Stephan,

I am also in the process of writing a acquistion-driver for an EEG device, in my case
the OpenEEG hardware ModularEEG and MonolithEEG (P2 protocol version)
see http://openeeg.sourceforge.net/

I got something working with help of the developer's documentation on the openVibe site
and the tutorial slides which i found in the forum.

I recently posted my progress to the OpenEEG mailing list,
but the driver is still very basic and not part of any official openViBE SVN / distributions yet.
I hope to receive some comments / suggestions from the openVibe develpers soon.

I had some problems when building the source distribution on a recent Ubuntu,
namely with dependencies of the itpp- and ois-libraries.

I was lucky after:
sudo apt-get install automake
sudo apt-get install libtool
sudo export F77=/usr/bin/gfortran

I cound not fix one thing on the Linux side (which works on Windows):
when starting openvibe by using the recommended /scripts/linux-test,
I get an initialisation error, likely from the Ogre3d engine:

"The program 'OpenViBE-designer-dynamic' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
(Details: serial 173 error_code 2 request_code 128 minor_code 3)"

I hope Yann can shed some light on this ...
However, running the applications from /dist/bin works, but i get no 3D-functionalities
(e.g. Topographic Map). In my windows build using VS2008 express, this worked "out-of-the-box".

I connect a MonolithEEG via USB and use the auto-generated /dev/ttyUSB0 device (virtual COM port).
To allow also for old-fashioned RS232-Ports (e.g. /dev/ttyS1) I made a little work-around using
the driver configuration box: if you select a COM/TTY number below 10, ttyS<x> is assumed,
else ttyUSB<x-10> is assumed. On Windows, COM<x> is opened anyways.
This patch will hopefully be improved in a future version, when i know
how to better deal with the GUI configuration data ...
BTW: is there a tutorial how to extend configuration dialogs for custom hardware parameters,
or how to generate / process stimulation data (e.g. out of buttons / switches of an EEG device) ?


Another known issue is that the ttyUSB0 - device on my Ubuntu distribution
sometimes (yes: again one of these quasi-indeterministic bugs ;)
remains in an inaccessible state after an the connection has been opened,
used for transfer. Even replugging the USB-cable does not help and I have
to reboot to use /dev/ttyUSB0 again, which is quite annoying..
I currently have no clue why this happens, as I correctly close the device.
Most likely, this reflects a problem with the usbserial module and the FTDI driver.

Anyway: Attached you find the sources for the ModularEEG / Monolith - driver and the configuration dialog.
The only change of the original openVibe distribution is in "ovasCAcquisitionServer.cpp", where the
added driver is activated.

regards,
chris
Attachments
openvibe.tar.gz
(42.03 KiB) Downloaded 396 times

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Developing acquisition interface

Post by yrenard »

Hello you two ! Welcome on this board and thank you very much for your interest in OpenViBE.
Chris Veigl wrote: I recently posted my progress to the OpenEEG mailing list,
but the driver is still very basic and not part of any official openViBE SVN / distributions yet.
I hope to receive some comments / suggestions from the openVibe develpers soon.
Thank you very much for your contribution ! I will soon open a space in the gForge for third party contributors and include your driver to a future release. I will try to check your code this week (not sure because I have plenty of things to do this week and will be on holliday the two weeks after) and give you feedback about it !
Chris Veigl wrote: I had some problems when building the source distribution on a recent Ubuntu,
namely with dependencies of the itpp- and ois-libraries.
What is your ubuntu distro ?
What is your CPU architecture ?
(OIS usually has problems compiling, looks like the patch we did was not enough ;) )
Chris Veigl wrote: I was lucky after:
sudo apt-get install automake
sudo apt-get install libtool
sudo export F77=/usr/bin/gfortran
Thank you for this correction.

On the OpenEEG mailing list, you wondered why gfortran was used. gfortran is used to compile some dependencies of IT++ working on matrices (namely BLAS and LAPACK). Fortran is know to be a suitable language for such computations and to have better performances than C++.
Chris Veigl wrote: I cound not fix one thing on the Linux side (which works on Windows):
when starting openvibe by using the recommended /scripts/linux-test,
I get an initialisation error, likely from the Ogre3d engine:

"The program 'OpenViBE-designer-dynamic' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
(Details: serial 173 error_code 2 request_code 128 minor_code 3)"

I hope Yann can shed some light on this ...
However, running the applications from /dist/bin works, but i get no 3D-functionalities
(e.g. Topographic Map). In my windows build using VS2008 express, this worked "out-of-the-box".
What graphic card do you have ? Have you installed the correct drivers ? Are you tunneling X (for example in an SSH session) ?
Chris Veigl wrote: BTW: is there a tutorial how to extend configuration dialogs for custom hardware parameters,
or how to generate / process stimulation data (e.g. out of buttons / switches of an EEG device) ?
There is no such tutorial. The dialogs are built with Glade and GTK. You can have a look to the *.glade files of the other drivers in order to have an idea of how to deal with this aspects. Tell me if you think a tutorial is needed.
Chris Veigl wrote: Anyway: Attached you find the sources for the ModularEEG / Monolith - driver and the configuration dialog.
The only change of the original openVibe distribution is in "ovasCAcquisitionServer.cpp", where the
added driver is activated.
Thank you again, I will check this ASAP.

Chris Veigl
Posts: 6
Joined: Wed Jul 15, 2009 10:43 pm

Re: Developing acquisition interface

Post by Chris Veigl »

yrenard wrote: What is your ubuntu distro ?
What is your CPU architecture ?
(OIS usually has problems compiling, looks like the patch we did was not enough ;) )
I use Ubuntu 9.04 desktop edition,
on an Intel 32-bit dual core CPU, 2 Ghz
yrenard wrote:
Chris Veigl wrote: I cound not fix one thing on the Linux side (which works on Windows):
when starting openvibe by using the recommended /scripts/linux-test,
I get an initialisation error, likely from the Ogre3d engine:

"The program 'OpenViBE-designer-dynamic' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
(Details: serial 173 error_code 2 request_code 128 minor_code 3)"
What graphic card do you have ? Have you installed the correct drivers ? Are you tunneling X (for example in an SSH session) ?
i have a NVIDIA Gforce 9500 GT,
OpenGL works in other applications, no SSH tunnels etc used.
yrenard wrote:
Chris Veigl wrote: BTW: is there a tutorial how to extend configuration dialogs for custom hardware parameters,
or how to generate / process stimulation data (e.g. out of buttons / switches of an EEG device) ?
There is no such tutorial. The dialogs are built with Glade and GTK. You can have a look to the *.glade files of the other drivers in order to have an idea of how to deal with this aspects. Tell me if you think a tutorial is needed.
i used the glade file of the Sinewave Generator UI and patched it to allow selection of the TTY Port. However, it was not clear to me how to get other/more paramters of different type from the glade user interface into the software module / class member variables... i'm sure it's possible to find this out by having a close look at the sources - anyway: tips are apprechiated :idea:

best regards,
chris

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Developing acquisition interface

Post by yrenard »

Chris Veigl wrote: I use Ubuntu 9.04 desktop edition,
on an Intel 32-bit dual core CPU, 2 Ghz

i have a NVIDIA Gforce 9500 GT,
OpenGL works in other applications, no SSH tunnels etc used.
This looks close to what we have tested already.
Chris Veigl wrote: I cound not fix one thing on the Linux side (which works on Windows):
when starting openvibe by using the recommended /scripts/linux-test,
I get an initialisation error, likely from the Ogre3d engine:

"The program 'OpenViBE-designer-dynamic' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
(Details: serial 173 error_code 2 request_code 128 minor_code 3)"
Could it be Ogre3D Bug ?
Have you tried to dig in Ogre3D forums for similar problems ?
Chris Veigl wrote: i used the glade file of the Sinewave Generator UI and patched it to allow selection of the TTY Port. However, it was not clear to me how to get other/more paramters of different type from the glade user interface into the software module / class member variables... i'm sure it's possible to find this out by having a close look at the sources - anyway: tips are apprechiated :idea:
The best way for this is to derivate OpenViBEAcquisitionServer::CConfigurationGlade class in order to overload the doConfigure function. Depending on the value of

Code: Select all

gtk_dialog_run(GTK_DIALOG(m_pDialog))==GTK_RESPONSE_APPLY
you will know if the user pressed "Apply" so to get additional information you have to get from the GUI.

I hope this helps,
Yann

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Developing acquisition interface

Post by yrenard »

Chris,

I just checked the source code you sent for the Modular EEG hardware. This is a very good job (thank you so much for respecting the coding rules !!). Your driver is candidate for inclusion in the next release. Here are two small remarks :

- In the header file, could you move the FD_TYPE definition in the OpenViBEAcquisitionServer namespace ? I don't want any global scope definition. Additionally, FD_TYPE really looks like a "standard" name, so it is a good candidate for name conflicts :)

- In the initialization function, I noticed you use the experiment identifier to choose the serial port to open. This experiment information is not really used for now in OpenViBE. But the idea was to be able to fetch informations from a database thanks to this ID. You'd better not rely on this for your serial port choice. I think that this was for testing purpose and that the last questions about the GUI you asked will help you solve this.

We will eventually move the serial port management code to a module later.

Yann

PS: Your code compiled with no modification on Ubuntu 8.04.3 LTS

ringo-ring
Posts: 4
Joined: Sat Sep 05, 2009 8:24 am

Re: Developing acquisition interface

Post by ringo-ring »

How to rebuild only OpenViBEAcquisitionServer? Running whole win32-build.cmd takes a lot of time...

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Developing acquisition interface

Post by yrenard »

Hello ringo-ring and welcome on this board,

Your question has nothing related to the original topic, so I moved it in another thread. Please, continue the discussion there.

Yann

ringo-ring
Posts: 4
Joined: Sat Sep 05, 2009 8:24 am

Re: Developing acquisition interface

Post by ringo-ring »

Sorry for off-topic. Driver for my device is also based on serial port and very similar to ModEEG discussed here, just minor differences.

Post Reply