From 926dc21f34ada7774623cd1b989818a258745616 Mon Sep 17 00:00:00 2001 From: Dave Coleman Date: Tue, 13 Aug 2019 17:53:20 -0600 Subject: [PATCH] Fix deprecation issues, rename func publishMarkersWithoutTrigger() - Switch to C++14 deprecation approach --- include/rviz_visual_tools/deprecation.h | 51 ------------------- include/rviz_visual_tools/rviz_visual_tools.h | 16 ++++-- src/rviz_visual_tools.cpp | 9 ++-- 3 files changed, 14 insertions(+), 62 deletions(-) delete mode 100644 include/rviz_visual_tools/deprecation.h diff --git a/include/rviz_visual_tools/deprecation.h b/include/rviz_visual_tools/deprecation.h deleted file mode 100644 index 33a07ba..0000000 --- a/include/rviz_visual_tools/deprecation.h +++ /dev/null @@ -1,51 +0,0 @@ -/********************************************************************* - * Software License Agreement (BSD License) - * - * Copyright (c) 2012, Willow Garage, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Willow Garage nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *********************************************************************/ - -#ifndef RVIZ_VISUAL_TOOLS_DEPRECATION_H -#define RVIZ_VISUAL_TOOLS_DEPRECATION_H - -/** \def RVIZ_VISUAL_TOOLS_DEPRECATED - Macro that marks functions as deprecated */ - -#ifdef __GNUC__ -#define RVIZ_VISUAL_TOOLS_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) -#define RVIZ_VISUAL_TOOLS_DEPRECATED __declspec(deprecated) -#elif defined(__clang__) -#define RVIZ_VISUAL_TOOLS_DEPRECATED __attribute__((deprecated("Use of this method is deprecated"))) -#else -#define RVIZ_VISUAL_TOOLS_DEPRECATED /* Nothing */ -#endif - -#endif // RVIZ_VISUAL_TOOLS_DEPRECATION_H diff --git a/include/rviz_visual_tools/rviz_visual_tools.h b/include/rviz_visual_tools/rviz_visual_tools.h index b6abd98..ff3a7e4 100644 --- a/include/rviz_visual_tools/rviz_visual_tools.h +++ b/include/rviz_visual_tools/rviz_visual_tools.h @@ -66,7 +66,6 @@ #include // rviz_visual_tools -#include #include // Import/export for windows dll's and visibility for gcc shared libraries. @@ -399,10 +398,16 @@ class RvizVisualTools /** * \brief Display an array of markers, allows reuse of the ROS publisher - * \param markers + * This will automatically call publish(), skipping the need for trigger() + * \param markers: array of visualizations to display in Rviz * \return true on success */ - bool publishMarkers(visualization_msgs::MarkerArray& markers); + bool publishMarkersWithoutTrigger(visualization_msgs::MarkerArray& markers); + // TODO(davetcoleman): Deprecated August 2019, remove in 1 year + [[deprecated]] bool publishMarkers(visualization_msgs::MarkerArray& markers) + { + publishMarkersWithoutTrigger(markers); + } /** * \brief Display a cone of a given angle along the x-axis @@ -647,14 +652,15 @@ class RvizVisualTools const std::vector& colors, const geometry_msgs::Vector3& scale); /** - * \brief Display a series of connected lines using the LINE_STRIP method - deprecated because visual bugs + * \brief Display a series of connected lines using the LINE_STRIP method * \param path - a series of points to connect with lines * \param color - an enum pre-defined name of a color * \param scale - an enum pre-defined name of a size * \param ns - namespace of marker * \return true on success */ - bool publishLineStrip(const std::vector& path, colors color = RED, scales scale = MEDIUM, + // TODO(davetcoleman): deprecated August 2019 because visual bugs + [[deprecated]] bool publishLineStrip(const std::vector& path, colors color = RED, scales scale = MEDIUM, const std::string& ns = "Path"); /** diff --git a/src/rviz_visual_tools.cpp b/src/rviz_visual_tools.cpp index d05cd4a..27203e4 100644 --- a/src/rviz_visual_tools.cpp +++ b/src/rviz_visual_tools.cpp @@ -53,9 +53,6 @@ namespace rviz_visual_tools { const std::string LOGNAME = "visual_tools"; -// DEPRECATED, remove in Melodic after Dec 2018 release or so -const std::string RvizVisualTools::name_ = "visual_tools"; - const std::array RvizVisualTools::all_rand_colors_ = { RED, GREEN, BLUE, GREY, DARK_GREY, WHITE, ORANGE, YELLOW, BROWN, PINK, LIME_GREEN, PURPLE, CYAN, MAGENTA }; @@ -101,7 +98,7 @@ bool RvizVisualTools::loadRvizMarkers() reset_marker_.header.frame_id = base_frame_; reset_marker_.header.stamp = ros::Time(); reset_marker_.ns = "deleteAllMarkers"; // helps during debugging - reset_marker_.action = 3; // TODO(davetcoleman): In ROS-J set to visualization_msgs::Marker::DELETEALL; + reset_marker_.action = visualization_msgs::Marker::DELETEALL; reset_marker_.pose.orientation.w = 1; // Load arrow ---------------------------------------------------- @@ -871,13 +868,13 @@ bool RvizVisualTools::trigger() return false; } - bool result = publishMarkers(markers_); + bool result = publishMarkersWithoutTrigger(markers_); markers_.markers.clear(); // remove all cached markers return result; } -bool RvizVisualTools::publishMarkers(visualization_msgs::MarkerArray& markers) +bool RvizVisualTools::publishMarkersWithoutTrigger(visualization_msgs::MarkerArray& markers) { if (pub_rviz_markers_ == nullptr) { // always check this before publishing