Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Takayuki Murooka <[email protected]>
  • Loading branch information
takayuki5168 committed Dec 24, 2024
1 parent 982b641 commit 7bc1d17
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,116 +2,27 @@ cmake_minimum_required(VERSION 3.8)
project(autoware_string_stamped_rviz_plugin)

# find dependencies
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
find_package(autoware_cmake REQUIRED)
autoware_package()

set(headers_to_moc
include/signal_display.hpp
)

set(headers_to_not_moc
include/steering_wheel_display.hpp
include/gear_display.hpp
include/speed_display.hpp
include/turn_signals_display.hpp
include/traffic_display.hpp
include/speed_limit_display.hpp
)


foreach(header "${headers_to_moc}")
qt5_wrap_cpp(display_moc_files "${header}")
endforeach()

set(display_source_files
src/overlay_utils.cpp
src/signal_display.cpp
src/steering_wheel_display.cpp
src/gear_display.cpp
src/speed_display.cpp
src/turn_signals_display.cpp
src/traffic_display.cpp
src/speed_limit_display.cpp
)

add_library(${PROJECT_NAME} SHARED
${display_moc_files}
${headers_to_not_moc}
${display_source_files}
)

set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic)
find_package(Qt5 REQUIRED Core Widgets)
set(QT_LIBRARIES Qt5::Widgets)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-DQT_NO_KEYWORDS)

target_include_directories(
${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
${Qt5Widgets_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
ament_auto_add_library(${PROJECT_NAME}_lib SHARED
DIRECTORY src
)

target_link_libraries(
${PROJECT_NAME} PUBLIC
rviz_ogre_vendor::OgreMain
rviz_ogre_vendor::OgreOverlay
target_link_libraries(${PROJECT_NAME}_lib
${QT_LIBRARIES}
)


target_compile_definitions(${PROJECT_NAME} PRIVATE "${PROJECT_NAME}_BUILDING_LIBRARY")

# prevent pluginlib from using boost
target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")

# Export the plugin to be imported by rviz2
pluginlib_export_plugin_description_file(rviz_common plugins_description.xml)

ament_target_dependencies(${PROJECT_NAME} PUBLIC
rviz_common
rviz_rendering
autoware_vehicle_msgs
tier4_planning_msgs
autoware_perception_msgs
)

ament_export_include_directories(include)
ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(
rviz_common
rviz_ogre_vendor
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

install(
DIRECTORY include/
DESTINATION include
)

install(
TARGETS
DESTINATION lib/${PROJECT_NAME}
)

# Copy the assets directory to the installation directory
install(
DIRECTORY assets/
DESTINATION share/${PROJECT_NAME}/assets
)

add_definitions(-DQT_NO_KEYWORDS)

ament_package(
CONFIG_EXTRAS "autoware_string_stamped_rviz_plugin-extras.cmake"
ament_auto_package(
INSTALL_TO_SHARE
plugins_description.xml
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
<license>BSD-3-Clause</license>

<depend>ament_index_cpp</depend>
<depend>autoware_internal_debug_msgs</depend>
<depend>autoware_perception_msgs</depend>
<depend>autoware_vehicle_msgs</depend>
<depend>boost</depend>
<depend>rviz_common</depend>
<depend>rviz_ogre_vendor</depend>
<depend>rviz_rendering</depend>
<depend>tier4_planning_msgs</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<library path="autoware_string_stamped_rviz_plugin">
<class name="autoware_string_stamped_rviz_plugin/StringStampedOverlayDisplay" type="autoware_string_stamped_rviz_plugin::StringStampedOverlayDisplay" base_class_type="rviz_common::Display">
<class name="autoware_string_stamped_rviz_plugin/StringStampedOverlayDisplay" type="autoware::string_stamped_rviz_plugin::StringStampedOverlayDisplay" base_class_type="rviz_common::Display">
<description>String staped overlay plugin for the 3D view.</description>

Check warning on line 3 in visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/plugins_description.xml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (staped)
</class>
</library>
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
// POSSIBILITY OF SUCH DAMAGE.S SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#include "jsk_overlay_utils.hpp"
#include "string_stamped_overlay_display.hpp"

#include "jsk_overlay_utils.hpp"

#include <QPainter>
#include <rviz_common/uniform_string_stream.hpp>

Expand All @@ -58,7 +59,7 @@
#include <string>
#include <vector>

namespace rviz_plugins
namespace autoware::string_stamped_rviz_plugin
{
StringStampedOverlayDisplay::StringStampedOverlayDisplay()
{
Expand Down Expand Up @@ -169,7 +170,7 @@ void StringStampedOverlayDisplay::update(float wall_dt, float ros_dt)
}

void StringStampedOverlayDisplay::processMessage(
const tier4_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr)
const autoware_internal_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr)
{
if (!isEnabled()) {
return;
Expand All @@ -191,7 +192,8 @@ void StringStampedOverlayDisplay::updateVisualization()
overlay_->setDimensions(overlay_->getTextureWidth(), overlay_->getTextureHeight());
}

} // namespace rviz_plugins
} // namespace autoware::string_stamped_rviz_plugin

#include <pluginlib/class_list_macros.hpp>
PLUGINLIB_EXPORT_CLASS(rviz_plugins::StringStampedOverlayDisplay, rviz_common::Display)
PLUGINLIB_EXPORT_CLASS(
autoware::string_stamped_rviz_plugin::StringStampedOverlayDisplay, rviz_common::Display)
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
// POSSIBILITY OF SUCH DAMAGE.S SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#ifndef STRING_STAMPED_HPP_
#define STRING_STAMPED_HPP_
#ifndef STRING_STAMPED_OVERLAY_DISPLAY_HPP_
#define STRING_STAMPED_OVERLAY_DISPLAY_HPP_

#include <memory>
#include <mutex>
Expand All @@ -61,12 +61,12 @@

#endif

#include <tier4_debug_msgs/msg/string_stamped.hpp>
#include <autoware_internal_debug_msgs/msg/string_stamped.hpp>

namespace rviz_plugins
namespace autoware::string_stamped_rviz_plugin
{
class StringStampedOverlayDisplay
: public rviz_common::RosTopicDisplay<tier4_debug_msgs::msg::StringStamped>
: public rviz_common::RosTopicDisplay<autoware_internal_debug_msgs::msg::StringStamped>

{
Q_OBJECT
Expand All @@ -84,7 +84,8 @@ private Q_SLOTS:

protected:
void update(float wall_dt, float ros_dt) override;
void processMessage(const tier4_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr) override;
void processMessage(
const autoware_internal_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr) override;
jsk_rviz_plugins::OverlayObject::Ptr overlay_;
rviz_common::properties::ColorProperty * property_text_color_;
rviz_common::properties::IntProperty * property_left_;
Expand All @@ -100,8 +101,8 @@ private Q_SLOTS:
static constexpr int hand_width_ = 4;

std::mutex mutex_;
tier4_debug_msgs::msg::StringStamped::ConstSharedPtr last_msg_ptr_;
autoware_internal_debug_msgs::msg::StringStamped::ConstSharedPtr last_msg_ptr_;
};
} // namespace rviz_plugins
} // namespace autoware::string_stamped_rviz_plugin

#endif // STRING_STAMPED_HPP_
#endif // STRING_STAMPED_OVERLAY_DISPLAY_HPP_

0 comments on commit 7bc1d17

Please sign in to comment.