Before creating your own PicoScenes plugins from scratch, you have seven steps to gradually develop your understanding of the PicoScenes architecture and the coding skillset. During this processing, you will learn how to git clone PS-PDK code, compile it, modify it, debug it and imitate it. You also will have a general understanding of the modern C++ development on the Linux platform.
PicoScenes Plugin Development Kit (PS-PDK), as a standard C++ library, includes the PicoScenes C/C++ headers and libraries. If you have installed PicoScenes software, PS-PDK is already in your system. The headers and the binary library files are installed at /usr/local/PicoScenes/include/PicoScenes and /usr/local/PicoScenes/lib, respectively. You may refer to the document PicoScenes Installation & Upgrade to ensure your installation.
If PicoScenes and all the development dependencies are successfully installed, you can run the following command to build and install the three plugins of PicoScenes-PDK project.
cdPicoScenes-PDK# or cd to the cloned directory
./Fast_Build_Intall_PicoScenes.sh
Fast_Build_Intall_PicoScenes.sh is a bash script with the following content, which rebuilds the plugins and the .deb package and install the .deb package.
If everything goes fine, the above command rebuilds and reinstalls the latest PS-PDK repository.
9.4. Imitate and develope your own PicoScenes plugins#
“Imitation is not just the sincerest form of flattery - it’s the sincerest form of learning.” – George Bernard Shaw
The entire PS-PDK project is managed by CMake and contains three working plugins, a Demo plugin, the EchoProbe and UDP-forwarder. We have added clear and sufficient comments to the existing code helping you understand the plugin structure, invocation sequence and many operation details. We recommand JetBrains CLion as the IDE for PicoScenes plugin development.
Since the plugin .so file cannot run by itself, a tricky problem of plugin development emerges, how to debug a plugin?
Xincheng Ren, one of our contributors, records a .gif video describing the plugin debug process. In this video, we use JetBrains CLion as our IDE. To debug the EchoProbe plugin, rather than specifying the .so plugin file as the debug main program, you must specify the PicoScenes main program at /usr/local/PicoScenes/bin/ to be the debug main program. Second, you should also add --plugin-dir/path-to-plugin program option to tell PicoScenes main program to load your plugins.
Debug PicoScenes plugins by debug PicoScenes main program#
You can download this .gif video from DebugPlugin.