From ec04b533722a3c2abb8e20bfa7c3de47dcdd73c5 Mon Sep 17 00:00:00 2001 From: "Prof. Lee" Date: Sat, 22 Jan 2022 10:37:44 -0500 Subject: [PATCH 1/4] Compile and run natively in Noetic/Qt5 Updates to the build and configuration files to allow the STDR Simulator to work in Noetic and Qt5 have been created. Minor alterations to code were needed to accommodate the different locations of some Qt header files. Some code was altered to remove the accommodating UTF8 coding as it is now default. Finally, an alteration was necessary to accommodate the new way timers in Qt work. This update also fixes a bug in stdr_specifications.xml that prevented co2_sensors from working. --- stdr_gui/CMakeLists.txt | 24 ++++++---- stdr_gui/include/stdr_gui/stdr_tools.h | 47 ++++++++++--------- stdr_gui/package.xml | 10 +++- stdr_gui/src/stdr_gui/stdr_gui_controller.cpp | 10 +++- .../stdr_robot_creator_connector.cpp | 21 +++------ .../specifications/stdr_specifications.xml | 2 +- 6 files changed, 65 insertions(+), 49 deletions(-) diff --git a/stdr_gui/CMakeLists.txt b/stdr_gui/CMakeLists.txt index 6e4ce682..cebf6535 100644 --- a/stdr_gui/CMakeLists.txt +++ b/stdr_gui/CMakeLists.txt @@ -17,15 +17,16 @@ include_directories( include ${catkin_INCLUDE_DIRS} ) -find_package(Qt4 REQUIRED COMPONENTS - QtCore - QtGui - QtUiTools +find_package(Qt5 REQUIRED COMPONENTS + Core + Gui + UiTools + Widgets ) ADD_DEFINITIONS(-DQT_NO_KEYWORDS) -include(${QT_USE_FILE}) +#include(${QT_USE_FILE}) include_directories( ${CMAKE_CURRENT_BINARY_DIR} @@ -33,7 +34,10 @@ include_directories( catkin_package( DEPENDS - QT + Qt5Core + Qt5Gui + Qt5UiTools + Qt5Widgets CATKIN_DEPENDS roscpp roslib @@ -44,6 +48,7 @@ catkin_package( stdr_parser sensor_msgs nav_msgs + qt_gui_cpp #INCLUDE_DIRS #LIBRARIES ) @@ -60,7 +65,7 @@ set(QT_FORMS ui/thermalSensorProperties.ui ui/soundSensorProperties.ui ) -QT4_WRAP_UI(QT_FORMS_HPP ${QT_FORMS}) +qt5_wrap_ui(QT_FORMS_HPP ${QT_FORMS}) QT_WRAP_CPP(stdr_gui_node SAMPLE_MOC_SRCS include/stdr_gui/stdr_gui_controller.h) QT_WRAP_CPP(stdr_gui_node SAMPLE_MOC_SRCS include/stdr_gui/stdr_gui_connector.h) @@ -115,7 +120,10 @@ add_executable(stdr_gui_node add_dependencies(stdr_gui_node ${stdr_msgs_EXPORTED_TARGETS}) # Wait for stdr_msgs to build target_link_libraries(stdr_gui_node ${catkin_LIBRARIES} - ${QT_LIBRARIES} + ${Qt5Core_LIBRARIES} + ${Qt5Gui_LIBRARIES} + ${Qt5UiTools_LIBRARIES} + ${Qt5Widgets_LIBRARIES} ) # Install launch files diff --git a/stdr_gui/include/stdr_gui/stdr_tools.h b/stdr_gui/include/stdr_gui/stdr_tools.h index 9ecd89e5..62629b7b 100644 --- a/stdr_gui/include/stdr_gui/stdr_tools.h +++ b/stdr_gui/include/stdr_gui/stdr_tools.h @@ -36,33 +36,34 @@ #include #include -#include -#include -#include -#include -#include +#include +#include + +#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stdr_gui/package.xml b/stdr_gui/package.xml index 11656142..b9152e52 100644 --- a/stdr_gui/package.xml +++ b/stdr_gui/package.xml @@ -26,8 +26,14 @@ sensor_msgs nav_msgs - libqt4-dev - libqt4 + libqt5-core + libqt5-gui + libqt5-widgets + qt_gui + libqt5-core + libqt5-gui + libqt5-widgets + qt_gui diff --git a/stdr_gui/src/stdr_gui/stdr_gui_controller.cpp b/stdr_gui/src/stdr_gui/stdr_gui_controller.cpp index 33e3d44b..43e8abf5 100644 --- a/stdr_gui/src/stdr_gui/stdr_gui_controller.cpp +++ b/stdr_gui/src/stdr_gui/stdr_gui_controller.cpp @@ -223,9 +223,12 @@ namespace stdr_gui this, SLOT(robotReplaceSet(QPoint,std::string))); timer_ = new QTimer(this); + connect( timer_, SIGNAL(timeout()), this, SLOT(updateMapInternal())); + + timer_->start(50); QObject::connect( this,SIGNAL(waitForRfidPose()), @@ -315,6 +318,7 @@ namespace stdr_gui this, SIGNAL(setSoundSensorVisibility(QString,QString,char)), &info_connector_, SLOT(setSoundSensorVisibility(QString,QString,char))); } + /** @brief Sets up the main window widgets @@ -517,7 +521,7 @@ namespace stdr_gui map_connector_.setMapInitialized(true); gui_connector_.setMapInitialized(true); - timer_->start(50); + // timer_->start(50); robot_subscriber_ = n_.subscribe( "stdr_server/active_robots", @@ -1005,6 +1009,10 @@ namespace stdr_gui **/ void CGuiController::updateMapInternal(void) { + if ( ! map_initialized_ ) + { + return; + } while(map_lock_) { usleep(100); diff --git a/stdr_gui/src/stdr_gui/stdr_robot_creator/stdr_robot_creator_connector.cpp b/stdr_gui/src/stdr_gui/stdr_robot_creator/stdr_robot_creator_connector.cpp index 5cd76430..17039220 100644 --- a/stdr_gui/src/stdr_gui/stdr_robot_creator/stdr_robot_creator_connector.cpp +++ b/stdr_gui/src/stdr_gui/stdr_robot_creator/stdr_robot_creator_connector.cpp @@ -1662,8 +1662,7 @@ namespace stdr_gui QApplication::translate( "Footprint point", item->text(0).toStdString().c_str(), - 0, - QApplication::UnicodeUTF8)); + 0)); current_footprint_point_ = item; @@ -1720,8 +1719,7 @@ namespace stdr_gui QApplication::translate( "LaserProperties", item->text(0).toStdString().c_str(), - 0, - QApplication::UnicodeUTF8)); + 0)); current_laser_ = item; @@ -2242,8 +2240,7 @@ namespace stdr_gui QApplication::translate( "SonarProperties", item->text(0).toStdString().c_str(), - 0, - QApplication::UnicodeUTF8)); + 0)); current_sonar_ = item; @@ -2287,8 +2284,7 @@ namespace stdr_gui QApplication::translate( "RfidAntennaProperties", item->text(0).toStdString().c_str(), - 0, - QApplication::UnicodeUTF8)); + 0)); current_rfid_ = item; @@ -2330,8 +2326,7 @@ namespace stdr_gui QApplication::translate( "CO2SensorProperties", item->text(0).toStdString().c_str(), - 0, - QApplication::UnicodeUTF8)); + 0)); current_co2_sensor_ = item; @@ -2370,8 +2365,7 @@ namespace stdr_gui QApplication::translate( "ThermalSensorProperties", item->text(0).toStdString().c_str(), - 0, - QApplication::UnicodeUTF8)); + 0)); current_thermal_sensor_ = item; @@ -2410,8 +2404,7 @@ namespace stdr_gui QApplication::translate( "SoundSensorProperties", item->text(0).toStdString().c_str(), - 0, - QApplication::UnicodeUTF8)); + 0)); current_sound_sensor_ = item; diff --git a/stdr_resources/resources/specifications/stdr_specifications.xml b/stdr_resources/resources/specifications/stdr_specifications.xml index 07479edf..c6e797e6 100644 --- a/stdr_resources/resources/specifications/stdr_specifications.xml +++ b/stdr_resources/resources/specifications/stdr_specifications.xml @@ -24,7 +24,7 @@ - initial_pose,footprint,laser,sonar,rfid_reader,kinematic + initial_pose,footprint,laser,sonar,rfid_reader,kinematic,co2_sensor From ce0d0d54e217f42942b56fd66df26ec87c3cdcdc Mon Sep 17 00:00:00 2001 From: "Prof. Lee" Date: Sat, 22 Jan 2022 11:39:23 -0500 Subject: [PATCH 2/4] Dependency fixes There was a typo in a dependency in CMakeLists.txt that missed the last commit. Also added a long overdue dependency on map_server. --- stdr_gui/CMakeLists.txt | 2 +- stdr_gui/package.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/stdr_gui/CMakeLists.txt b/stdr_gui/CMakeLists.txt index cebf6535..1520431c 100644 --- a/stdr_gui/CMakeLists.txt +++ b/stdr_gui/CMakeLists.txt @@ -48,7 +48,7 @@ catkin_package( stdr_parser sensor_msgs nav_msgs - qt_gui_cpp + qt_gui #INCLUDE_DIRS #LIBRARIES ) diff --git a/stdr_gui/package.xml b/stdr_gui/package.xml index b9152e52..ab95cb6a 100644 --- a/stdr_gui/package.xml +++ b/stdr_gui/package.xml @@ -34,6 +34,7 @@ libqt5-gui libqt5-widgets qt_gui + map_server From 61ccf79f310f9552b053fc67490a1a8be3301134 Mon Sep 17 00:00:00 2001 From: "Prof. Lee" Date: Sat, 22 Jan 2022 12:24:46 -0500 Subject: [PATCH 3/4] There was a race condition that may have been fixed A QTimer issues resulting from the update to Qt5 is being fixed. --- stdr_gui/src/stdr_gui/stdr_gui_controller.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdr_gui/src/stdr_gui/stdr_gui_controller.cpp b/stdr_gui/src/stdr_gui/stdr_gui_controller.cpp index 43e8abf5..69d15552 100644 --- a/stdr_gui/src/stdr_gui/stdr_gui_controller.cpp +++ b/stdr_gui/src/stdr_gui/stdr_gui_controller.cpp @@ -517,7 +517,7 @@ namespace stdr_gui elapsed_time_.start(); - map_initialized_ = true; + // map_initialized_ = true; map_connector_.setMapInitialized(true); gui_connector_.setMapInitialized(true); @@ -528,6 +528,7 @@ namespace stdr_gui 1, &CGuiController::receiveRobots, this); + map_initialized_ = true; } /** From 35c6d63cd105a0f5983bf9ba490fcb0ba07b043f Mon Sep 17 00:00:00 2001 From: leegs Date: Thu, 15 Sep 2022 09:56:17 -0400 Subject: [PATCH 4/4] Update .travis.yml First attempt at creating a file for the travis-ci test build for the repository. --- .travis.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 82410601..3121258d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,24 @@ # Stdr Simulator Travis Continuous Integration Configuration File # Author: Christos Zalidis +# Maintained: Greg Lee (CWRU) sudo: required -dist: trusty +dist: foxy language: generic compiler: - gcc notifications: email: recipients: - - etsardou@gmail.com - - zalidis@gmail.com - - aris.thallas@gmail.com + - leegs@case.edu on_success: change #[always|never|change] # default: change on_failure: change #[always|never|change] # default: always before_install: # Use this to prepare the system to install prerequisites or dependencies # Define some config vars - - export ROS_DISTRO=indigo + - export ROS_DISTRO=noetic - export CI_SOURCE_PATH=$(pwd) - export REPOSITORY_NAME=${PWD##*/} - echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME" - - sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list' + - sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu foxy main" > /etc/apt/sources.list.d/ros-latest.list' - wget http://packages.ros.org/ros.key -O - | sudo apt-key add - - sudo apt-get update -qq - sudo apt-get install -qq -y python-catkin-pkg python-rosdep python-wstool ros-$ROS_DISTRO-catkin ros-$ROS_DISTRO-ros