Skip to content

Commit

Permalink
Remove Old Distro Support (#62)
Browse files Browse the repository at this point in the history
* Cleaning up old distro support and removing build warnings
  • Loading branch information
danthony06 authored Sep 20, 2023
1 parent cdf1521 commit 36b88ba
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 60 deletions.
16 changes: 1 addition & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.10)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
endif()

if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_ID MATCHES "Clang")
Expand All @@ -12,7 +12,6 @@ project(swri_console)

### ROS PACKAGES ###
find_package(ament_cmake REQUIRED)
# find_package(rosbag_storage REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rcl_interfaces REQUIRED)

Expand All @@ -23,13 +22,6 @@ find_package(Qt5Widgets REQUIRED)

find_package(Boost COMPONENTS thread REQUIRED)

### Compile flag to support different versions of ROS ###
if($ENV{ROS_DISTRO} STRGREATER "foxy")
set(USE_NEW_QOS_DEFN 1)
else()
set(USE_NEW_QOS_DEFN 0)
endif()

set(CMAKE_INCLUDE_CURRENT_DIR ON)

include_directories(include)
Expand All @@ -38,7 +30,6 @@ set(UI_FILES
ui/console_window.ui)
set(HEADER_FILES
include/swri_console/bag_reader.h
include/swri_console/defines.h
include/swri_console/console_master.h
include/swri_console/console_window.h
include/swri_console/log_database.h
Expand Down Expand Up @@ -66,11 +57,6 @@ qt5_wrap_cpp(SRC_FILES ${HEADER_FILES})

add_executable(swri_console ${HEADER_FILES} ${SRC_FILES} ${RCC_SRCS} src/main.cpp)

target_compile_definitions(swri_console
PRIVATE
USE_NEW_QOS_DEFN=${USE_NEW_QOS_DEFN}
)

target_link_libraries(swri_console
Qt5::Core
Qt5::Gui
Expand Down
14 changes: 0 additions & 14 deletions include/swri_console/defines.h

This file was deleted.

1 change: 0 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>
<build_depend>libqt5-opengl-dev</build_depend>
<build_depend>ros_environment</build_depend>
<depend>libboost-thread-dev</depend>
<depend>libqt5-core</depend>
<depend>libqt5-gui</depend>
Expand Down
35 changes: 16 additions & 19 deletions src/console_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
#include <cstdio>
#include <set>

// #include <rosgraph_msgs/Log.h>
// #include <ros/master.h> // required for getURI, VCM 12 April 2017
#include <rclcpp/rclcpp.hpp>
#include <rcl_interfaces/msg/log.hpp>

Expand All @@ -42,7 +40,6 @@
#include <swri_console/log_database_proxy_model.h>
#include <swri_console/node_list_model.h>
#include <swri_console/settings_keys.h>
#include <swri_console/defines.h>

#include <QColorDialog>
#include <QRegExp>
Expand All @@ -55,16 +52,16 @@
#include <QMenu>
#include <QSettings>

// QString::SkipEmptyParts was deprecated in favor of Qt::SkipEmptyParts in
// Qt 5.14.0
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
#define SPLIT_FLAG (Qt::SkipEmptyParts)
#else
#define SPLIT_FLAG (QString::SkipEmptyParts)
#endif

using namespace Qt;

namespace log_level_mask {
static constexpr uint8_t DEBUG = 1 << 0;
static constexpr uint8_t INFO = 1 << 1;
static constexpr uint8_t WARN = 1 << 2;
static constexpr uint8_t ERROR = 1 << 3;
static constexpr uint8_t FATAL = 1 << 4;
};

namespace swri_console {

ConsoleWindow::ConsoleWindow(LogDatabase *db)
Expand Down Expand Up @@ -275,7 +272,7 @@ void ConsoleWindow::nodeSelectionChanged()
db_proxy_->setNodeFilter(nodes);

for (int i = 0; i < node_names.size(); i++) {
node_names[i] = node_names[i].split("/", SPLIT_FLAG).last();
node_names[i] = node_names[i].split("/", Qt::SkipEmptyParts).last();
}

setWindowTitle(QString("SWRI Console (") + node_names.join(", ") + ")");
Expand All @@ -286,19 +283,19 @@ void ConsoleWindow::setSeverityFilter()
uint8_t mask = 0;

if (ui.checkDebug->isChecked()) {
mask |= LogLevelMask::DEBUG;
mask |= log_level_mask::DEBUG;
}
if (ui.checkInfo->isChecked()) {
mask |= LogLevelMask::INFO;
mask |= log_level_mask::INFO;
}
if (ui.checkWarn->isChecked()) {
mask |= LogLevelMask::WARN;
mask |= log_level_mask::WARN;
}
if (ui.checkError->isChecked()) {
mask |= LogLevelMask::ERROR;
mask |= log_level_mask::ERROR;
}
if (ui.checkFatal->isChecked()) {
mask |= LogLevelMask::FATAL;
mask |= log_level_mask::FATAL;
}

QSettings settings;
Expand Down Expand Up @@ -394,7 +391,7 @@ void ConsoleWindow::setFollowNewest(bool follow)

void ConsoleWindow::includeFilterUpdated(const QString &text)
{
QStringList items = text.split(";", SPLIT_FLAG);
QStringList items = text.split(";", Qt::SkipEmptyParts);
QStringList filtered;

for (int i = 0; i < items.size(); i++) {
Expand All @@ -412,7 +409,7 @@ void ConsoleWindow::includeFilterUpdated(const QString &text)

void ConsoleWindow::excludeFilterUpdated(const QString &text)
{
QStringList items = text.split(";", SPLIT_FLAG);
QStringList items = text.split(";", Qt::SkipEmptyParts);
QStringList filtered;

for (int i = 0; i < items.size(); i++) {
Expand Down
11 changes: 0 additions & 11 deletions src/ros_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,7 @@ void RosThread::emptyLogQueue(rcl_interfaces::msg::Log::ConstSharedPtr msg)

rclcpp::QoS RosThread::getQos()
{
#if USE_NEW_QOS_DEFN == 0
// Foxy does not have a rosout QoS profile, so we copy the initialization from
// rclc/logging_rosout.c
auto qos_profile = rmw_qos_profile_default;
qos_profile.depth = 1000;
qos_profile.durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
qos_profile.lifespan.sec = 10;
qos_profile.lifespan.nsec = 0;
return rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(qos_profile));
#else
// Humble and on can use the same QoS as the standard rosout config
return rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rcl_qos_profile_rosout_default));
#endif
}
}

0 comments on commit 36b88ba

Please sign in to comment.