How to Add New Backend Commands

When adding new functionality to our Movement Intent Decoder software, you’ll likely need to add new Backend Command so that the Frontend (either GUI or CLI) can trigger that functionality. Adding a new Command is straightforward.

First, define a new value of the Commands Enum in python/src/common/enums.py for your new command. The integer value of your command enum is arbitrary and not used.

Next, update the self.handler dictionary defined in Backend.__init__() which maps Commands to their Backend handler methods. A valid handler function can accept positional and keyword arguments (but we typically only use keyword arguments) and should most likely be a method defined inside the Backend class (ie with self as the first argument).

Now all that’s left is to update the Frontend code to send that given command to Backend along with any necessary keyword arguments. This can be done using the send_command() method defined in both the CLI and the GUI.