Welcome! This is the official joint repository for Neurotech@USC's Cursor Control and ErrP projects. The former takes up much of the codebase. We submitted both projects to the 2026 California Neurotechnology Conference in Berkeley. Our brain-controlled cursor won second place in the BCI competition. If you are an employer, you should be impressed-- these projects were built from complete scratch with minimal accumulated knowledge or resources, just hard hard work.
The goal with this project was to create a brain-controlled cursor. We used motor imagery (ie imagined movement) and wanted to decode it to map it onto movement. Data was initially collected from 6-8 people, which slowly dropped to two, using psychopy/mi_task.py. Offline analysis was conducted using MI_Classification.ipynb. Data was windowed for online use, and an LSL streamer was used to live poll EEG data. mental_command_task.py was one of our first tasks, meant to force participants to hold motor imagery in one direction for a prolonged period of time. Eventually we refined our tasks and ended up with the four that we ended up using in the competition, which can all be accessed through bci_orchestrator.py. These are lr_cursor_task.py (cursor moves left/right and tries to reach target), tetris_task.py (tetris!), hinge_task.py (honge!), and mi_cursor_task.py (user 'steers' the cursor to the target like a boat or car). Everything can be controlled through our config file.
The aim of this project is to create both a universal and personal ErrP detector, and play around with cutting edge methods. An ErrP is your brain's response to perceiving an error, whether made by you or someone else (or a machine). This happens when you see a basketball player travel, or when you check your texts after a night of drinking and yell out an expletive. It also happens when you see a robot make an error. Hence, if detected accurately and quickly, it can be a great learning signal, allowing for immediate reinforcement.
Current literature suggests that ErrPs are detectable reliably, accurately, and asynchronously. This means that accuracy of model outputs can be monitored by human observers in a way which will 'adapt' the models to the observers' preferences. While much of the existing literature focused on personalized models, we wanted to also look into general models, as there have been papers suggesting cross-participant generalizability (see here). There have also been papers suggesting that the ErrP signal is more than just a binary error/not, and can contain information about the magnitude of the error. Our project bridges these two claims, trying to extract as much information as possible from ErrPs, and see if we can do it across participants. Our best accuracy metrics are around 65% across participants and 76% within participant.
This signal will then be used as reinforcement to an RL agent trying to map neural data onto desired actions, such as moving a cursor using motor imagery. RL is known to deal well with non-stationarities, making it an excellent candidate to deal with EEG data (see here).
We hope to combine our ErrP detector with our cursor system to allow individuals to get better at using the latter by themselves. Detecting ErrPs allows the cursor system to have labeled input that it can refine it's parameters on, or could use to learn a policy. Exactly how the learning will happen is the topic of a research study that will be conducted next year.
This repository will be cleaned up and organized, but until then, we wish you the best of luck in finding everything. Email Matthew (mbusenlene@usc.edu) and ask him for directions. You must keep emailing until he responds, preferably every day; perseverence is key. Happy BCI!