Integrate a MATLAB Algorithm¶
This guide will show you how to setup your workspace to integrate your own MATLAB motion segmentation algorithm using the MATLAB PLI. It is assumed that you either followed the quickstart guide or you compiled the MSeg Core Module from source and set up the MATLAB PLI.
Install the Skeleton Project¶
We will use the
mseg generate terminal tool to install a skeleton project.
# Define the base directory where the project directory should be located $ export $PROJECT_BASE_DIR=~/projects # Run the generation tool to create the skeleton. # If your algorithm requires training, add the --train flag $ mseg generate --matlab $PROJECT_BASE_DIR ExampleAlgorithm
Run the Algorithm¶
To run the algorithm, both ArmarX and the MSeg core module must be running. You can then start the algorithm like this:
# Change into the project folder $ cd $PROJECT_BASE_DIR/examplealgorithm # Run the algorithm $ ./main
main executable cannot be started from within MATLAB.
Running the algorithm from the terminal, you should now see an output like this:
user@machine:~/projects/examplealgorithm$ ./main Initialising MATLAB Connecting to MSeg core module... Connection established ExampleAlgorithm ready
You can stop the algorithm with
C at any time.