From 41bdf63667446f01e96e279a15b08249400d5868 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 11 Sep 2021 10:27:56 +0900 Subject: [PATCH 1/3] update qt4 to qt5 for 20.04(noetic) --- baxter_sim_io/package.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/baxter_sim_io/package.xml b/baxter_sim_io/package.xml index 6937b2c..ef8dbeb 100644 --- a/baxter_sim_io/package.xml +++ b/baxter_sim_io/package.xml @@ -13,11 +13,11 @@ catkin roscpp - libqt4-dev + libqt5-dev baxter_core_msgs roscpp - libqt4-dev + libqt5-dev baxter_core_msgs From 4a61895c72d2fe8ff25dbcf6b715a76a49f62034 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 11 Sep 2021 10:30:13 +0900 Subject: [PATCH 2/3] update qt4 to qt5 for 20.04(noetic) use find_package(Qt5Widgets) instaed of find_pakcage(Qt4) https://www.kdab.com/using-cmake-with-qt-5/ remove include(QT_USE_FILE), add qt5_use_modules() https://stackoverflow.com/questions/28252909/cmake-and-qt5-include-only-takes-one-argumenthttps://stackoverflow.com/questions/28252909/cmake-and-qt5-include-only-takes-one-argument use QtWidgets instead of QtGui https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5 --- baxter_sim_io/CMakeLists.txt | 13 +++++++------ baxter_sim_io/include/baxter_sim_io/baxter_io.hpp | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/baxter_sim_io/CMakeLists.txt b/baxter_sim_io/CMakeLists.txt index ac596f7..dafe135 100644 --- a/baxter_sim_io/CMakeLists.txt +++ b/baxter_sim_io/CMakeLists.txt @@ -12,7 +12,7 @@ project(baxter_sim_io) # qt_build provides the qt cmake glue, roscpp the comms for a default talker #find_package(catkin REQUIRED COMPONENTS qt_build roscpp baxter_core_msgs) find_package(catkin REQUIRED COMPONENTS roscpp baxter_core_msgs) -find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui) +find_package(Qt5Widgets) include_directories(${catkin_INCLUDE_DIRS}) # Use this to define what the package will export (e.g. libs, headers). # Since the default here is to produce only a binary, we don't worry about @@ -38,16 +38,15 @@ include_directories(include ############################################################################## # Sections ############################################################################## -include(${QT_USE_FILE}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui) file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc) file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/baxter_sim_io/*.hpp) -QT4_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES}) -QT4_WRAP_UI(QT_FORMS_HPP ${QT_FORMS}) -QT4_WRAP_CPP(QT_MOC_HPP ${QT_MOC}) +QT5_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES}) +QT5_WRAP_UI(QT_FORMS_HPP ${QT_FORMS}) +QT5_WRAP_CPP(QT_MOC_HPP ${QT_MOC}) ############################################################################## # Sources @@ -60,7 +59,9 @@ file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINK ############################################################################## add_executable(baxter_sim_io ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP}) -target_link_libraries(baxter_sim_io ${QT_LIBRARIES} ${ROS_LIBRARIES} ${catkin_LIBRARIES}) +target_link_libraries(baxter_sim_io ${ROS_LIBRARIES} ${catkin_LIBRARIES}) + +qt5_use_modules(baxter_sim_io Widgets) add_dependencies(baxter_sim_io baxter_core_msgs_gencpp) diff --git a/baxter_sim_io/include/baxter_sim_io/baxter_io.hpp b/baxter_sim_io/include/baxter_sim_io/baxter_io.hpp index 5e72d24..b06d307 100644 --- a/baxter_sim_io/include/baxter_sim_io/baxter_io.hpp +++ b/baxter_sim_io/include/baxter_sim_io/baxter_io.hpp @@ -35,7 +35,7 @@ #ifndef BAXTER_SIM_IO_BAXTER_IO_H #define BAXTER_SIM_IO_BAXTER_IO_H -#include +#include #include #include #include "ui_baxter_io.h" From 97e6788d73e6429874166e0da0693faacaa17c9f Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 11 Sep 2021 10:46:34 +0900 Subject: [PATCH 3/3] use CV::IMREAD_UNCHANGED https://stackoverflow.com/questions/28534070/cv-load-image-unchanged-undeclared-identifier --- baxter_sim_hardware/src/baxter_emulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baxter_sim_hardware/src/baxter_emulator.cpp b/baxter_sim_hardware/src/baxter_emulator.cpp index 4b51f47..c402e6b 100644 --- a/baxter_sim_hardware/src/baxter_emulator.cpp +++ b/baxter_sim_hardware/src/baxter_emulator.cpp @@ -318,7 +318,7 @@ void baxter_emulator::publish(const std::string &img_path) { // Read OpenCV Mat image and convert it to ROS message cv_bridge::CvImagePtr cv_ptr(new cv_bridge::CvImage); try { - cv_ptr->image = cv::imread(img_path, CV_LOAD_IMAGE_UNCHANGED); + cv_ptr->image = cv::imread(img_path, cv::IMREAD_UNCHANGED); if (cv_ptr->image.data) { cv_ptr->encoding = sensor_msgs::image_encodings::BGR8; sleep(IMG_LOAD_ON_STARTUP_DELAY); // Wait for the model to load