Additional cursor in cursortask

Forum for discussion on different user applications
Locked
LukeB
Posts: 4
Joined: 20 Dec 2012, 04:43

Additional cursor in cursortask

Post by LukeB » 02 Jan 2013, 05:55

Hi,

I would like to add a second cursor to the cursortask that would be under joystick/mouse control. I.e. such that whilst the subject moves the original cursor via brain control the experimenter could at the same time move the new second cursor on the same screen with a joystick/mouse.
Please do you have any recommendation about the best way to realize this. Thank you.

Regards,
Luke

mellinger
Posts: 1210
Joined: 12 Feb 2003, 11:06

Re: Additional cursor in cursortask

Post by mellinger » 10 Jan 2013, 15:30

Hi,

screen display in the CursorTask is done by the FeedbackScene* classes in the src/core/Application/CursorTask directory. There are separate classes for 2D and 3D display, and the CursorFeedbackTask uses the interface defined in FeedbackScene.h to communicate with either of those.

Unless you are intending to support both display modes in your application, it will be easiest to create a copy of the CursorTask project as BCI2000/src/custom/MyCursorTask. (Create the "custom" directory immediately below "src" if it does not exist, and make sure there exists a file "custom/CMakeLists.txt" that contains a line:
ADD_SUBDIRECTORY( MyCursorTask )
In "custom/MyCursorTask/CMakeLists.txt", you should replace the executable name with MyCursorTask as well. Then, in CursorFeedbackTask.h, replace all occurrences of the class name "FeedbackScene" with "FeedbackScene2D" or "FeedbackScene3D", respectively, and in CursorFeedbackTask.cpp, remove the instantiation of the FeedbackScene class that you are not going to use. Then, you may delete both FeedbackScene.h and the unused FeedbackScene2/3D.h/cpp from the MyCursorTask folder, and from MyCursorTaskFolder/CMakeLists.txt.

Then, run the appropriate BCI2000/build/Make* script for your IDE to create a BCI2000 solution containing a new project, MyCursorTask, and build that. If everything went well, it will build, and will behave exactly like the original CursorTask, except that it will not be possible to choose between 2D and 3D display.

Now it will be straightforward to duplicate all code referring to the cursor in the remaining FeedbackScene class, and to add code to MyCursorTask/CursorFeedbackTask.cpp that sets the second cursor's position from additional channels in the input signal.

Information about how to record joystick or mouse position in BCI2000 may be found at
http://www.bci2000.org/wiki/index.php/U ... ging_Input

Using the ExpressionFilter, you can then create additional channels in the control signal which hold the desired information (mouse or joystick position):
http://www.bci2000.org/wiki/index.php/U ... sionFilter

Regards,
Juergen

LukeB
Posts: 4
Joined: 20 Dec 2012, 04:43

Re: Additional cursor in cursortask

Post by LukeB » 21 Jan 2013, 08:35

Juergen,

Thank you very much for your advice. I have everything working as you recommended.

Now that I have two cursors on the screen I would like to have it such that the trial is over only when both cursors have reached (intersected) the target.
I have tried this in the CursorFeedbackTask::OnFeedbackEnd, adding a target code and a result code for the new cursor, but I have not made it work this way.
Could you suggest a way?

Best,
Luke

mellinger
Posts: 1210
Joined: 12 Feb 2003, 11:06

Re: Additional cursor in cursortask

Post by mellinger » 30 Jan 2013, 12:33

Hi,

the trial will end either by timing out, or when ResultCode is set to a nonzero value.
The task class tests whether the cursor is inside a target, and sets ResultCode to that target's TargetCode if this is the case.
So just make sure that your task class doesn't set ResultCode unless all your desired conditions are fulfilled.

Regards,
Juergen

LukeB
Posts: 4
Joined: 20 Dec 2012, 04:43

Re: Additional cursor in cursortask

Post by LukeB » 16 Feb 2013, 11:00

Hi,

How would it be possible to change the cursor from the sphere, used as the default, to an image? For example allowing the program to move a picture (.bmp file) around the screen, instead of the current cursor?

Thank you for your continued support.

Best
Luke

LukeB
Posts: 4
Joined: 20 Dec 2012, 04:43

Re: Additional cursor in cursortask

Post by LukeB » 20 Feb 2013, 11:14

Continued from above...
For example... Now I am using a gluDisk rather than a gluSphere. With the disk, I use the image I want to move around the screen as a texture (using disk instead of sphere prevents the image from being distorted).
Now I see my image, but i also see the cursor behind it. I would like to only see the image, so I have tried to adjust the transparency, but I can not make only the cursor transparent without also making the texture transparent as well and i cant find a way to separate the two.

Best
Luke

mellinger
Posts: 1210
Joined: 12 Feb 2003, 11:06

Re: Additional cursor in cursortask

Post by mellinger » 25 Feb 2013, 10:28

I'm not sure whether I understand the problem. Can't you just make the cursor opaque, and set its color to black? Or use an image that has no transparent pixels?

-Juergen

Locked

Who is online

Users browsing this forum: No registered users and 29 guests