├── .gitignore
├── LICENSE
├── README.md
├── catkin_create_rqt
├── rqt_template
├── CMakeLists.txt
├── include
│ └── rqt_template
│ │ └── Template.h
├── launch
│ └── rqt_template.launch
├── package.xml
├── plugin.xml
├── resource
│ └── resources.qrc
├── scripts
│ └── rqt_template
├── setup.py
└── src
│ └── rqt_template
│ ├── Template.cpp
│ └── Template.ui
└── rqt_template_py
├── CMakeLists.txt
├── launch
└── rqt_template_py.launch
├── package.xml
├── plugin.xml
├── scripts
└── rqt_template_py
├── setup.py
└── src
└── rqt_template_py
├── Template.py
├── Template.ui
└── __init__.py
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | *~
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015, Sam
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | * Neither the name of catkin_create_rqt nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Create catkin rqt plugin package for ROS
2 |
3 | **Author: Samuel Bachmann**
4 |
5 | This is a very basic script to create a standard rqt plugin for ROS.
6 | The script will generate a ready to use rqt package including source code files.
7 | There are some input arguments supported to customize the package a bit.
8 | By setting `-y` the script generates a rqt package in python.
9 |
10 | ## Usage
11 |
12 | Example call:
13 |
14 | ./catkin_create_rqt rqt_example std_msgs sensor_msgs -c Example -n rqt_example -f example -p /home/user/catkin_ws/src
15 |
16 | ## Supported arguments
17 |
18 | usage: catkin_create_rqt [-h] [-p PATH] [-c CLASS_NAME] [-n NAMESPACE]
19 | [-f FILE_NAME] [-a AUTHOR] [-e EMAIL] [-y]
20 | name [dependencies [dependencies ...]]
21 |
22 |
23 | | Parameter | Description |
24 | | ------------------- | ---------------------------------------------------- |
25 | | [-h, --help] | shows the help message and exits |
26 | | [-p, --path] | the path into which the package should be generated |
27 | | [-c, --class_name] | rename the used class name |
28 | | [-n, --namespace] | rename the used namespace (only C++) |
29 | | [-f, --file_name] | rename the file names (file_name.cpp, .h, .ui) |
30 | | [-a, --author] | define author in package.xml |
31 | | [-e, --email] | define email address in package.xml |
32 | | [-y, --python] | generate python rqt package |
33 |
--------------------------------------------------------------------------------
/catkin_create_rqt:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import argparse
4 | import sys
5 | import os
6 | import stat
7 |
8 | from string import Template
9 |
10 |
11 | class CreateRqtPkg:
12 | def __init__(self, name, dependencies, path, class_name, namespace,
13 | file_name, author, email, is_python):
14 |
15 | self.pkg_name = name
16 | self.dependencies = dependencies
17 | if path is not None:
18 | self.path_root = os.path.abspath(path[0])
19 | else:
20 | self.path_root = ''
21 | if class_name is not None:
22 | self.class_name = class_name[0]
23 | else:
24 | self.class_name = 'View'
25 | if namespace is not None:
26 | self.namespace = namespace[0]
27 | else:
28 | self.namespace = self.pkg_name
29 | if file_name is not None:
30 | self.file_name = file_name[0]
31 | else:
32 | self.file_name = self.class_name
33 | if author is not None:
34 | self.author = author[0]
35 | else:
36 | self.author = 'todo'
37 | if email is not None:
38 | self.email = email[0]
39 | else:
40 | self.email = 'todo@todo.com'
41 | self.is_python = is_python
42 |
43 | dependencies_1 = ""
44 | dependencies_2 = ""
45 | dependencies_xml = ""
46 | for item in self.dependencies:
47 | dependencies_1 += " " + item + "\n"
48 | dependencies_2 += " " + item + "\n"
49 | dependencies_xml += " " + item + "\n"
50 |
51 | self.template_fill = {'class_name': self.class_name,
52 | 'namespace': self.namespace,
53 | 'file_name': self.file_name,
54 | 'author': self.author,
55 | 'email': self.email,
56 | 'dependencies_1': dependencies_1,
57 | 'dependencies_2': dependencies_2,
58 | 'dependencies_xml': dependencies_xml,
59 | 'pkg_name': self.pkg_name}
60 |
61 | self.path = os.path.join(self.path_root, self.pkg_name)
62 | self.path_src = os.path.join(self.path, 'src', self.pkg_name)
63 | self.path_include = os.path.join(self.path, 'include', self.pkg_name)
64 | self.path_resource = os.path.join(self.path, 'resource')
65 | self.path_scripts = os.path.join(self.path, 'scripts')
66 | self.path_launch = os.path.join(self.path, 'launch')
67 |
68 | if not self.is_python:
69 | template_name = "rqt_template"
70 | else:
71 | template_name = "rqt_template_py"
72 |
73 | files = []
74 | files.append((os.path.join(self.path, 'setup.py'),
75 | os.path.join(template_name, 'setup.py')))
76 | files.append((os.path.join(self.path, 'plugin.xml'),
77 | os.path.join(template_name, 'plugin.xml')))
78 | files.append((os.path.join(self.path, 'package.xml'),
79 | os.path.join(template_name, 'package.xml')))
80 | files.append((os.path.join(self.path, 'CMakeLists.txt'),
81 | os.path.join(template_name, 'CMakeLists.txt')))
82 | files.append((os.path.join(self.path_scripts, self.pkg_name),
83 | os.path.join(template_name, 'scripts', template_name)))
84 | files.append((os.path.join(self.path_launch, self.pkg_name + '.launch'),
85 | os.path.join(template_name, 'launch',
86 | template_name + '.launch')))
87 | if not self.is_python:
88 | files.append((os.path.join(self.path_src, self.file_name + '.cpp'),
89 | os.path.join(template_name, 'src', template_name,
90 | 'Template.cpp')))
91 | files.append((os.path.join(self.path_include,
92 | self.file_name + '.h'),
93 | os.path.join(template_name, 'include', template_name,
94 | 'Template.h')))
95 | files.append((os.path.join(self.path_src, self.file_name + '.ui'),
96 | os.path.join(template_name, 'src', template_name,
97 | 'Template.ui')))
98 | files.append((os.path.join(self.path_resource,
99 | 'resources.qrc'),
100 | os.path.join(template_name, 'resource',
101 | 'resources.qrc')))
102 | else:
103 | files.append((os.path.join(self.path_src,
104 | self.file_name + '.py'),
105 | os.path.join(template_name, 'src', template_name,
106 | 'Template.py')))
107 | files.append((os.path.join(self.path_src,
108 | self.file_name + '.ui'),
109 | os.path.join(template_name, 'src', template_name,
110 | 'Template.ui')))
111 | files.append((os.path.join(self.path_src, '__init__.py'),
112 | None))
113 | # generate directory tree
114 | self.mkdir()
115 | # generate files
116 | for t in files:
117 | self.apply_template(t)
118 | # make script executable
119 | st = os.stat(os.path.join(self.path_scripts, self.pkg_name))
120 | os.chmod(os.path.join(self.path_scripts, self.pkg_name),
121 | st.st_mode | stat.S_IEXEC)
122 |
123 | def mkdir(self):
124 | if os.path.exists(self.path):
125 | print('package ' + self.pkg_name + ' exist already!')
126 | sys.exit(0)
127 |
128 | if not os.path.exists(self.path):
129 | os.makedirs(self.path)
130 | if not os.path.exists(self.path_src):
131 | os.makedirs(self.path_src)
132 | if not os.path.exists(self.path_include) and not self.is_python:
133 | os.makedirs(self.path_include)
134 | if not os.path.exists(self.path_resource) and not self.is_python:
135 | os.makedirs(self.path_resource)
136 | if not os.path.exists(self.path_scripts):
137 | os.makedirs(self.path_scripts)
138 | if not os.path.exists(self.path_launch):
139 | os.makedirs(self.path_launch)
140 |
141 | def apply_template(self, path_tuple):
142 | try:
143 | file_out = open(path_tuple[0], 'w')
144 | except (OSError, IOError) as os_io_error:
145 | print('could not create ' + path_tuple[0])
146 | print(os_io_error)
147 | sys.exit(0)
148 |
149 | if path_tuple[1] is None:
150 | file_out.close()
151 | return
152 |
153 | file_in = open(path_tuple[1])
154 | template = Template(file_in.read())
155 | file_out.write(template.substitute(self.template_fill))
156 | file_out.close()
157 |
158 |
159 | if __name__ == '__main__':
160 | parser = argparse.ArgumentParser(
161 | description='Creates a new catkin rqt plugin package',
162 | epilog='')
163 | parser.add_argument('name',
164 | nargs=1,
165 | help='The name for the package')
166 | parser.add_argument('dependencies',
167 | nargs='*',
168 | help='Catkin package Dependencies')
169 | parser.add_argument('-p', '--path',
170 | action='append',
171 | help='The path into which the package should be '
172 | 'generated')
173 | parser.add_argument('-c', '--class_name',
174 | action='append',
175 | help='Give the base rqt_plugin class a custom name '
176 | '(default = View)')
177 | parser.add_argument('-n', '--namespace',
178 | action='append',
179 | help='Rename the namespace (default = package name)')
180 | parser.add_argument('-f', '--file_name',
181 | action='append',
182 | help='Rename the files .cpp/.h/.ui (default = class '
183 | 'name)')
184 | parser.add_argument('-a', '--author',
185 | action='append',
186 | help='Author in package.xml')
187 | parser.add_argument('-e', '--email',
188 | action='append',
189 | help='Email address in package.xml')
190 | parser.add_argument('-y', '--python', dest='is_python',
191 | default=False,
192 | action='store_true',
193 | help='Generate python rqt package')
194 | args = parser.parse_args()
195 |
196 | rqt = CreateRqtPkg(args.name[0], args.dependencies, args.path,
197 | args.class_name, args.namespace, args.file_name,
198 | args.author, args.email, args.is_python)
199 |
--------------------------------------------------------------------------------
/rqt_template/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 |
3 | project(${pkg_name})
4 | # Load catkin and all dependencies required for this package
5 | find_package(catkin REQUIRED COMPONENTS
6 | rqt_gui
7 | rqt_gui_cpp
8 | ${dependencies_1}
9 | )
10 |
11 | if ("$${qt_gui_cpp_USE_QT_MAJOR_VERSION} " STREQUAL "5 ")
12 | find_package(Qt5Widgets REQUIRED)
13 | else()
14 | find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
15 | include($${QT_USE_FILE})
16 | endif()
17 |
18 | # Flags
19 | SET(CMAKE_CXX_FLAGS "-std=c++11 $${CMAKE_CXX_FLAGS}")
20 |
21 | set($${PROJECT_NAME}_SRCS
22 | src/$${PROJECT_NAME}/${file_name}.cpp
23 | )
24 |
25 | set($${PROJECT_NAME}_HDRS
26 | include/$${PROJECT_NAME}/${file_name}.h
27 | )
28 |
29 | set($${PROJECT_NAME}_UIS
30 | src/$${PROJECT_NAME}/${file_name}.ui
31 | )
32 |
33 | set($${PROJECT_NAME}_QRC
34 | resource/resources.qrc
35 | )
36 |
37 | set(ui_INCLUDE_DIR
38 | "$${CATKIN_DEVEL_PREFIX}/$${CATKIN_GLOBAL_INCLUDE_DESTINATION}/$${PROJECT_NAME}"
39 | )
40 |
41 | set($${PROJECT_NAME}_INCLUDE_DIRECTORIES
42 | include
43 | $${ui_INCLUDE_DIR}/..
44 | )
45 |
46 | if(NOT EXISTS $${ui_INCLUDE_DIR})
47 | file(MAKE_DIRECTORY $${ui_INCLUDE_DIR})
48 | endif()
49 |
50 | catkin_package(
51 | # INCLUDE_DIRS
52 | # $${$${PROJECT_NAME}_INCLUDE_DIRECTORIES}
53 | # LIBRARIES $${PROJECT_NAME}
54 | CATKIN_DEPENDS
55 | rqt_gui
56 | rqt_gui_cpp
57 | ${dependencies_2}
58 | )
59 |
60 | # include directories before wrap cpp
61 | include_directories($${$${PROJECT_NAME}_INCLUDE_DIRECTORIES}
62 | $${$${PROJECT_NAME}_INCLUDE_DIRECTORIES}
63 | $${catkin_INCLUDE_DIRS}
64 | )
65 |
66 |
67 | if ("$${qt_gui_cpp_USE_QT_MAJOR_VERSION} " STREQUAL "5 ")
68 | include_directories($${Qt5Widgets_INCLUDE_DIRS})
69 | add_definitions($${Qt5Widgets_DEFINITIONS})
70 | qt5_wrap_cpp($${PROJECT_NAME}_MOCS $${$${PROJECT_NAME}_HDRS})
71 | qt5_add_resources($${PROJECT_NAME}_RCC $${$${PROJECT_NAME}_QRC})
72 | else()
73 | qt4_wrap_cpp($${PROJECT_NAME}_MOCS $${$${PROJECT_NAME}_HDRS})
74 | qt4_add_resources($${PROJECT_NAME}_RCC $${$${PROJECT_NAME}_QRC})
75 | endif()
76 |
77 | # ensure generated header files are being created in the devel space
78 | set(_cmake_current_binary_dir "$${CMAKE_CURRENT_BINARY_DIR}")
79 | set(CMAKE_CURRENT_BINARY_DIR $${ui_INCLUDE_DIR})
80 | if("$${qt_gui_cpp_USE_QT_MAJOR_VERSION} " STREQUAL "5 ")
81 | qt5_wrap_ui($${PROJECT_NAME}_UIS_H $${$${PROJECT_NAME}_UIS})
82 | else()
83 | qt4_wrap_ui($${PROJECT_NAME}_UIS_H $${$${PROJECT_NAME}_UIS})
84 | endif()
85 | set(CMAKE_CURRENT_BINARY_DIR "$${_cmake_current_binary_dir}")
86 |
87 | add_library($${PROJECT_NAME}
88 | $${$${PROJECT_NAME}_SRCS}
89 | $${$${PROJECT_NAME}_HDRS}
90 | $${$${PROJECT_NAME}_MOCS}
91 | $${$${PROJECT_NAME}_UIS_H}
92 | $${$${PROJECT_NAME}_RCC}
93 | )
94 |
95 | target_link_libraries($${PROJECT_NAME}
96 | $${catkin_LIBRARIES}
97 | )
98 |
99 | if ("$${qt_gui_cpp_USE_QT_MAJOR_VERSION} " STREQUAL "5 ")
100 | target_link_libraries($${PROJECT_NAME} Qt5::Widgets)
101 | else()
102 | target_link_libraries($${PROJECT_NAME} $${QT_QTCORE_LIBRARY} $${QT_QTGUI_LIBRARY})
103 | endif()
104 |
105 | add_dependencies($${PROJECT_NAME}
106 | $${catkin_EXPORTED_TARGETS}
107 | )
108 |
109 | find_package(class_loader)
110 | class_loader_hide_library_symbols($${PROJECT_NAME})
111 |
112 | install(FILES plugin.xml
113 | DESTINATION $${CATKIN_PACKAGE_SHARE_DESTINATION}
114 | )
115 |
116 | install(TARGETS $${PROJECT_NAME}
117 | ARCHIVE DESTINATION $${CATKIN_PACKAGE_LIB_DESTINATION}
118 | LIBRARY DESTINATION $${CATKIN_PACKAGE_LIB_DESTINATION}
119 | RUNTIME DESTINATION $${CATKIN_PACKAGE_BIN_DESTINATION}
120 | )
121 |
122 | install(PROGRAMS scripts/$${PROJECT_NAME}
123 | DESTINATION $${CATKIN_PACKAGE_BIN_DESTINATION}
124 | )
125 |
126 | install(DIRECTORY include/$${PROJECT_NAME}/
127 | DESTINATION $${CATKIN_PACKAGE_INCLUDE_DESTINATION}
128 | )
129 |
130 | # uncomment, if this widget will be used by any other QObject (e.g., a widget)
131 | #install(DIRECTORY $${ui_INCLUDE_DIR}/
132 | # DESTINATION $${CATKIN_PACKAGE_INCLUDE_DESTINATION}
133 | #)
134 |
135 | #install(
136 | # DIRECTORY resource
137 | # DESTINATION $${CATKIN_PACKAGE_SHARE_DESTINATION}
138 | # FILES_MATCHING
139 | # PATTERN "*.png"
140 | # PATTERN "*.svg"
141 | #)
142 |
--------------------------------------------------------------------------------
/rqt_template/include/rqt_template/Template.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include <${pkg_name}/ui_${file_name}.h>
5 |
6 | #include
7 |
8 | #include
9 | #include
10 |
11 | namespace ${namespace} {
12 |
13 | class ${class_name} : public rqt_gui_cpp::Plugin {
14 | Q_OBJECT
15 |
16 | public:
17 |
18 | /* ======================================================================== */
19 | /* Constructor/Destructor */
20 | /* ======================================================================== */
21 |
22 | ${class_name}();
23 |
24 | /* ======================================================================== */
25 | /* Initialize/Shutdown */
26 | /* ======================================================================== */
27 |
28 | void initPlugin(qt_gui_cpp::PluginContext& context) override;
29 |
30 | void shutdownPlugin() override;
31 |
32 | /* ======================================================================== */
33 | /* Settings */
34 | /* ======================================================================== */
35 |
36 | void saveSettings(qt_gui_cpp::Settings& plugin_settings,
37 | qt_gui_cpp::Settings& instance_settings) const override;
38 |
39 | void restoreSettings(const qt_gui_cpp::Settings& plugin_settings,
40 | const qt_gui_cpp::Settings& instance_settings) override;
41 |
42 | private:
43 |
44 | /* ======================================================================== */
45 | /* Constants */
46 | /* ======================================================================== */
47 |
48 | const std::string TAG = "${class_name}";
49 |
50 | /* ======================================================================== */
51 | /* Variables */
52 | /* ======================================================================== */
53 |
54 | Ui::${class_name}Widget ui_;
55 | QWidget* widget_;
56 |
57 | ros::NodeHandle nh_;
58 |
59 | /* ======================================================================== */
60 | /* Methods */
61 | /* ======================================================================== */
62 |
63 |
64 |
65 | /* ======================================================================== */
66 | /* Events */
67 | /* ======================================================================== */
68 |
69 |
70 |
71 | /* ======================================================================== */
72 | /* Callbacks */
73 | /* ======================================================================== */
74 |
75 |
76 |
77 | protected slots:
78 |
79 | /* ======================================================================== */
80 | /* Slots */
81 | /* ======================================================================== */
82 |
83 |
84 |
85 | signals:
86 |
87 | /* ======================================================================== */
88 | /* Signals */
89 | /* ======================================================================== */
90 |
91 |
92 |
93 | };
94 |
95 | } // namespace
96 |
--------------------------------------------------------------------------------
/rqt_template/launch/rqt_template.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/rqt_template/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ${pkg_name}
4 | 0.3.10
5 | ${pkg_name} provides a GUI plugin to ...
6 |
7 | ${author}
8 | TODO
9 |
10 | ${author}
11 |
12 | catkin
13 |
14 | rqt_gui
15 | rqt_gui_cpp
16 | ${dependencies_xml}
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/rqt_template/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | A GUI plugin to ...
7 |
8 |
9 |
10 |
11 | folder
12 | Plugins related to...
13 |
14 |
15 | image-x-generic
16 | A GUI plugin to ...
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/rqt_template/resource/resources.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/rqt_template/scripts/rqt_template:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import sys
4 |
5 | from rqt_gui.main import Main
6 |
7 | main = Main()
8 | sys.exit(main.main(sys.argv, standalone='${namespace}/${class_name}'))
9 |
--------------------------------------------------------------------------------
/rqt_template/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | from distutils.core import setup
4 | from catkin_pkg.python_setup import generate_distutils_setup
5 |
6 | d = generate_distutils_setup(
7 | packages=['${pkg_name}'],
8 | package_dir={'': 'src'}
9 | )
10 |
11 | setup(**d)
12 |
--------------------------------------------------------------------------------
/rqt_template/src/rqt_template/Template.cpp:
--------------------------------------------------------------------------------
1 | #include "${pkg_name}/${file_name}.h"
2 |
3 | #include
4 |
5 | namespace ${namespace} {
6 |
7 | /* ========================================================================== */
8 | /* Constructor/Destructor */
9 | /* ========================================================================== */
10 |
11 | ${class_name}::${class_name}()
12 | : rqt_gui_cpp::Plugin(),
13 | widget_(nullptr) {
14 |
15 | setObjectName("${class_name}");
16 | }
17 |
18 | /* ========================================================================== */
19 | /* Initialize/Shutdown */
20 | /* ========================================================================== */
21 |
22 | void ${class_name}::initPlugin(qt_gui_cpp::PluginContext& context) {
23 | widget_ = new QWidget();
24 | ui_.setupUi(widget_);
25 | if (context.serialNumber() > 1) {
26 | widget_->setWindowTitle(widget_->windowTitle() +
27 | " (" + QString::number(context.serialNumber()) + ")");
28 | }
29 | context.addWidget(widget_);
30 | }
31 |
32 | void ${class_name}::shutdownPlugin() {
33 | }
34 |
35 | /* ========================================================================== */
36 | /* Settings */
37 | /* ========================================================================== */
38 |
39 | void ${class_name}::saveSettings(
40 | qt_gui_cpp::Settings& plugin_settings,
41 | qt_gui_cpp::Settings& instance_settings) const {
42 | }
43 |
44 | void ${class_name}::restoreSettings(
45 | const qt_gui_cpp::Settings& plugin_settings,
46 | const qt_gui_cpp::Settings& instance_settings) {
47 | }
48 |
49 | /* ========================================================================== */
50 | /* Methods */
51 | /* ========================================================================== */
52 |
53 |
54 |
55 | /* ========================================================================== */
56 | /* Events */
57 | /* ========================================================================== */
58 |
59 |
60 |
61 | /* ========================================================================== */
62 | /* Callbacks */
63 | /* ========================================================================== */
64 |
65 |
66 |
67 | /* ========================================================================== */
68 | /* Slots */
69 | /* ========================================================================== */
70 |
71 |
72 |
73 | /* ========================================================================== */
74 | /* Signals */
75 | /* ========================================================================== */
76 |
77 |
78 |
79 | } // namespace
80 |
81 | PLUGINLIB_EXPORT_CLASS(${namespace}::${class_name},
82 | rqt_gui_cpp::Plugin)
83 |
--------------------------------------------------------------------------------
/rqt_template/src/rqt_template/Template.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | ${class_name}Widget
4 |
5 |
6 | true
7 |
8 |
9 |
10 | 0
11 | 0
12 | 558
13 | 376
14 |
15 |
16 |
17 | ${pkg_name}
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/rqt_template_py/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 |
3 | project(${pkg_name})
4 | # Load catkin and all dependencies required for this package
5 | find_package(catkin REQUIRED COMPONENTS
6 | rqt_gui
7 | rqt_gui_cpp
8 | ${dependencies_1}
9 | )
10 |
11 | catkin_python_setup()
12 |
13 | catkin_package(
14 | )
15 |
16 | include_directories(
17 | $${catkin_INCLUDE_DIRS}
18 | )
19 |
20 | install(PROGRAMS
21 | scripts/${pkg_name}
22 | DESTINATION $${CATKIN_PACKAGE_BIN_DESTINATION}
23 | )
24 |
--------------------------------------------------------------------------------
/rqt_template_py/launch/rqt_template_py.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/rqt_template_py/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ${pkg_name}
4 | 0.3.10
5 | ${pkg_name} provides a GUI plugin to ...
6 |
7 | ${author}
8 | TODO
9 |
10 | ${author}
11 |
12 | catkin
13 |
14 | rospy
15 | rqt_gui_py
16 | ${dependencies_xml}
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/rqt_template_py/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | A GUI plugin to ...
6 |
7 |
8 |
9 |
10 | folder
11 | Plugins related to...
12 |
13 |
14 | image-x-generic
15 | A GUI plugin to ...
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/rqt_template_py/scripts/rqt_template_py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import sys
4 |
5 | from ${pkg_name}.${file_name} import ${class_name}
6 | from rqt_gui.main import Main
7 |
8 | main = Main(filename='${pkg_name}')
9 | sys.exit(main.main(standalone='${pkg_name}'))
10 |
--------------------------------------------------------------------------------
/rqt_template_py/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | from distutils.core import setup
4 | from catkin_pkg.python_setup import generate_distutils_setup
5 |
6 | d = generate_distutils_setup(
7 | packages=['${pkg_name}'],
8 | package_dir={'': 'src'}
9 | )
10 |
11 | setup(**d)
12 |
--------------------------------------------------------------------------------
/rqt_template_py/src/rqt_template_py/Template.py:
--------------------------------------------------------------------------------
1 | import os
2 | import rospy
3 |
4 | from qt_gui.plugin import Plugin
5 | from python_qt_binding import loadUi
6 | from python_qt_binding.QtGui import QWidget
7 |
8 |
9 | class ${class_name}(Plugin):
10 | def __init__(self, context):
11 | super(${class_name}, self).__init__(context)
12 | # Give QObjects reasonable names
13 | self.setObjectName('${class_name}')
14 |
15 | # Process standalone plugin command-line arguments
16 | from argparse import ArgumentParser
17 | parser = ArgumentParser()
18 | # Add argument(s) to the parser.
19 | parser.add_argument("-q", "--quiet", action="store_true",
20 | dest="quiet",
21 | help="Put plugin in silent mode")
22 | args, unknowns = parser.parse_known_args(context.argv())
23 | # if not args.quiet:
24 | # print('arguments: ', args)
25 | # print('unknowns: ', unknowns)
26 |
27 | # Create QWidget
28 | self._widget = QWidget()
29 | # Get path to UI file which is a sibling of this file
30 | # in this example the .ui and .py file are in the same folder
31 | ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
32 | '${class_name}.ui')
33 | # Extend the widget with all attributes and children from UI file
34 | loadUi(ui_file, self._widget)
35 | # Give QObjects reasonable names
36 | self._widget.setObjectName('${class_name}Ui')
37 | # Show _widget.windowTitle on left-top of each plugin (when
38 | # it's set in _widget). This is useful when you open multiple
39 | # plugins at once. Also if you open multiple instances of your
40 | # plugin at once, these lines add number to make it easy to
41 | # tell from pane to pane.
42 | if context.serial_number() > 1:
43 | self._widget.setWindowTitle(self._widget.windowTitle() +
44 | (' (%d)' % context.serial_number()))
45 | # Add widget to the user interface
46 | context.add_widget(self._widget)
47 |
48 | def shutdown_plugin(self):
49 | # TODO unregister all publishers here
50 | pass
51 |
52 | def save_settings(self, plugin_settings, instance_settings):
53 | # TODO save intrinsic configuration, usually using:
54 | # instance_settings.set_value(k, v)
55 | pass
56 |
57 | def restore_settings(self, plugin_settings, instance_settings):
58 | # TODO restore intrinsic configuration, usually using:
59 | # v = instance_settings.value(k)
60 | pass
61 |
62 | # def trigger_configuration(self):
63 | # Comment in to signal that the plugin has a way to configure
64 | # This will enable a setting button (gear icon) in each dock widget
65 | # title bar
66 | # Usually used to open a modal configuration dialog
67 |
--------------------------------------------------------------------------------
/rqt_template_py/src/rqt_template_py/Template.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | ${class_name}Widget
4 |
5 |
6 | true
7 |
8 |
9 |
10 | 0
11 | 0
12 | 558
13 | 376
14 |
15 |
16 |
17 | ${pkg_name}
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/rqt_template_py/src/rqt_template_py/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leggedrobotics/catkin_create_rqt/ad725e2d5b98f9273a280886fce59aa2ab96dd14/rqt_template_py/src/rqt_template_py/__init__.py
--------------------------------------------------------------------------------