I haven't posted in a while. Let's start again with something small.
Whenever I have to create a new plugin for RWS, I find myself scavenging the source code from one of my older projects. I have to remove the excess bits, rename and edit the files and classes.
This is a repository containing a blank RWS plugin that you can use: RWS plugin template.
It contains a blank Qt UI file (with a test button added), CMake configuration and boilerplate source files.
This is how to use it:
1. Make sure you have your RobWork installed.
2. Configure the paths in your evironment. I recommend adding the following to your .bashrc:
export RW_ROOT=${HOME}/robwork/RobWork
export RWS_ROOT=${HOME}/robwork/RobWorkStudio
export RWSIM_ROOT=${HOME}/robwork/RobWorkSim
3. Download the repository, navigate to the build directory and execute build commands:
cmake ..
make
4. You should now have your plugin .so in the libs directory. You can add it in the RWS environment through the menu or append the following to the [Plugins] section in the RobWorkStudio.ini file:
RWSPluginTemplate\DockArea=2
RWSPluginTemplate\Filename=librws_plugin_template.so
RWSPluginTemplate\Path=<plugin path>/libs
RWSPluginTemplate\Visible=true
(You can change RWSPluginTemplate to whatever you want; do also change the file name and the path.)
You may want to edit the plugin naming before building it. You should change the following things:
1. Change .cpp, .hpp, and .ui file names.
2. In .cpp and .hpp files change the class name globally.
3. In .ui file change the widget name.
4. Update CMakeLists.txt with these names.
5. Add includes and libraries in CMakeLists.txt as necessary.
6. In plugin.json update the name field.
7. Test whether build still works after these modifications.
The plugin contains an example of how to service a push button and how to do some minor things with the workcell. Have fun.