Page 1 of 1

TSMi acquisition module for BCI2000.v2.0

Posted: 11 Jan 2008, 09:05
by nanying
Hello,

I am trying to modify TSMi acauisition module, which has been developed by louismayo originally (refer to http://bci2000.org/phpbb/viewtopic.php?t=379; http://bci2000.org/phpbb/viewtopic.php?t=381). So that it will work with BCI2000.v2.0 project.

After compile I got the Refa.exe, and load it from bcilauncher.exe with P3SignalProcesing and P3Speller. I get the following messages:

Code:
11/01/2008 14:57:33 - TransmissionFilter::Constructor: error in parameter definition:
Source:Online%20Processing list TransmitChList= 4 1 2 3 4 1 1 % // list of transmitted channels.
11/01/2008 14:57:33 - TransmissionFilter::Constructor: SignalSource: invalid parameter line, terminating module.
I am quite new with BCI2000 project. I have no much idea how to link these message to the source code and correct it. And actually I don't understand what infomation these messages bright. Any tips/points are appreciate.

-nanying

Posted: 14 Jan 2008, 06:24
by mellinger
Nanying,

thanks for doing this work!

Please be aware that for BCI2000 Version 2 there is a "contrib" section which contains all source modules contributed for Version 1, adapted to Version 2. There exists a TMSi data aqcuisition module written by Mark Span, which you might try (http://www.bci2000.org/wiki/index.php/C ... ns:TMSiADC).

Unfortunately, we can only make sure these contributed source modules compile and run but not actually test them without the hardware.

If you are successfully using the TMSi module with version 2, please drop us a note! If this requires modifications to the source code, we will be happy to include them explicitly as your contribution, with an appropriate note on the TMSiADC wiki page.

Otherwise, if you prefer to adapt Louis' Refa source module (which has not been contributed to BCI2000 yet), and then contribute it to BCI2000 as a source module tested with Version 2, this will be very welcome as well.

The error itself makes no sense because the questionable parameter line works fine in all other Version 2 source modules. So I suspect a problem related to inconsistencies at link time, either from pre-compiled headers, or from .obj files created with differing compiler settings.
In your project settings, make sure that
* the output directory is set to .\obj
* pre-compiled headers are switched off (for a quick test) or set consistently with the remaining BCI2000 source modules.

HTH,
Juergen

Posted: 15 Jan 2008, 11:39
by nanying
thanks for the reply and it gives me some help.

now i switch off the pre-compiled headers. and compile the project and run again. but got another error message like this:
15/01/2008 17:17:03 - SignalSource: caught exception _STL::out_of_range (vector),
terminating module.
From this message I can not get information about which parameter in the Refa project is conflicted with the setting/configure as defined in the P3Spelling.prm file.

Posted: 15 Jan 2008, 13:07
by mellinger
Nanying,

the error means that the C++ library (aka STL) triggers an exception, due to an invalid index. Most likely, your code is trying to write a value into a GenericSignal outside the signal's dimensions.

To find the origin of the error, do the following:
1) Outcomment the module from the startup batch file you are using.
2) In the Borland IDE, go to "Project->Options->Compiler", and click "Full Debug".
3) Execute the batch file.
4) Change to the IDE, and press F9 to run the module from the debugger.
5) When the exception is thrown, execution will stop. This will be somewhere in STL library code.
6) In the IDE menu, choose "View->Debug window->Call stack". From the top of the call stack, go down until you identify your module's user code.

HTH,
Juergen

Posted: 22 Jan 2008, 05:12
by nanying
Juergen,

I follow the above debug procedure with the batch file:

Code: Select all

cd ..\prog
start operat.exe 
::start Refa.exe 127.0.0.1
start P3SignalProcessing.exe 127.0.0.1
start P3Speller.exe 127.0.0.1
When the operator is loaded, I switch to run the Refa module in full debug mode ( press F8 ) in the IDE until the operator waiting for loading configure parameters. I loaded the the parameter file, P3Speller_Menus.prm, and press Set Config, and then I got the error message:

Code: Select all

22/01/2008 10:54:53 - BCI2000 started
22/01/2008 10:54:54 - Waiting for configuration ...
22/01/2008 10:54:54 - Waiting for configuration ...
22/01/2008 10:55:23 - Waiting for configuration ...
22/01/2008 10:55:35 - Operator set configuration
22/01/2008 10:55:52 - SignalSource: caught exception _STL::out_of_range (vector),
terminating module. 
The Refa mudule is stop at

Code: Select all

BCIERR << "caught exception "
            << typeid( e ).name() << " (" << e.what() << "),\n"
            << "terminating module"
            << endl;
in CoreModule Run function:

Code: Select all

bool
CoreModule::Run( int inArgc, char** inArgv )
{
  try
  {
    if( Initialize( inArgc, inArgv ) )
      MainMessageLoop();
  }
  catch( const char* s )
  {
    BCIERR << s << ", terminating module"
           << endl;
  }
catch( const exception& e )
  {
    BCIERR << "caught exception "
           << typeid( e ).name() << " (" << e.what() << "),\n"
           << "terminating module"
           << endl;
  }
#ifdef __BORLANDC__
  catch( const Exception& e )
  {
    BCIERR << "caught exception "
           << e.Message.c_str() << ",\n"
           << "terminating module"
           << endl;
  }
#endif // __BORLANDC__
  ShutdownSystem();
  return ( bcierr__.Flushes() == 0 );
}
I also debug the TMSi module using the same procedure as for Refa moduel with the following batch file:

Code: Select all

cd ..\prog
start operat.exe 
::start TMSi.exe 127.0.0.1
start P3SignalProcessing.exe 127.0.0.1
start P3Speller.exe 127.0.0.1
And got almost the same messages:

Code: Select all

22/01/2008 10:20:43 - BCI2000 started
22/01/2008 10:20:44 - Waiting for configuration ...
22/01/2008 10:20:44 - Waiting for configuration ...
22/01/2008 10:24:43 - Waiting for configuration ...
22/01/2008 10:28:02 - Operator set configuration
22/01/2008 10:28:02 - Signal Processing confirmed new parameters ...
22/01/2008 10:28:02 - Source confirmed new parameters ...
22/01/2008 10:28:02 - User Application confirmed new parameters ...
22/01/2008 10:28:19 - SignalSource: caught exception _STL::out_of_range (vector),
terminating module. 
The only difference is in TMSi the rest modules confirmed the new parameters while it is not in Refa.

Even I go into the source code when the program stop, I still can not find out the exact conflict involved with. I can not find out the lines of code that have been excuted between I press Set Config and the error message being thrown.

- nanying

Posted: 22 Jan 2008, 07:33
by mellinger
In the IDE's main menu, go to Tools->Debugger Options->Language Exceptions.
Make sure that "Stop on C++ exceptions" is checked.
Code execution should stop where the exception is thrown, rather than where it is caught.

HTH,
Juergen