ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

kinetic : rviz segfaults when loading panel

asked 2016-05-06 13:40:23 -0600

inflo gravatar image

updated 2016-05-09 05:45:07 -0600

hi, i use ubuntu 16.04 and kinetic kame, when i run rosrun rviz rviz all runs well, but when i try to load a rviz plugin which adds a panel, it crashes and tells segmention fault ?

i changed CMakeListst.txt to support Qt5 , here the CMakeListst.txt file:

cmake_minimum_required(VERSION 2.8.3)
project(flobotics_finger_rviz_controller)


find_package(catkin REQUIRED COMPONENTS
  roscpp
  rviz
  flobotics_finger_messages
)

## This plugin includes Qt widgets, so we must include Qt.
## We'll use the version that rviz used so they are compatible.
if(rviz_QT_VERSION VERSION_LESS "5")
  message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
  find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
  ## pull in all required include dirs, define QT_LIBRARIES, etc.
  include(${QT_USE_FILE})
else()
  message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
  find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets)
  ## make target_link_libraries(${QT_LIBRARIES}) pull in all required dependencies
  set(QT_LIBRARIES Qt5::Widgets)
endif()

add_definitions(-DQT_NO_KEYWORDS)



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

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
  include/flobotics_finger_rviz_controller/
  include/flobotics_finger_rviz_servo_controller/
  ${catkin_INCLUDE_DIRS}
)


set(SRC_FILES
  src/flobotics_finger_rviz_controller.cpp
  src/flobotics_finger_rviz_servo_controller.cpp
 )

add_library(${PROJECT_NAME} ${SRC_FILES}) 

## Specify libraries to link a library or executable target against
 target_link_libraries(${PROJECT_NAME}
   ${QT_LIBRARIES}
   ${catkin_LIBRARIES}
 )

when i then run catkin_make, it tells me: -- Using Qt5 based on the rviz_QT_VERSION: 5.5.1 but then errors following, like:

In file included from /home/ros/catkin_ws/src/flobotics_finger_rviz_controller/src/flobotics_finger_rviz_servo_controller.cpp:3:0:
/home/ros/catkin_ws/src/flobotics_finger_rviz_controller/include/flobotics_finger_rviz_servo_controller/flobotics_finger_rviz_servo_controller.h:18:1: error: ‘signals’ does not name a type
 signals:
 ^
/home/ros/catkin_ws/src/flobotics_finger_rviz_controller/include/flobotics_finger_rviz_servo_controller/flobotics_finger_rviz_servo_controller.h:22:5: error: ‘QVBoxLayout’ does not name a type
     QVBoxLayout* _vbox;
     ^

I tried to include #include <qvboxlayout> but nothing changed

i think it has something todo with the qt5 install on ubuntu 16.04 ? if i look at /usr/include/ there is only a qt4 dir, in /usr/share/ is a qt5 directory.

i run qtchooser -qt=qt5

but nothing changed.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
4

answered 2016-05-06 14:53:51 -0600

William gravatar image

This isn't enough information to help you (it could segfault for many reasons). If you want to provide more information edit your question (don't post a new answer) please.

A theory as to why it crashes is that rviz uses Qt5 in Kinetic. I don't know what you mean by "panel", but I assume you mean a custom rviz plugin which adds a panel. Make sure your plugin is use Qt5 as well, otherwise it can crash (due to mixing Qt4 and Qt5 runtimes).

For an example of how to make this change to a plugin see:

https://github.com/ros-visualization/...

This is the file as-is for Kinetic:

https://github.com/ros-visualization/...

edit flag offensive delete link more

Comments

I ran into the exact same problem and your explanation and provided links worked perfectly. I just upvoted your answer, thanks a bunch William!

Huibuh gravatar image Huibuh  ( 2016-07-06 07:32:41 -0600 )edit

Very useful information, the example CMakeLists is very detailed, great job :)

VictorLamoine gravatar image VictorLamoine  ( 2016-11-30 03:12:32 -0600 )edit

I have been trying to fix this problem for months. Thank you!

nmerrill67 gravatar image nmerrill67  ( 2017-06-15 20:04:48 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-05-06 13:40:23 -0600

Seen: 966 times

Last updated: May 09 '16