Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial migration #1

Merged
merged 12 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
227 changes: 227 additions & 0 deletions opp_gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
cmake_minimum_required(VERSION 2.8.3)
project(opp_gui)

add_compile_options(-std=c++14)

find_package(catkin REQUIRED COMPONENTS
actionlib
eigen_conversions
eigen_stl_containers
geometric_shapes
geometry_msgs
noether_msgs
pluginlib
roscpp
opp_area_selection
opp_msgs
opp_database
rviz
shape_msgs
std_srvs
visualization_msgs
)

find_package(Qt5 REQUIRED COMPONENTS
Core
Widgets
Sql
)

find_package(PCL 1.9 REQUIRED)
add_definitions(${PCL_DEFINITIONS})

catkin_package(
INCLUDE_DIRS
include
LIBRARIES
${PROJECT_NAME}_panels
${PROJECT_NAME}_utils
${PROJECT_NAME}_widgets
CATKIN_DEPENDS
actionlib
eigen_conversions
eigen_stl_containers
geometric_shapes
geometry_msgs
noether_msgs
pluginlib
roscpp
opp_area_selection
opp_msgs
opp_database
rviz
shape_msgs
std_srvs
visualization_msgs
DEPENDS
Qt5
PCL
)

###########
## Build ##
###########

include_directories(
include
${catkin_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
${PCL_INCLUDE_DIRS}
)

set(rpg_gui_UIS
ui/database_browser.ui
ui/list_editor.ui
ui/polygon_area_selection_widget.ui
ui/segmentation_parameters_editor.ui
ui/surface_selection_combo_widget.ui
ui/tool_path_parameters_editor.ui
ui/tool_path_planner.ui
ui/touch_point_parameters_editor.ui
ui/database_log.ui
)

set(rpg_gui_widget_HEADERS
include/${PROJECT_NAME}/widgets/list_editor_widget_base.h
include/${PROJECT_NAME}/widgets/polygon_area_selection_widget.h
include/${PROJECT_NAME}/widgets/segmentation_parameters_editor_widget.h
include/${PROJECT_NAME}/widgets/surface_selection_combo_widget.h
include/${PROJECT_NAME}/widgets/tool_path_editor_widget.h
include/${PROJECT_NAME}/widgets/tool_path_parameters_editor_widget.h
include/${PROJECT_NAME}/widgets/tool_path_planner_widget.h
include/${PROJECT_NAME}/widgets/touch_point_editor_widget.h
include/${PROJECT_NAME}/widgets/touch_point_parameters_editor_widget.h
)

set(rpg_gui_widget_SOURCES
src/widgets/polygon_area_selection_widget.cpp
src/widgets/segmentation_parameters_editor_widget.cpp
src/widgets/surface_selection_combo_widget.cpp
src/widgets/tool_path_editor_widget.cpp
src/widgets/tool_path_parameters_editor_widget.cpp
src/widgets/tool_path_planner_widget.cpp
src/widgets/touch_point_editor_widget.cpp
src/widgets/touch_point_parameters_editor_widget.cpp
)

set(rpg_gui_panel_HEADERS
include/${PROJECT_NAME}/tool_path_planner_panel.h
)

set(rpg_gui_panel_SOURCES
src/tool_path_planner_panel.cpp
)

# Run the MOC on the Qt-related UIs and headers
qt5_wrap_ui(rpg_gui_UIS_H
${rpg_gui_UIS}
)
qt5_wrap_cpp(rpg_gui_widget_MOCS
${rpg_gui_widget_HEADERS}
)
qt5_wrap_cpp(rpg_gui_panel_MOCS
${rpg_gui_panel_HEADERS}
)

# Utilities library
add_library(${PROJECT_NAME}_utils
src/utils.cpp
)
target_link_libraries(${PROJECT_NAME}_utils
${catkin_LIBRARIES}
${PCL_LIBRARIES}
Qt5::Core
Qt5::Sql
)

# Qt Widgets
add_library(${PROJECT_NAME}_widgets
${rpg_gui_UIS_H}
${rpg_gui_widget_MOCS}
${rpg_gui_widget_SOURCES}
)
target_link_libraries(${PROJECT_NAME}_widgets
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${PROJECT_NAME}_utils
Qt5::Widgets
)

# Rviz Panel
add_library(${PROJECT_NAME}_panels
${rpg_gui_panel_MOCS}
${rpg_gui_panel_SOURCES}
)
target_link_libraries(${PROJECT_NAME}_panels
${PROJECT_NAME}_widgets
)

######################
## Demo Executables ##
######################

# Segmentation
add_executable(segmentation_demo_app
src/nodes/segmentation_demo_app.cpp
)
target_link_libraries(segmentation_demo_app
${PROJECT_NAME}_widgets
)

# Tool Path Editor
add_executable(tool_path_editor_demo_app
src/nodes/tool_path_editor_demo_app.cpp
)
target_link_libraries(tool_path_editor_demo_app
${PROJECT_NAME}_widgets
)

# Tool Path Planner
add_executable(tool_path_planner_demo_app
src/nodes/tool_path_planner_demo_app.cpp
)
target_link_libraries(tool_path_planner_demo_app
${PROJECT_NAME}_widgets
)

# Touch Point Editor
add_executable(touch_point_editor_demo_app
src/nodes/touch_point_editor_demo_app.cpp
)
target_link_libraries(touch_point_editor_demo_app
${PROJECT_NAME}_widgets
)

#############
## Install ##
#############

# Mark executables and/or libraries for installation
install(
TARGETS
${PROJECT_NAME}_panels
${PROJECT_NAME}_utils
${PROJECT_NAME}_widgets
segmentation_demo_app
tool_path_editor_demo_app
tool_path_planner_demo_app
touch_point_editor_demo_app
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

# Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

# Mark other files for installation (e.g. launch and bag files, etc.)
install(DIRECTORY ui/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/ui
)
install(
FILES
plugin_description.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
55 changes: 55 additions & 0 deletions opp_gui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# opp_gui

This package provides GUI implementations for various applications

## Tool Path Planner

The tool path planner GUI is an RViz panel designed to facilitate the setup of new models and tool path
planning on those models. The GUI also hosts an interface to the database for saving this information

### Usage

1. Build and source the package
1. Run the application
```
roslaunch opp_startup planner_application.launch
```
1. Follow the order of operations of the GUI

## Widget Demos

Each stand-alone widget has a node for demonstrating its functionality

### Touch point editor
```
rosrun opp_gui touch_point_editor_demo_app
rosrun rviz rviz
```

To add a point using the mouse follow these steps:

1. Add the `Circle Tool Cursor` tool to RViz (Should already be included.)
2. Click the `Select with Mouse` button in the widget
3. Activate the `Circle Tool Cursor` tool
4. Select a location on a mesh in the Rviz render panel

### Tool path editor

```
rosrun noether surface_raster_planner_server
rosrun opp_gui tool_path_editor_demo_app
rosrun rviz rviz
```

### Tool path planner
```
rosrun noether surface_raster_planner_server
rosrun opp_gui tool_path_planner_demo_app
rosrun rviz rviz
```

### Database Browser Widget
```
roslaunch opp_startup opp.launch
rosrun opp_gui database_browser_demo_app
```
29 changes: 29 additions & 0 deletions opp_gui/include/opp_gui/register_ros_msgs_for_qt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2019 Southwest Research Institute
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef REGISTER_ROS_MSGS_FOR_QT_H
#define REGISTER_ROS_MSGS_FOR_QT_H

#include <QMetaType>

#include <shape_msgs/Mesh.h>

Q_DECLARE_METATYPE(shape_msgs::Mesh);
Q_DECLARE_METATYPE(shape_msgs::Mesh::Ptr);
Q_DECLARE_METATYPE(std::vector<shape_msgs::Mesh>);
Q_DECLARE_METATYPE(std::vector<shape_msgs::Mesh::Ptr>);

#endif // REGISTER_ROS_MSGS_FOR_QT_H
62 changes: 62 additions & 0 deletions opp_gui/include/opp_gui/tool_path_planner_panel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2019 Southwest Research Institute
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef OPP_GUI_TOOL_PATH_PLANNER_PANEL_H
#define OPP_GUI_TOOL_PATH_PLANNER_PANEL_H

#include <rviz/panel.h>
#include <ros/node_handle.h>

namespace opp_gui
{

class ToolPathPlannerWidget;

/**
* @brief Simple RViz panel that wraps the tool path planner widget such that can easily
* be used within the context of RViz
*/
class ToolPathPlannerPanel : public rviz::Panel
{
Q_OBJECT
public:

/**
* @brief ToolPathPlannerPanel
*
* Note: the visualization manager object, inherited from `rviz::Panel`, cannot be used in
* the constructor. Even though it is a valid, non-null object, it will not be initialized
* until the constructor has finished.
* @param parent
*/
ToolPathPlannerPanel(QWidget* parent = nullptr);

/**
* @brief Initializes the TPP widget and uses the visualization manager to gather
* information about the available frames (used to visualize markers).
*/
virtual void onInitialize() override;

private:

ToolPathPlannerWidget* tpp_widget_;

ros::NodeHandle nh_;
};

} // namespace opp_gui

#endif // OPP_GUI_TOOL_PATH_PLANNER_PANEL_H
Loading