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

Add RvizGui and KeyTool #48

Merged
merged 1 commit into from Nov 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
91 changes: 80 additions & 11 deletions CMakeLists.txt
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 2.8.3)
project(rviz_visual_tools)

# C++ 11
add_definitions(-std=c++11)

# Warnings
Expand All @@ -12,7 +11,6 @@ add_definitions(-W -Wall -Wextra
-Wno-unused-parameter -Wno-unused-function)

find_package(catkin REQUIRED COMPONENTS
cmake_modules
eigen_conversions
geometry_msgs
graph_msgs
Expand All @@ -24,14 +22,44 @@ find_package(catkin REQUIRED COMPONENTS
visualization_msgs
roslint
eigen_stl_containers
rviz
sensor_msgs
)

find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED thread system)

# Qt 4 or 5
if(rviz_QT_VERSION VERSION_LESS "5")
find_package(Qt4 ${rviz_QT_VERSION} REQUIRED QtCore QtGui)
include(${QT_USE_FILE})
macro(qt_wrap_ui)
qt4_wrap_ui(${ARGN})
endmacro()
macro(qt_wrap_cpp)
qt4_wrap_cpp(${ARGN})
endmacro()
else()
find_package(Qt5 ${rviz_QT_VERSION} REQUIRED Core Widgets)
set(QT_LIBRARIES Qt5::Widgets)
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(qt_wrap_cpp)
qt5_wrap_cpp(${ARGN})
endmacro()
endif()
## Prefer the Qt signals and slots to avoid defining "emit", "slots",
## etc because they can conflict with boost signals, so define QT_NO_KEYWORDS here.
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
add_definitions(-DQT_NO_KEYWORDS)

catkin_package(
LIBRARIES
${PROJECT_NAME}
${PROJECT_NAME}_gui
${PROJECT_NAME}_remote_control
CATKIN_DEPENDS
eigen_conversions
geometry_msgs
Expand All @@ -40,7 +68,9 @@ catkin_package(
std_msgs
tf_conversions
trajectory_msgs
INCLUDE_DIRS include
sensor_msgs
INCLUDE_DIRS
include
)

include_directories(SYSTEM ${EIGEN3_INCLUDE_DIRS})
Expand All @@ -54,21 +84,42 @@ include_directories(
## Build ##
###########

## specify which header files need to be run through "moc",
## Qt's meta-object compiler.
qt_wrap_cpp(MOC_FILES
src/rviz_visual_tools_gui.h
src/key_tool.h
)

## specify the list of source files, including the output of
## the previous command which is stored in ``${MOC_FILES}``.
set(SOURCE_FILES
src/rviz_visual_tools_gui.cpp
src/key_tool.cpp
)

# Rviz GUI library
add_library(${PROJECT_NAME}_gui ${SOURCE_FILES} src/remote_control.cpp)
target_link_libraries(${PROJECT_NAME}_gui ${rviz_DEFAULT_PLUGIN_LIBRARIES} ${QT_LIBRARIES} ${catkin_LIBRARIES})

# Remote control library
add_library(${PROJECT_NAME}_remote_control src/remote_control.cpp)
target_link_libraries(${PROJECT_NAME}_remote_control ${catkin_LIBRARIES})

# Visualization Tools Library
add_library(${PROJECT_NAME}
src/rviz_visual_tools.cpp
src/tf_visual_tools.cpp
)

add_dependencies(${PROJECT_NAME} graph_msgs_generate_messages_cpp)

target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES} ${Boost_LIBRARIES}
${PROJECT_NAME}_remote_control
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)

# Demo executable
add_executable(rviz_visual_tools_demo src/rviz_visual_tools_demo.cpp)
target_link_libraries(rviz_visual_tools_demo
add_executable(${PROJECT_NAME}_demo src/rviz_visual_tools_demo.cpp)
target_link_libraries(${PROJECT_NAME}_demo
${catkin_LIBRARIES} ${PROJECT_NAME}
)

Expand All @@ -95,12 +146,30 @@ roslint_cpp()
#############

# Install libraries
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
install(
TARGETS
${PROJECT_NAME}
${PROJECT_NAME}_gui
${PROJECT_NAME}_remote_control
LIBRARY DESTINATION
${CATKIN_PACKAGE_LIB_DESTINATION}
)

# Install header files
install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})

# Install shared resources
install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY resources DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

# Install xml plugin config
install(FILES
plugin_description.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

# Install executables
install(TARGETS ${PROJECT_NAME}_demo
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
54 changes: 44 additions & 10 deletions README.md
Expand Up @@ -2,10 +2,12 @@

**Note: a recent change (Sept 28, 2016) requires that all publishing must now be triggered by ``trigger()``**

C++ API wrapper for displaying shapes and meshes in Rviz via helper functions that publish markers. Useful for displaying and debugging data. For more advanced robot visualization features, see the [moveit_visual_tools](https://github.com/davetcoleman/moveit_visual_tools) which builds on this class, or [ompl_visual_tools](https://github.com/davetcoleman/ompl_visual_tools/) if you are an OMPL ROS user.
C++ API wrapper for displaying shapes and meshes in Rviz via helper functions that publish markers. Useful for displaying and debugging data. For more advanced robot visualization features, see the [moveit_visual_tools](https://github.com/davetcoleman/moveit_visual_tools) which builds on this class.

This package includes:

- Rviz Panel GUI to step through your code for debugging and testing
- Rviz-based keyboard control for stepping through application
- Easy to use helper functions for visualizing in Rviz fast
- Basic geometric markers for Rviz
- More complex geometric shapes such as coordinate frames, framed boxes, planes, paths, graphs
Expand All @@ -18,8 +20,8 @@ This package includes:
Developed by [Dave Coleman](http://dav.ee) at the Correll Robotics Lab, University of Colorado Boulder with help from Andy McEvoy and many others.

* [![Build Status](https://travis-ci.org/davetcoleman/rviz_visual_tools.svg)](https://travis-ci.org/davetcoleman/rviz_visual_tools) Travis CI
* [![Build Status](http://build.ros.org/buildStatus/icon?job=Jsrc_uT__rviz_visual_tools__ubuntu_trusty__source)](http://build.ros.org/view/Jsrc_uT/job/Jsrc_uT__rviz_visual_tools__ubuntu_trusty__source/) ROS Buildfarm - Trusty Devel Source Build
* [![Build Status](http://build.ros.org/buildStatus/icon?job=Jbin_uT64__rviz_visual_tools__ubuntu_trusty_amd64__binary)](http://build.ros.org/view/Jbin_uT64/job/Jbin_uT64__rviz_visual_tools__ubuntu_trusty_amd64__binary/) ROS Buildfarm - AMD64 Trusty Debian Build
* [![Build Status](http://build.ros.org/buildStatus/icon?job=Kbin_uX64__rviz_visual_tools__ubuntu_xenial_amd64__binary)](http://build.ros.org/view/Kbin_uX64/job/Kbin_uX64__rviz_visual_tools__ubuntu_xenial_amd64__binary/) ROS Buildfarm - AMD64 Xenial Debian Build
* [![Build Status](http://build.ros.org/buildStatus/icon?job=Kdev__rviz_visual_tools__ubuntu_xenial_amd64)](http://build.ros.org/view/Kdev/job/Kdev__rviz_visual_tools__ubuntu_xenial_amd64/) ROS Buildfarm - AMD64 Xenial Debian Build

![](resources/screenshot.png)

Expand Down Expand Up @@ -98,9 +100,38 @@ In the following snippet we create a pose at xyz (0.1, 0.1, 0.1) and rotate the
// Don't forget to trigger the publisher!
visual_tools_->trigger();

## Rviz GUI Usage

Publishes on the topic of ``/rviz_visual_tools_gui``

The buttons in the [Joy](http://docs.ros.org/api/sensor_msgs/html/msg/Joy.html) message correspond to the following:

```
1 - Next
2 - Continue
3 - Break
4 - Stop
```

Note: only Next is fully implemented

### Mouse-Based Control

![](resources/dashboard_screenshot.png)

Use the Rviz panel called "RvizVisualToolsGui" to step through your program.

### Keyboard-Based Control

![](resources/keytool_screenshot.png)

Switch to the "KeyTool" in the top of the Rviz window and used keyboard commands "n" and "a" for next and auto, respectively.

## API

### Basic Publishing Functions

See ``visual_tools.h`` for more details and documentation on the following functions:
See ``rviz_visual_tools.h`` for more details and documentation on the following functions:

- publishSphere
- publishSpheres
Expand Down Expand Up @@ -132,7 +163,7 @@ And more...

Reset function

- ``deleteAllMarkers`` - tells Rviz to clear out all current markers from being displayed.
- ``deleteAllMarkers()`` - tells Rviz to clear out all current markers from being displayed.

All markers must be triggered after being published, by calling the ``trigger()`` function. This allows batch publishing to be achieved by only calling after several markers have been created, greatly increasing the speed of your application. You can even explicitly tell ``rviz_visual_tools`` how often to publish via the ``triggerEvery(NUM_MARKERS)`` command:

Expand Down Expand Up @@ -187,16 +218,17 @@ This package helps you quickly choose colors - feel free to send PRs with more c

### Available Marker Sizes

XXXXSMALL,
XXXSMALL,
XXSMALL,
XSMALL,
SMALL,
REGULAR,
MEDIUM,
LARGE,
xLARGE,
xxLARGE,
xxxLARGE,
XLARGE,
XXLARGE
XXLARGE,
XXXLARGE,
XXXXLARGE,

## TF Visual Tools

Expand All @@ -206,6 +238,8 @@ This tool lets you easily debug Eigen transforms in Rviz. Demo use:
Eigen::Affine3d world_to_shelf_transform = Eigen::Affine3d::Identity(); // or whatever value
tf_visualizer.publishTransform(world_to_shelf_transform, "world", "shelf");

*Note: this is a work in progress*

## Testing and Linting

To run [roslint](http://wiki.ros.org/roslint), use the following command with [catkin-tools](https://catkin-tools.readthedocs.org/):
Expand Down
40 changes: 40 additions & 0 deletions icons/classes/KeyTool.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.