Compile a PLI from Source¶
This guide will show you how to compile a PLI from source for C++, Python, Java or MATLAB. It is assumed that the MSeg core module was installed as described in the guide about compiling the MSeg core module from source.
Programming Language Specific Prerequisites¶
Some PLIs require certain prerequisites which will be elaborated in the following.
C++, Python and Java¶
Nothing specific to consider.
We need to install the MATLAB Python libraries so the PLI can access the MATLAB engine.
# Change to the MATLAB installation's script folder $ cd $MATLAB_HOME/extern/engines/python # Run the install script $ python setup.py install --user
Run one of these
make-commands, depending on which PLI you want to use.
# Change into the MSeg build directory $ cd $MSEG_INSTALL_DIR/build # Use this target to build the C++ PLI $ make plicpp # Use this target to build the Python PLI $ make plipython # Use this target to build the Java PLI $ make plijava # Use this target to build the MATLAB PLI $ make plimatlab # Use this target to build all PLIs $ make plis
Setup Bundled Algorithms¶
You can try the motion segmentation algorithms bundled with MSeg to see how they use the PLI APIs. The source codes are
You can compile them with:
# Change into the MSeg build directory $ cd $MSEG_INSTALL_DIR/build # Use this target to build all algorithms # (Requires that all PLIs were built) $ make algorithms # Use this target to build the ZVC algorithm # (Requires that the C++ PLI was built) $ make algorithmzvc # Use this target to build the SSAV algorithm # (Requires that the Python PLI was built) $ make algorithmssav # Use this target to build the PCA algorithm # (Requires that the Java PLI was built) $ make algorithmpca
The compiled algorithms can then be found in
$MSEG_INSTALL_DIR/build/bin (the executables or scripts start with
“algorithm”). Before launching the algorithm, please make sure that both ArmarX and the MSeg core module are running,
otherwise the algorithm will crash. Run
armarx status to see if ArmarX is running, and
armarx start to start
it. Similary, use
mseg status to see the status of the components of MSeg core module, and
mseg start to