diff --git a/.github/workflows/spell-check-differential.yaml b/.github/workflows/spell-check-differential.yaml
deleted file mode 100644
index 1fbf2ff46925c..0000000000000
--- a/.github/workflows/spell-check-differential.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-name: spell-check-differential
-
-on:
- pull_request:
-
-jobs:
- spell-check-differential:
- runs-on: ubuntu-latest
- steps:
- - name: Check out repository
- uses: actions/checkout@v4
-
- - name: Run spell-check
- uses: autowarefoundation/autoware-github-actions/spell-check@v1
- with:
- cspell-json-url: https://raw.githubusercontent.com/tier4/autoware-spell-check-dict/main/.cspell.json
diff --git a/common/autoware_auto_perception_rviz_plugin/package.xml b/common/autoware_auto_perception_rviz_plugin/package.xml
index c1ad3e3df140e..2033239824d95 100644
--- a/common/autoware_auto_perception_rviz_plugin/package.xml
+++ b/common/autoware_auto_perception_rviz_plugin/package.xml
@@ -8,7 +8,8 @@
Satoshi Tanaka
Taiki Tanaka
Takeshi Miura
-
+ Shunsuke Miura
+ Yoshi Ri
Apache 2.0
ament_cmake
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/CMakeLists.txt b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/CMakeLists.txt
new file mode 100644
index 0000000000000..da67a6f63aeae
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/CMakeLists.txt
@@ -0,0 +1,140 @@
+cmake_minimum_required(VERSION 3.8)
+project(awf_2d_overlay_vehicle)
+
+# find dependencies
+find_package(ament_cmake_auto REQUIRED)
+find_package(ament_cmake REQUIRED)
+find_package(autoware_auto_vehicle_msgs REQUIRED)
+find_package(tier4_planning_msgs REQUIRED)
+find_package(autoware_perception_msgs REQUIRED)
+ament_auto_find_build_dependencies()
+
+find_package(rviz_2d_overlay_msgs REQUIRED)
+
+find_package(rviz_common REQUIRED)
+find_package(rviz_rendering REQUIRED)
+find_package(rviz_ogre_vendor REQUIRED)
+find_package(std_msgs REQUIRED)
+
+set(
+ headers_to_moc
+ include/overlay_text_display.hpp
+ 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_text_display.cpp
+ 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)
+
+target_include_directories(
+ ${PROJECT_NAME} PUBLIC
+ $
+ $
+ ${Qt5Widgets_INCLUDE_DIRS}
+ ${OpenCV_INCLUDE_DIRS}
+)
+
+target_link_libraries(
+ ${PROJECT_NAME} PUBLIC
+ rviz_ogre_vendor::OgreMain
+ rviz_ogre_vendor::OgreOverlay
+)
+
+
+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")
+
+pluginlib_export_plugin_description_file(rviz_common plugins_description.xml)
+
+ament_target_dependencies(
+ ${PROJECT_NAME}
+ PUBLIC
+ rviz_common
+ rviz_rendering
+ rviz_2d_overlay_msgs
+ autoware_auto_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 "awf_2d_overlay_vehicle-extras.cmake"
+)
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/LICENSE b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/LICENSE
new file mode 100644
index 0000000000000..a2fe2d3d1c7ed
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/LICENSE
@@ -0,0 +1,12 @@
+Copyright (c) 2022, Team Spatzenhirn
+Copyright (c) 2014, JSK Lab
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+2. 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.
+
+3. Neither the name of the copyright holder 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 HOLDER 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.
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/README.md b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/README.md
new file mode 100644
index 0000000000000..6728f26878e10
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/README.md
@@ -0,0 +1,54 @@
+# awf_2d_overlay_vehicle
+
+Plugin for displaying 2D overlays over the RViz2 3D scene.
+
+Based on the [jsk_visualization](https://github.com/jsk-ros-pkg/jsk_visualization)
+package, under the 3-Clause BSD license.
+
+## Purpose
+
+This plugin provides a visual and easy-to-understand display of vehicle speed, turn signal, steering status and gears.
+
+## Inputs / Outputs
+
+### Input
+
+| Name | Type | Description |
+| ---------------------------------------- | ------------------------------------------------------- | ---------------------------------- |
+| `/vehicle/status/velocity_status` | `autoware_auto_vehicle_msgs::msg::VelocityReport` | The topic is vehicle twist |
+| `/vehicle/status/turn_indicators_status` | `autoware_auto_vehicle_msgs::msg::TurnIndicatorsReport` | The topic is status of turn signal |
+| `/vehicle/status/hazard_status` | `autoware_auto_vehicle_msgs::msg::HazardReport` | The topic is status of hazard |
+| `/vehicle/status/steering_status` | `autoware_auto_vehicle_msgs::msg::SteeringReport` | The topic is status of steering |
+| `/vehicle/status/gear_status` | `autoware_auto_vehicle_msgs::msg::GearReport` | The topic is status of gear |
+
+## Parameter
+
+### Core Parameters
+
+#### SignalDisplay
+
+| Name | Type | Default Value | Description |
+| ------------------------ | ------ | -------------------- | --------------------------------- |
+| `property_width_` | int | 128 | Width of the plotter window [px] |
+| `property_height_` | int | 128 | Height of the plotter window [px] |
+| `property_left_` | int | 128 | Left of the plotter window [px] |
+| `property_top_` | int | 128 | Top of the plotter window [px] |
+| `property_signal_color_` | QColor | QColor(25, 255, 240) | Turn Signal color |
+
+## Assumptions / Known limits
+
+TBD.
+
+## Usage
+
+1. Start rviz and select Add under the Displays panel.
+
+ ![select_add](./assets/images/select_add.png)
+
+2. Select any one of the tier4_vehicle_rviz_plugin and press OK.
+
+ ![select_vehicle_plugin](./assets/images/select_vehicle_plugin.png)
+
+3. Enter the name of the topic where you want to view the status.
+
+ ![select_topic_name](./assets/images/select_topic_name.png)
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/LICENSE b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/LICENSE
new file mode 100644
index 0000000000000..cc04d393573f0
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/LICENSE
@@ -0,0 +1,93 @@
+Copyright 2011 The Quicksand Project Authors (https://github.com/andrew-paglinawan/QuicksandFamily), with Reserved Font Name “Quicksand”.
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Bold.ttf b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Bold.ttf
new file mode 100644
index 0000000000000..07d5127c04b17
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Bold.ttf differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Light.ttf b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Light.ttf
new file mode 100644
index 0000000000000..800531084fa6c
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Light.ttf differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Medium.ttf b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Medium.ttf
new file mode 100644
index 0000000000000..f4634cd7c3f16
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Medium.ttf differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Regular.ttf b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Regular.ttf
new file mode 100644
index 0000000000000..60323ed6abdf1
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Regular.ttf differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-SemiBold.ttf b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-SemiBold.ttf
new file mode 100644
index 0000000000000..52059c3a3da3f
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-SemiBold.ttf differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/arrow.png b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/arrow.png
new file mode 100644
index 0000000000000..18de535ce4489
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/arrow.png differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_add.png b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_add.png
new file mode 100644
index 0000000000000..c5130b6092384
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_add.png differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_topic_name.png b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_topic_name.png
new file mode 100644
index 0000000000000..5466bcf0050df
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_topic_name.png differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_vehicle_plugin.png b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_vehicle_plugin.png
new file mode 100644
index 0000000000000..863f63d728616
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_vehicle_plugin.png differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/traffic.png b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/traffic.png
new file mode 100644
index 0000000000000..960985a3da5de
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/traffic.png differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/wheel.png b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/wheel.png
new file mode 100644
index 0000000000000..07b1e33132e43
Binary files /dev/null and b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/wheel.png differ
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/awf_2d_overlay_vehicle-extras.cmake b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/awf_2d_overlay_vehicle-extras.cmake
new file mode 100644
index 0000000000000..9d6f156555e57
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/awf_2d_overlay_vehicle-extras.cmake
@@ -0,0 +1,31 @@
+# Copyright (c) 2021, Open Source Robotics Foundation, 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 the copyright holder 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 HOLDER 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.
+
+# find package Qt5 because otherwise using the rviz_default_plugins::rviz_default_plugins
+# exported target will complain that the Qt5::Widgets target does not exist
+find_package(Qt5 REQUIRED QUIET COMPONENTS Widgets)
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/gear_display.hpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/gear_display.hpp
new file mode 100644
index 0000000000000..b289bfc541cee
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/gear_display.hpp
@@ -0,0 +1,49 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef GEAR_DISPLAY_HPP_
+#define GEAR_DISPLAY_HPP_
+#include "overlay_utils.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "autoware_auto_vehicle_msgs/msg/gear_report.hpp"
+
+#include
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+
+class GearDisplay
+{
+public:
+ GearDisplay();
+ void drawGearIndicator(QPainter & painter, const QRectF & backgroundRect);
+ void updateGearData(const autoware_auto_vehicle_msgs::msg::GearReport::ConstSharedPtr & msg);
+
+private:
+ int current_gear_; // Internal variable to store current gear
+ QColor gray = QColor(194, 194, 194);
+};
+
+} // namespace awf_2d_overlay_vehicle
+
+#endif // GEAR_DISPLAY_HPP_
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_text_display.hpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_text_display.hpp
new file mode 100644
index 0000000000000..9b3ecccf6301c
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_text_display.hpp
@@ -0,0 +1,157 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// -*- mode: c++; -*-
+/*********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2022, Team Spatzenhirn
+ * Copyright (c) 2014, JSK Lab
+ * 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/o2r other materials provided
+ * with the distribution.
+ * * Neither the name of the JSK Lab 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 OVERLAY_TEXT_DISPLAY_HPP_
+#define OVERLAY_TEXT_DISPLAY_HPP_
+
+#include "rviz_2d_overlay_msgs/msg/overlay_text.hpp"
+#ifndef Q_MOC_RUN
+#include "overlay_utils.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#endif
+
+namespace awf_2d_overlay_vehicle
+{
+class OverlayTextDisplay
+: public rviz_common::RosTopicDisplay
+{
+ Q_OBJECT
+public:
+ OverlayTextDisplay();
+ virtual ~OverlayTextDisplay();
+
+protected:
+ awf_2d_overlay_vehicle::OverlayObject::SharedPtr overlay_;
+
+ int texture_width_;
+ int texture_height_;
+
+ bool overtake_fg_color_properties_;
+ bool overtake_bg_color_properties_;
+ bool overtake_position_properties_;
+ bool align_bottom_;
+ bool invert_shadow_;
+ QColor bg_color_;
+ QColor fg_color_;
+ int text_size_;
+ int line_width_;
+ std::string text_;
+ QStringList font_families_;
+ std::string font_;
+ int horizontal_dist_;
+ int vertical_dist_;
+ HorizontalAlignment horizontal_alignment_;
+ VerticalAlignment vertical_alignment_;
+
+ void onInitialize() override;
+ void onEnable() override;
+ void onDisable() override;
+ void update(float wall_dt, float ros_dt) override;
+ void reset() override;
+
+ bool require_update_texture_;
+ // properties are raw pointers since they are owned by Qt
+ rviz_common::properties::BoolProperty * overtake_position_properties_property_;
+ rviz_common::properties::BoolProperty * overtake_fg_color_properties_property_;
+ rviz_common::properties::BoolProperty * overtake_bg_color_properties_property_;
+ rviz_common::properties::BoolProperty * align_bottom_property_;
+ rviz_common::properties::BoolProperty * invert_shadow_property_;
+ rviz_common::properties::IntProperty * hor_dist_property_;
+ rviz_common::properties::IntProperty * ver_dist_property_;
+ rviz_common::properties::EnumProperty * hor_alignment_property_;
+ rviz_common::properties::EnumProperty * ver_alignment_property_;
+ rviz_common::properties::IntProperty * width_property_;
+ rviz_common::properties::IntProperty * height_property_;
+ rviz_common::properties::IntProperty * text_size_property_;
+ rviz_common::properties::IntProperty * line_width_property_;
+ rviz_common::properties::ColorProperty * bg_color_property_;
+ rviz_common::properties::FloatProperty * bg_alpha_property_;
+ rviz_common::properties::ColorProperty * fg_color_property_;
+ rviz_common::properties::FloatProperty * fg_alpha_property_;
+ rviz_common::properties::EnumProperty * font_property_;
+
+protected Q_SLOTS:
+ void updateOvertakePositionProperties();
+ void updateOvertakeFGColorProperties();
+ void updateOvertakeBGColorProperties();
+ void updateAlignBottom();
+ void updateInvertShadow();
+ void updateHorizontalDistance();
+ void updateVerticalDistance();
+ void updateHorizontalAlignment();
+ void updateVerticalAlignment();
+ void updateWidth();
+ void updateHeight();
+ void updateTextSize();
+ void updateFGColor();
+ void updateFGAlpha();
+ void updateBGColor();
+ void updateBGAlpha();
+ void updateFont();
+ void updateLineWidth();
+
+private:
+ void processMessage(rviz_2d_overlay_msgs::msg::OverlayText::ConstSharedPtr msg) override;
+};
+} // namespace awf_2d_overlay_vehicle
+
+#endif // OVERLAY_TEXT_DISPLAY_HPP_
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_utils.hpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_utils.hpp
new file mode 100644
index 0000000000000..1270f15ca80ae
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_utils.hpp
@@ -0,0 +1,141 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// -*- mode: c++ -*-
+/*********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2022, Team Spatzenhirn
+ * Copyright (c) 2014, JSK Lab
+ * 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/o2r other materials provided
+ * with the distribution.
+ * * Neither the name of the JSK Lab 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 OVERLAY_UTILS_HPP_
+#define OVERLAY_UTILS_HPP_
+
+#include
+#include
+
+#include "rviz_2d_overlay_msgs/msg/overlay_text.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+class OverlayObject;
+
+class ScopedPixelBuffer
+{
+public:
+ explicit ScopedPixelBuffer(Ogre::HardwarePixelBufferSharedPtr pixel_buffer);
+ virtual ~ScopedPixelBuffer();
+ virtual Ogre::HardwarePixelBufferSharedPtr getPixelBuffer();
+ virtual QImage getQImage(unsigned int width, unsigned int height);
+ virtual QImage getQImage(OverlayObject & overlay);
+ virtual QImage getQImage(unsigned int width, unsigned int height, QColor & bg_color);
+ virtual QImage getQImage(OverlayObject & overlay, QColor & bg_color);
+
+protected:
+ Ogre::HardwarePixelBufferSharedPtr pixel_buffer_;
+};
+
+enum class VerticalAlignment : uint8_t {
+ CENTER = rviz_2d_overlay_msgs::msg::OverlayText::CENTER,
+ TOP = rviz_2d_overlay_msgs::msg::OverlayText::TOP,
+ BOTTOM = rviz_2d_overlay_msgs::msg::OverlayText::BOTTOM,
+};
+
+enum class HorizontalAlignment : uint8_t {
+ LEFT = rviz_2d_overlay_msgs::msg::OverlayText::LEFT,
+ RIGHT = rviz_2d_overlay_msgs::msg::OverlayText::RIGHT,
+ CENTER = rviz_2d_overlay_msgs::msg::OverlayText::CENTER
+};
+
+/**
+ * Helper class for realizing an overlay object on top of the rviz 3D panel.
+ *
+ * This class is supposed to be instantiated in the onInitialize method of the
+ * rviz_common::Display class.
+ */
+class OverlayObject
+{
+public:
+ using SharedPtr = std::shared_ptr;
+
+ explicit OverlayObject(const std::string & name);
+ virtual ~OverlayObject();
+
+ virtual std::string getName() const;
+ virtual void hide();
+ virtual void show();
+ virtual bool isTextureReady() const;
+ virtual void updateTextureSize(unsigned int width, unsigned int height);
+ virtual ScopedPixelBuffer getBuffer();
+ virtual void setPosition(
+ double hor_dist, double ver_dist, HorizontalAlignment hor_alignment = HorizontalAlignment::LEFT,
+ VerticalAlignment ver_alignment = VerticalAlignment::TOP);
+ virtual void setDimensions(double width, double height);
+ virtual bool isVisible() const;
+ virtual unsigned int getTextureWidth() const;
+ virtual unsigned int getTextureHeight() const;
+
+protected:
+ const std::string name_;
+ Ogre::Overlay * overlay_;
+ Ogre::PanelOverlayElement * panel_;
+ Ogre::MaterialPtr panel_material_;
+ Ogre::TexturePtr texture_;
+};
+} // namespace awf_2d_overlay_vehicle
+
+#endif // OVERLAY_UTILS_HPP_
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/signal_display.hpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/signal_display.hpp
new file mode 100644
index 0000000000000..aff475aba2f33
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/signal_display.hpp
@@ -0,0 +1,124 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef SIGNAL_DISPLAY_HPP_
+#define SIGNAL_DISPLAY_HPP_
+#ifndef Q_MOC_RUN
+#include "gear_display.hpp"
+#include "overlay_utils.hpp"
+#include "speed_display.hpp"
+#include "speed_limit_display.hpp"
+#include "steering_wheel_display.hpp"
+#include "traffic_display.hpp"
+#include "turn_signals_display.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#endif
+
+namespace awf_2d_overlay_vehicle
+{
+class SignalDisplay : public rviz_common::Display
+{
+ Q_OBJECT
+public:
+ SignalDisplay();
+ ~SignalDisplay() override;
+
+protected:
+ void onInitialize() override;
+ void update(float wall_dt, float ros_dt) override;
+ void reset() override;
+ void onEnable() override;
+ void onDisable() override;
+
+private Q_SLOTS:
+ void updateOverlaySize();
+ void updateSmallOverlaySize();
+ void updateOverlayPosition();
+ void updateOverlayColor();
+ void topic_updated_gear();
+ void topic_updated_steering();
+ void topic_updated_speed();
+ void topic_updated_speed_limit();
+ void topic_updated_turn_signals();
+ void topic_updated_hazard_lights();
+ void topic_updated_traffic();
+
+private:
+ std::mutex mutex_;
+ awf_2d_overlay_vehicle::OverlayObject::SharedPtr overlay_;
+ rviz_common::properties::IntProperty * property_width_;
+ rviz_common::properties::IntProperty * property_height_;
+ rviz_common::properties::IntProperty * property_left_;
+ rviz_common::properties::IntProperty * property_top_;
+ rviz_common::properties::ColorProperty * property_signal_color_;
+ std::unique_ptr steering_topic_property_;
+ std::unique_ptr gear_topic_property_;
+ std::unique_ptr speed_topic_property_;
+ std::unique_ptr turn_signals_topic_property_;
+ std::unique_ptr hazard_lights_topic_property_;
+ std::unique_ptr traffic_topic_property_;
+ std::unique_ptr speed_limit_topic_property_;
+
+ void drawBackground(QPainter & painter, const QRectF & backgroundRect);
+ void setupRosSubscriptions();
+
+ std::unique_ptr steering_wheel_display_;
+ std::unique_ptr gear_display_;
+ std::unique_ptr speed_display_;
+ std::unique_ptr turn_signals_display_;
+ std::unique_ptr traffic_display_;
+ std::unique_ptr speed_limit_display_;
+
+ rclcpp::Subscription::SharedPtr gear_sub_;
+ rclcpp::Subscription::SharedPtr steering_sub_;
+ rclcpp::Subscription::SharedPtr speed_sub_;
+ rclcpp::Subscription::SharedPtr
+ turn_signals_sub_;
+ rclcpp::Subscription::SharedPtr
+ hazard_lights_sub_;
+ rclcpp::Subscription::SharedPtr traffic_sub_;
+ rclcpp::Subscription::SharedPtr speed_limit_sub_;
+
+ std::mutex property_mutex_;
+
+ void updateGearData(const autoware_auto_vehicle_msgs::msg::GearReport::ConstSharedPtr & msg);
+ void updateSteeringData(
+ const autoware_auto_vehicle_msgs::msg::SteeringReport::ConstSharedPtr & msg);
+ void updateSpeedData(const autoware_auto_vehicle_msgs::msg::VelocityReport::ConstSharedPtr & msg);
+ void updateTurnSignalsData(
+ const autoware_auto_vehicle_msgs::msg::TurnIndicatorsReport::ConstSharedPtr & msg);
+ void updateHazardLightsData(
+ const autoware_auto_vehicle_msgs::msg::HazardLightsReport::ConstSharedPtr & msg);
+ void updateSpeedLimitData(const tier4_planning_msgs::msg::VelocityLimit::ConstSharedPtr msg);
+ void updateTrafficLightData(
+ const autoware_perception_msgs::msg::TrafficSignalArray::ConstSharedPtr msg);
+ void drawWidget(QImage & hud);
+};
+} // namespace awf_2d_overlay_vehicle
+
+#endif // SIGNAL_DISPLAY_HPP_
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_display.hpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_display.hpp
new file mode 100644
index 0000000000000..317e45917f927
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_display.hpp
@@ -0,0 +1,49 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef SPEED_DISPLAY_HPP_
+#define SPEED_DISPLAY_HPP_
+#include "overlay_utils.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "autoware_auto_vehicle_msgs/msg/velocity_report.hpp"
+
+#include
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+
+class SpeedDisplay
+{
+public:
+ SpeedDisplay();
+ void drawSpeedDisplay(QPainter & painter, const QRectF & backgroundRect);
+ void updateSpeedData(const autoware_auto_vehicle_msgs::msg::VelocityReport::ConstSharedPtr & msg);
+
+private:
+ float current_speed_; // Internal variable to store current speed
+ QColor gray = QColor(194, 194, 194);
+};
+
+} // namespace awf_2d_overlay_vehicle
+
+#endif // SPEED_DISPLAY_HPP_
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_limit_display.hpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_limit_display.hpp
new file mode 100644
index 0000000000000..00eae077ff2ac
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_limit_display.hpp
@@ -0,0 +1,49 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef SPEED_LIMIT_DISPLAY_HPP_
+#define SPEED_LIMIT_DISPLAY_HPP_
+#include "overlay_utils.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+
+class SpeedLimitDisplay
+{
+public:
+ SpeedLimitDisplay();
+ void drawSpeedLimitIndicator(QPainter & painter, const QRectF & backgroundRect);
+ void updateSpeedLimitData(const tier4_planning_msgs::msg::VelocityLimit::ConstSharedPtr msg);
+
+private:
+ float current_limit; // Internal variable to store current gear
+ QColor gray = QColor(194, 194, 194);
+};
+
+} // namespace awf_2d_overlay_vehicle
+
+#endif // SPEED_LIMIT_DISPLAY_HPP_
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/steering_wheel_display.hpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/steering_wheel_display.hpp
new file mode 100644
index 0000000000000..a8291064c3807
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/steering_wheel_display.hpp
@@ -0,0 +1,54 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef STEERING_WHEEL_DISPLAY_HPP_
+#define STEERING_WHEEL_DISPLAY_HPP_
+#include "overlay_utils.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "autoware_auto_vehicle_msgs/msg/steering_report.hpp"
+
+#include
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+
+class SteeringWheelDisplay
+{
+public:
+ SteeringWheelDisplay();
+ void drawSteeringWheel(QPainter & painter, const QRectF & backgroundRect);
+ void updateSteeringData(
+ const autoware_auto_vehicle_msgs::msg::SteeringReport::ConstSharedPtr & msg);
+
+private:
+ float steering_angle_ = 0.0f;
+ QColor gray = QColor(194, 194, 194);
+
+ QImage wheelImage;
+ QImage scaledWheelImage;
+ QImage coloredImage(const QImage & source, const QColor & color);
+};
+
+} // namespace awf_2d_overlay_vehicle
+
+#endif // STEERING_WHEEL_DISPLAY_HPP_
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/traffic_display.hpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/traffic_display.hpp
new file mode 100644
index 0000000000000..bf776d27dfa94
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/traffic_display.hpp
@@ -0,0 +1,62 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef TRAFFIC_DISPLAY_HPP_
+#define TRAFFIC_DISPLAY_HPP_
+#include "overlay_utils.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+
+class TrafficDisplay
+{
+public:
+ TrafficDisplay();
+ void drawTrafficLightIndicator(QPainter & painter, const QRectF & backgroundRect);
+ void updateTrafficLightData(
+ const autoware_perception_msgs::msg::TrafficSignalArray::ConstSharedPtr & msg);
+ autoware_perception_msgs::msg::TrafficSignalArray current_traffic_;
+
+private:
+ QImage traffic_light_image_;
+ // yellow #CFC353
+ QColor yellow = QColor(207, 195, 83);
+ // red #CF5353
+ QColor red = QColor(207, 83, 83);
+ // green #53CF5F
+ QColor green = QColor(83, 207, 95);
+ // gray #C2C2C2
+ QColor gray = QColor(194, 194, 194);
+
+ QImage coloredImage(const QImage & source, const QColor & color);
+};
+
+} // namespace awf_2d_overlay_vehicle
+
+#endif // TRAFFIC_DISPLAY_HPP_
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/turn_signals_display.hpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/turn_signals_display.hpp
new file mode 100644
index 0000000000000..cd659883c9ca0
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/turn_signals_display.hpp
@@ -0,0 +1,63 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef TURN_SIGNALS_DISPLAY_HPP_
+#define TURN_SIGNALS_DISPLAY_HPP_
+#include "overlay_utils.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+
+class TurnSignalsDisplay
+{
+public:
+ TurnSignalsDisplay();
+ void drawArrows(QPainter & painter, const QRectF & backgroundRect, const QColor & color);
+ void updateTurnSignalsData(
+ const autoware_auto_vehicle_msgs::msg::TurnIndicatorsReport::ConstSharedPtr & msg);
+ void updateHazardLightsData(
+ const autoware_auto_vehicle_msgs::msg::HazardLightsReport::ConstSharedPtr & msg);
+
+private:
+ QImage arrowImage;
+ QColor gray = QColor(194, 194, 194);
+
+ int current_turn_signal_; // Internal variable to store turn signal state
+ int current_hazard_lights_; // Internal variable to store hazard lights state
+ QImage coloredImage(const QImage & source, const QColor & color);
+
+ std::chrono::steady_clock::time_point last_toggle_time_;
+ bool blink_on_ = false;
+ const std::chrono::milliseconds blink_interval_{500}; // Blink interval in milliseconds
+};
+
+} // namespace awf_2d_overlay_vehicle
+
+#endif // TURN_SIGNALS_DISPLAY_HPP_
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/package.xml b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/package.xml
new file mode 100644
index 0000000000000..b19b384d020b6
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/package.xml
@@ -0,0 +1,31 @@
+
+
+
+ awf_2d_overlay_vehicle
+ 0.0.1
+
+ RViz2 plugin for 2D overlays in the 3D view. Mainly a port of the JSK overlay plugin
+ (https://github.com/jsk-ros-pkg/jsk_visualization).
+
+ Khalil Selyan
+
+ BSD-3-Clause
+
+ autoware_auto_vehicle_msgs
+ autoware_perception_msgs
+ boost
+ rviz_2d_overlay_msgs
+ rviz_common
+ rviz_ogre_vendor
+ rviz_rendering
+ tier4_planning_msgs
+
+ ament_lint_auto
+ autoware_lint_common
+
+ ament_cmake
+
+
+ ament_cmake
+
+
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/plugins_description.xml b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/plugins_description.xml
new file mode 100644
index 0000000000000..8a5af0abcf0dd
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/plugins_description.xml
@@ -0,0 +1,5 @@
+
+
+ Signal overlay plugin for the 3D view.
+
+
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/gear_display.cpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/gear_display.cpp
new file mode 100644
index 0000000000000..153e106f04264
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/gear_display.cpp
@@ -0,0 +1,98 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "gear_display.hpp"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+
+GearDisplay::GearDisplay() : current_gear_(0)
+{
+ std::string package_path = ament_index_cpp::get_package_share_directory("awf_2d_overlay_vehicle");
+ std::string font_path = package_path + "/assets/font/Quicksand/static/Quicksand-Regular.ttf";
+ std::string font_path2 = package_path + "/assets/font/Quicksand/static/Quicksand-Bold.ttf";
+ int fontId = QFontDatabase::addApplicationFont(
+ font_path.c_str()); // returns -1 on failure (see docs for more info)
+ int fontId2 = QFontDatabase::addApplicationFont(
+ font_path2.c_str()); // returns -1 on failure (see docs for more info)
+ if (fontId == -1 || fontId2 == -1) {
+ std::cout << "Failed to load the Quicksand font.";
+ }
+}
+
+void GearDisplay::updateGearData(
+ const autoware_auto_vehicle_msgs::msg::GearReport::ConstSharedPtr & msg)
+{
+ current_gear_ = msg->report; // Assuming msg->report contains the gear information
+}
+
+void GearDisplay::drawGearIndicator(QPainter & painter, const QRectF & backgroundRect)
+{
+ // we deal with the different gears here
+ std::string gearString;
+ switch (current_gear_) {
+ case autoware_auto_vehicle_msgs::msg::GearReport::NEUTRAL:
+ gearString = "N";
+ break;
+ case autoware_auto_vehicle_msgs::msg::GearReport::LOW:
+ case autoware_auto_vehicle_msgs::msg::GearReport::LOW_2:
+ gearString = "L";
+ break;
+ case autoware_auto_vehicle_msgs::msg::GearReport::NONE:
+ case autoware_auto_vehicle_msgs::msg::GearReport::PARK:
+ gearString = "P";
+ break;
+ case autoware_auto_vehicle_msgs::msg::GearReport::REVERSE:
+ case autoware_auto_vehicle_msgs::msg::GearReport::REVERSE_2:
+ gearString = "R";
+ break;
+ // all the drive gears from DRIVE to DRIVE_16
+ default:
+ gearString = "D";
+ break;
+ }
+
+ QFont gearFont("Quicksand", 16, QFont::Bold);
+ painter.setFont(gearFont);
+ QPen borderPen(gray);
+ borderPen.setWidth(4);
+ painter.setPen(borderPen);
+
+ int gearBoxSize = 30;
+ int gearX = backgroundRect.left() + 30 + gearBoxSize;
+ int gearY = backgroundRect.height() - gearBoxSize - 20;
+ QRect gearRect(gearX, gearY, gearBoxSize, gearBoxSize);
+ painter.setBrush(QColor(0, 0, 0, 0));
+ painter.drawRoundedRect(gearRect, 5, 5);
+ painter.drawText(gearRect, Qt::AlignCenter, QString::fromStdString(gearString));
+}
+
+} // namespace awf_2d_overlay_vehicle
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_text_display.cpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_text_display.cpp
new file mode 100644
index 0000000000000..053d0f6e981c0
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_text_display.cpp
@@ -0,0 +1,556 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// -*- mode: c++; -*-
+/*********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2022, Team Spatzenhirn
+ * Copyright (c) 2014, JSK Lab
+ * 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/o2r other materials provided
+ * with the distribution.
+ * * Neither the name of the JSK Lab 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.
+ *********************************************************************/
+
+#include "overlay_text_display.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+OverlayTextDisplay::OverlayTextDisplay()
+: texture_width_(0),
+ texture_height_(0),
+ bg_color_(0, 0, 0, 0),
+ fg_color_(255, 255, 255, 255.0),
+ text_size_(14),
+ line_width_(2),
+ text_(""),
+ font_(""),
+ require_update_texture_(false)
+{
+ overtake_position_properties_property_ = new rviz_common::properties::BoolProperty(
+ "Overtake Position Properties", false,
+ "overtake position properties specified by message such as left, top and font", this,
+ SLOT(updateOvertakePositionProperties()));
+ overtake_fg_color_properties_property_ = new rviz_common::properties::BoolProperty(
+ "Overtake FG Color Properties", false,
+ "overtake color properties specified by message such as foreground color and alpha", this,
+ SLOT(updateOvertakeFGColorProperties()));
+ overtake_bg_color_properties_property_ = new rviz_common::properties::BoolProperty(
+ "Overtake BG Color Properties", false,
+ "overtake color properties specified by message such as background color and alpha", this,
+ SLOT(updateOvertakeBGColorProperties()));
+ align_bottom_property_ = new rviz_common::properties::BoolProperty(
+ "Align Bottom", false, "align text with the bottom of the overlay region", this,
+ SLOT(updateAlignBottom()));
+ invert_shadow_property_ = new rviz_common::properties::BoolProperty(
+ "Invert Shadow", false, "make shadow lighter than original text", this,
+ SLOT(updateInvertShadow()));
+ hor_dist_property_ = new rviz_common::properties::IntProperty(
+ "hor_dist", 0, "horizontal distance to anchor", this, SLOT(updateHorizontalDistance()));
+ ver_dist_property_ = new rviz_common::properties::IntProperty(
+ "ver_dist", 0, "vertical distance to anchor", this, SLOT(updateVerticalDistance()));
+ hor_alignment_property_ = new rviz_common::properties::EnumProperty(
+ "hor_alignment", "left", "horizontal alignment of the overlay", this,
+ SLOT(updateHorizontalAlignment()));
+ hor_alignment_property_->addOption("left", rviz_2d_overlay_msgs::msg::OverlayText::LEFT);
+ hor_alignment_property_->addOption("center", rviz_2d_overlay_msgs::msg::OverlayText::CENTER);
+ hor_alignment_property_->addOption("right", rviz_2d_overlay_msgs::msg::OverlayText::RIGHT);
+ ver_alignment_property_ = new rviz_common::properties::EnumProperty(
+ "ver_alignment", "top", "vertical alignment of the overlay", this,
+ SLOT(updateVerticalAlignment()));
+ ver_alignment_property_->addOption("top", rviz_2d_overlay_msgs::msg::OverlayText::TOP);
+ ver_alignment_property_->addOption("center", rviz_2d_overlay_msgs::msg::OverlayText::CENTER);
+ ver_alignment_property_->addOption("bottom", rviz_2d_overlay_msgs::msg::OverlayText::BOTTOM);
+ width_property_ = new rviz_common::properties::IntProperty(
+ "width", 128, "width position", this, SLOT(updateWidth()));
+ width_property_->setMin(0);
+ height_property_ = new rviz_common::properties::IntProperty(
+ "height", 128, "height position", this, SLOT(updateHeight()));
+ height_property_->setMin(0);
+ text_size_property_ = new rviz_common::properties::IntProperty(
+ "text size", 12, "text size", this, SLOT(updateTextSize()));
+ text_size_property_->setMin(0);
+ line_width_property_ = new rviz_common::properties::IntProperty(
+ "line width", 2, "line width", this, SLOT(updateLineWidth()));
+ line_width_property_->setMin(0);
+ fg_color_property_ = new rviz_common::properties::ColorProperty(
+ "Foreground Color", QColor(25, 255, 240), "Foreground Color", this, SLOT(updateFGColor()));
+ fg_alpha_property_ = new rviz_common::properties::FloatProperty(
+ "Foreground Alpha", 0.8, "Foreground Alpha", this, SLOT(updateFGAlpha()));
+ fg_alpha_property_->setMin(0.0);
+ fg_alpha_property_->setMax(1.0);
+ bg_color_property_ = new rviz_common::properties::ColorProperty(
+ "Background Color", QColor(0, 0, 0), "Background Color", this, SLOT(updateBGColor()));
+ bg_alpha_property_ = new rviz_common::properties::FloatProperty(
+ "Background Alpha", 0.8, "Background Alpha", this, SLOT(updateBGAlpha()));
+ bg_alpha_property_->setMin(0.0);
+ bg_alpha_property_->setMax(1.0);
+
+ QFontDatabase database;
+ font_families_ = database.families();
+ font_property_ = new rviz_common::properties::EnumProperty(
+ "font", "DejaVu Sans Mono", "font", this, SLOT(updateFont()));
+ for (ssize_t i = 0; i < font_families_.size(); i++) {
+ font_property_->addOption(font_families_[i], static_cast(i));
+ }
+}
+
+OverlayTextDisplay::~OverlayTextDisplay()
+{
+ onDisable();
+}
+
+void OverlayTextDisplay::onEnable()
+{
+ if (overlay_) {
+ overlay_->show();
+ }
+ subscribe();
+}
+
+void OverlayTextDisplay::onDisable()
+{
+ if (overlay_) {
+ overlay_->hide();
+ }
+ unsubscribe();
+}
+
+// only the first time
+void OverlayTextDisplay::onInitialize()
+{
+ RTDClass::onInitialize();
+ rviz_rendering::RenderSystem::get()->prepareOverlays(scene_manager_);
+
+ onEnable();
+ updateTopic();
+ updateOvertakePositionProperties();
+ updateOvertakeFGColorProperties();
+ updateOvertakeBGColorProperties();
+ updateAlignBottom();
+ updateInvertShadow();
+ updateHorizontalDistance();
+ updateVerticalDistance();
+ updateHorizontalAlignment();
+ updateVerticalAlignment();
+ updateWidth();
+ updateHeight();
+ updateTextSize();
+ updateFGColor();
+ updateFGAlpha();
+ updateBGColor();
+ updateBGAlpha();
+ updateFont();
+ updateLineWidth();
+ require_update_texture_ = true;
+}
+
+void OverlayTextDisplay::update(float /*wall_dt*/, float /*ros_dt*/)
+{
+ if (!require_update_texture_) {
+ return;
+ }
+ if (!isEnabled()) {
+ return;
+ }
+ if (!overlay_) {
+ return;
+ }
+
+ overlay_->updateTextureSize(texture_width_, texture_height_);
+ {
+ awf_2d_overlay_vehicle::ScopedPixelBuffer buffer = overlay_->getBuffer();
+ QImage Hud = buffer.getQImage(*overlay_, bg_color_);
+ QPainter painter(&Hud);
+ painter.setRenderHint(QPainter::Antialiasing, true);
+ painter.setPen(QPen(fg_color_, std::max(line_width_, 1), Qt::SolidLine));
+ uint16_t w = overlay_->getTextureWidth();
+ uint16_t h = overlay_->getTextureHeight();
+
+ // font
+ if (text_size_ != 0) {
+ // QFont font = painter.font();
+ QFont font(font_.length() > 0 ? font_.c_str() : "Liberation Sans");
+ font.setPointSize(text_size_);
+ font.setBold(true);
+ painter.setFont(font);
+ }
+ if (text_.length() > 0) {
+ QColor shadow_color;
+ if (invert_shadow_)
+ shadow_color = Qt::white; // fg_color_.lighter();
+ else
+ shadow_color = Qt::black; // fg_color_.darker();
+ shadow_color.setAlpha(fg_color_.alpha());
+
+ std::string color_wrapped_text =
+ (boost::format("%1%") % text_ %
+ fg_color_.red() % fg_color_.green() % fg_color_.blue() % fg_color_.alpha())
+ .str();
+
+ // find a remove "color: XXX;" regex match to generate a proper shadow
+ std::regex color_tag_re("color:.+?;");
+ std::string null_char("");
+ std::string formatted_text_ = std::regex_replace(text_, color_tag_re, null_char);
+ std::string color_wrapped_shadow =
+ (boost::format("%1%") %
+ formatted_text_ % shadow_color.red() % shadow_color.green() % shadow_color.blue() %
+ shadow_color.alpha())
+ .str();
+
+ QStaticText static_text(
+ boost::algorithm::replace_all_copy(color_wrapped_text, "\n", "
").c_str());
+ static_text.setTextWidth(w);
+
+ painter.setPen(QPen(shadow_color, std::max(line_width_, 1), Qt::SolidLine));
+ QStaticText static_shadow(
+ boost::algorithm::replace_all_copy(color_wrapped_shadow, "\n", "
").c_str());
+ static_shadow.setTextWidth(w);
+
+ if (!align_bottom_) {
+ painter.drawStaticText(1, 1, static_shadow);
+ painter.drawStaticText(0, 0, static_text);
+ } else {
+ QStaticText only_wrapped_text(color_wrapped_text.c_str());
+ QFontMetrics fm(painter.fontMetrics());
+ QRect text_rect = fm.boundingRect(
+ 0, 0, w, h, Qt::TextWordWrap | Qt::AlignLeft | Qt::AlignTop,
+ only_wrapped_text.text().remove(QRegExp("<[^>]*>")));
+ painter.drawStaticText(1, h - text_rect.height() + 1, static_shadow);
+ painter.drawStaticText(0, h - text_rect.height(), static_text);
+ }
+ }
+ painter.end();
+ }
+ overlay_->setDimensions(overlay_->getTextureWidth(), overlay_->getTextureHeight());
+ require_update_texture_ = false;
+}
+
+void OverlayTextDisplay::reset()
+{
+ RTDClass::reset();
+
+ if (overlay_) {
+ overlay_->hide();
+ }
+}
+
+void OverlayTextDisplay::processMessage(rviz_2d_overlay_msgs::msg::OverlayText::ConstSharedPtr msg)
+{
+ if (!isEnabled()) {
+ return;
+ }
+ if (!overlay_) {
+ static int count = 0;
+ std::stringstream ss;
+ ss << "OverlayTextDisplayObject" << count++;
+ overlay_.reset(new awf_2d_overlay_vehicle::OverlayObject(ss.str()));
+ overlay_->show();
+ }
+ if (overlay_) {
+ if (msg->action == rviz_2d_overlay_msgs::msg::OverlayText::DELETE) {
+ overlay_->hide();
+ } else if (msg->action == rviz_2d_overlay_msgs::msg::OverlayText::ADD) {
+ overlay_->show();
+ }
+ }
+
+ // store message for update method
+ text_ = msg->text;
+
+ if (!overtake_position_properties_) {
+ texture_width_ = msg->width;
+ texture_height_ = msg->height;
+ text_size_ = msg->text_size;
+ horizontal_dist_ = msg->horizontal_distance;
+ vertical_dist_ = msg->vertical_distance;
+
+ horizontal_alignment_ = HorizontalAlignment{msg->horizontal_alignment};
+ vertical_alignment_ = VerticalAlignment{msg->vertical_alignment};
+ }
+ if (!overtake_bg_color_properties_)
+ bg_color_ = QColor(
+ msg->bg_color.r * 255.0, msg->bg_color.g * 255.0, msg->bg_color.b * 255.0,
+ msg->bg_color.a * 255.0);
+ if (!overtake_fg_color_properties_) {
+ fg_color_ = QColor(
+ msg->fg_color.r * 255.0, msg->fg_color.g * 255.0, msg->fg_color.b * 255.0,
+ msg->fg_color.a * 255.0);
+ font_ = msg->font;
+ line_width_ = msg->line_width;
+ }
+ if (overlay_) {
+ overlay_->setPosition(
+ horizontal_dist_, vertical_dist_, horizontal_alignment_, vertical_alignment_);
+ }
+ require_update_texture_ = true;
+}
+
+void OverlayTextDisplay::updateOvertakePositionProperties()
+{
+ if (!overtake_position_properties_ && overtake_position_properties_property_->getBool()) {
+ updateVerticalDistance();
+ updateHorizontalDistance();
+ updateVerticalAlignment();
+ updateHorizontalAlignment();
+ updateWidth();
+ updateHeight();
+ updateTextSize();
+ require_update_texture_ = true;
+ }
+
+ overtake_position_properties_ = overtake_position_properties_property_->getBool();
+ if (overtake_position_properties_) {
+ hor_dist_property_->show();
+ ver_dist_property_->show();
+ hor_alignment_property_->show();
+ ver_alignment_property_->show();
+ width_property_->show();
+ height_property_->show();
+ text_size_property_->show();
+ } else {
+ hor_dist_property_->hide();
+ ver_dist_property_->hide();
+ hor_alignment_property_->hide();
+ ver_alignment_property_->hide();
+ width_property_->hide();
+ height_property_->hide();
+ text_size_property_->hide();
+ }
+}
+
+void OverlayTextDisplay::updateOvertakeFGColorProperties()
+{
+ if (!overtake_fg_color_properties_ && overtake_fg_color_properties_property_->getBool()) {
+ // read all the parameters from properties
+ updateFGColor();
+ updateFGAlpha();
+ updateFont();
+ updateLineWidth();
+ require_update_texture_ = true;
+ }
+ overtake_fg_color_properties_ = overtake_fg_color_properties_property_->getBool();
+ if (overtake_fg_color_properties_) {
+ fg_color_property_->show();
+ fg_alpha_property_->show();
+ line_width_property_->show();
+ font_property_->show();
+ } else {
+ fg_color_property_->hide();
+ fg_alpha_property_->hide();
+ line_width_property_->hide();
+ font_property_->hide();
+ }
+}
+
+void OverlayTextDisplay::updateOvertakeBGColorProperties()
+{
+ if (!overtake_bg_color_properties_ && overtake_bg_color_properties_property_->getBool()) {
+ // read all the parameters from properties
+ updateBGColor();
+ updateBGAlpha();
+ require_update_texture_ = true;
+ }
+ overtake_bg_color_properties_ = overtake_bg_color_properties_property_->getBool();
+ if (overtake_bg_color_properties_) {
+ bg_color_property_->show();
+ bg_alpha_property_->show();
+ } else {
+ bg_color_property_->hide();
+ bg_alpha_property_->hide();
+ }
+}
+
+void OverlayTextDisplay::updateAlignBottom()
+{
+ if (align_bottom_ != align_bottom_property_->getBool()) {
+ require_update_texture_ = true;
+ }
+ align_bottom_ = align_bottom_property_->getBool();
+}
+
+void OverlayTextDisplay::updateInvertShadow()
+{
+ if (invert_shadow_ != invert_shadow_property_->getBool()) {
+ require_update_texture_ = true;
+ }
+ invert_shadow_ = invert_shadow_property_->getBool();
+}
+
+void OverlayTextDisplay::updateVerticalDistance()
+{
+ vertical_dist_ = ver_dist_property_->getInt();
+ if (overtake_position_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateHorizontalDistance()
+{
+ horizontal_dist_ = hor_dist_property_->getInt();
+ if (overtake_position_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateVerticalAlignment()
+{
+ vertical_alignment_ =
+ VerticalAlignment{static_cast(ver_alignment_property_->getOptionInt())};
+
+ if (overtake_position_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateHorizontalAlignment()
+{
+ horizontal_alignment_ =
+ HorizontalAlignment{static_cast(hor_alignment_property_->getOptionInt())};
+
+ if (overtake_position_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateWidth()
+{
+ texture_width_ = width_property_->getInt();
+ if (overtake_position_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateHeight()
+{
+ texture_height_ = height_property_->getInt();
+ if (overtake_position_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateTextSize()
+{
+ text_size_ = text_size_property_->getInt();
+ if (overtake_position_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateBGColor()
+{
+ QColor c = bg_color_property_->getColor();
+ bg_color_.setRed(c.red());
+ bg_color_.setGreen(c.green());
+ bg_color_.setBlue(c.blue());
+ if (overtake_bg_color_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateBGAlpha()
+{
+ bg_color_.setAlpha(bg_alpha_property_->getFloat() * 255.0);
+ if (overtake_bg_color_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateFGColor()
+{
+ QColor c = fg_color_property_->getColor();
+ fg_color_.setRed(c.red());
+ fg_color_.setGreen(c.green());
+ fg_color_.setBlue(c.blue());
+ if (overtake_fg_color_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateFGAlpha()
+{
+ fg_color_.setAlpha(fg_alpha_property_->getFloat() * 255.0);
+ if (overtake_fg_color_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateFont()
+{
+ int font_index = font_property_->getOptionInt();
+ if (font_index < font_families_.size()) {
+ font_ = font_families_[font_index].toStdString();
+ } else {
+ RVIZ_COMMON_LOG_ERROR_STREAM("Unexpected error at selecting font index " << font_index);
+ return;
+ }
+ if (overtake_fg_color_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+void OverlayTextDisplay::updateLineWidth()
+{
+ line_width_ = line_width_property_->getInt();
+ if (overtake_fg_color_properties_) {
+ require_update_texture_ = true;
+ }
+}
+
+} // namespace awf_2d_overlay_vehicle
+
+#include
+PLUGINLIB_EXPORT_CLASS(awf_2d_overlay_vehicle::OverlayTextDisplay, rviz_common::Display)
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_utils.cpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_utils.cpp
new file mode 100644
index 0000000000000..e65a74415fb6a
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_utils.cpp
@@ -0,0 +1,267 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// -*- mode: c++ -*-
+/*********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2022, Team Spatzenhirn
+ * Copyright (c) 2014, JSK Lab
+ * 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/o2r other materials provided
+ * with the distribution.
+ * * Neither the name of the JSK Lab 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.
+ *********************************************************************/
+
+#include "overlay_utils.hpp"
+
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+ScopedPixelBuffer::ScopedPixelBuffer(Ogre::HardwarePixelBufferSharedPtr pixel_buffer)
+: pixel_buffer_(pixel_buffer)
+{
+ pixel_buffer_->lock(Ogre::HardwareBuffer::HBL_NORMAL);
+}
+
+ScopedPixelBuffer::~ScopedPixelBuffer()
+{
+ pixel_buffer_->unlock();
+}
+
+Ogre::HardwarePixelBufferSharedPtr ScopedPixelBuffer::getPixelBuffer()
+{
+ return pixel_buffer_;
+}
+
+QImage ScopedPixelBuffer::getQImage(unsigned int width, unsigned int height)
+{
+ const Ogre::PixelBox & pixelBox = pixel_buffer_->getCurrentLock();
+ Ogre::uint8 * pDest = static_cast(pixelBox.data);
+ memset(pDest, 0, width * height);
+ return QImage(pDest, width, height, QImage::Format_ARGB32);
+}
+
+QImage ScopedPixelBuffer::getQImage(unsigned int width, unsigned int height, QColor & bg_color)
+{
+ QImage Hud = getQImage(width, height);
+ for (unsigned int i = 0; i < width; i++) {
+ for (unsigned int j = 0; j < height; j++) {
+ Hud.setPixel(i, j, bg_color.rgba());
+ }
+ }
+ return Hud;
+}
+
+QImage ScopedPixelBuffer::getQImage(OverlayObject & overlay)
+{
+ return getQImage(overlay.getTextureWidth(), overlay.getTextureHeight());
+}
+
+QImage ScopedPixelBuffer::getQImage(OverlayObject & overlay, QColor & bg_color)
+{
+ return getQImage(overlay.getTextureWidth(), overlay.getTextureHeight(), bg_color);
+}
+
+OverlayObject::OverlayObject(const std::string & name) : name_(name)
+{
+ std::string material_name = name_ + "Material";
+ Ogre::OverlayManager * mOverlayMgr = Ogre::OverlayManager::getSingletonPtr();
+ overlay_ = mOverlayMgr->create(name_);
+ panel_ = static_cast(
+ mOverlayMgr->createOverlayElement("Panel", name_ + "Panel"));
+ panel_->setMetricsMode(Ogre::GMM_PIXELS);
+
+ panel_material_ = Ogre::MaterialManager::getSingleton().create(
+ material_name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+ panel_->setMaterialName(panel_material_->getName());
+ overlay_->add2D(panel_);
+}
+
+OverlayObject::~OverlayObject()
+{
+ Ogre::OverlayManager * mOverlayMgr = Ogre::OverlayManager::getSingletonPtr();
+ if (mOverlayMgr) {
+ mOverlayMgr->destroyOverlayElement(panel_);
+ mOverlayMgr->destroy(overlay_);
+ }
+ if (panel_material_) {
+ panel_material_->unload();
+ Ogre::MaterialManager::getSingleton().remove(panel_material_->getName());
+ }
+}
+
+std::string OverlayObject::getName() const
+{
+ return name_;
+}
+
+void OverlayObject::hide()
+{
+ if (overlay_->isVisible()) {
+ overlay_->hide();
+ }
+}
+
+void OverlayObject::show()
+{
+ if (!overlay_->isVisible()) {
+ overlay_->show();
+ }
+}
+
+bool OverlayObject::isTextureReady() const
+{
+ return texture_ != nullptr;
+}
+
+void OverlayObject::updateTextureSize(unsigned int width, unsigned int height)
+{
+ const std::string texture_name = name_ + "Texture";
+ if (width == 0) {
+ RVIZ_COMMON_LOG_WARNING_STREAM("[OverlayObject] width=0 is specified as texture size");
+ width = 1;
+ }
+
+ if (height == 0) {
+ RVIZ_COMMON_LOG_WARNING_STREAM("[OverlayObject] height=0 is specified as texture size");
+ height = 1;
+ }
+
+ if (!isTextureReady() || ((width != texture_->getWidth()) || (height != texture_->getHeight()))) {
+ if (isTextureReady()) {
+ Ogre::TextureManager::getSingleton().remove(texture_name);
+ panel_material_->getTechnique(0)->getPass(0)->removeAllTextureUnitStates();
+ }
+
+ texture_ = Ogre::TextureManager::getSingleton().createManual(
+ texture_name, // name
+ Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
+ Ogre::TEX_TYPE_2D, // type
+ width, height, // width & height of the render window
+ 0, // number of mipmaps
+ Ogre::PF_A8R8G8B8, // pixel format chosen to match a format Qt can use
+ Ogre::TU_DEFAULT // usage
+ );
+ panel_material_->getTechnique(0)->getPass(0)->createTextureUnitState(texture_name);
+
+ panel_material_->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
+ }
+}
+
+ScopedPixelBuffer OverlayObject::getBuffer()
+{
+ if (isTextureReady()) {
+ return ScopedPixelBuffer(texture_->getBuffer());
+ } else {
+ return ScopedPixelBuffer(Ogre::HardwarePixelBufferSharedPtr());
+ }
+}
+
+void OverlayObject::setPosition(
+ double hor_dist, double ver_dist, HorizontalAlignment hor_alignment,
+ VerticalAlignment ver_alignment)
+{
+ // ogre position is always based on the top left corner of the panel, while our position input
+ // depends on the chosen alignment, i.e. if the horizontal alignment is right, increasing the
+ // horizontal dist moves the panel to the left (further away from the right border)
+ double left = 0;
+ double top = 0;
+
+ switch (hor_alignment) {
+ case HorizontalAlignment::LEFT:
+ panel_->setHorizontalAlignment(Ogre::GuiHorizontalAlignment::GHA_LEFT);
+ left = hor_dist;
+ break;
+ case HorizontalAlignment::CENTER:
+ panel_->setHorizontalAlignment(Ogre::GuiHorizontalAlignment::GHA_CENTER);
+ left = hor_dist - panel_->getWidth() / 2;
+ break;
+ case HorizontalAlignment::RIGHT:
+ panel_->setHorizontalAlignment(Ogre::GuiHorizontalAlignment::GHA_RIGHT);
+ left = -hor_dist - panel_->getWidth();
+ break;
+ }
+
+ switch (ver_alignment) {
+ case VerticalAlignment::BOTTOM:
+ panel_->setVerticalAlignment(Ogre::GuiVerticalAlignment::GVA_BOTTOM);
+ top = -ver_dist - panel_->getHeight();
+ break;
+ case VerticalAlignment::CENTER:
+ panel_->setVerticalAlignment(Ogre::GuiVerticalAlignment::GVA_CENTER);
+ top = ver_dist - panel_->getHeight() / 2;
+ break;
+ case VerticalAlignment::TOP:
+ panel_->setVerticalAlignment(Ogre::GuiVerticalAlignment::GVA_TOP);
+ top = ver_dist;
+ break;
+ }
+
+ panel_->setPosition(left, top);
+}
+
+void OverlayObject::setDimensions(double width, double height)
+{
+ panel_->setDimensions(width, height);
+}
+
+bool OverlayObject::isVisible() const
+{
+ return overlay_->isVisible();
+}
+
+unsigned int OverlayObject::getTextureWidth() const
+{
+ if (isTextureReady()) {
+ return texture_->getWidth();
+ } else {
+ return 0;
+ }
+}
+
+unsigned int OverlayObject::getTextureHeight() const
+{
+ if (isTextureReady()) {
+ return texture_->getHeight();
+ } else {
+ return 0;
+ }
+}
+} // namespace awf_2d_overlay_vehicle
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/signal_display.cpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/signal_display.cpp
new file mode 100644
index 0000000000000..f2a82dd386b37
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/signal_display.cpp
@@ -0,0 +1,501 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "signal_display.hpp"
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+
+SignalDisplay::SignalDisplay()
+{
+ property_width_ = new rviz_common::properties::IntProperty(
+ "Width", 517, "Width of the overlay", this, SLOT(updateOverlaySize()));
+ property_height_ = new rviz_common::properties::IntProperty(
+ "Height", 175, "Height of the overlay", this, SLOT(updateOverlaySize()));
+ property_left_ = new rviz_common::properties::IntProperty(
+ "Left", 10, "Left position of the overlay", this, SLOT(updateOverlayPosition()));
+ property_top_ = new rviz_common::properties::IntProperty(
+ "Top", 10, "Top position of the overlay", this, SLOT(updateOverlayPosition()));
+ property_signal_color_ = new rviz_common::properties::ColorProperty(
+ "Signal Color", QColor(94, 130, 255), "Color of the signal arrows", this,
+ SLOT(updateOverlayColor()));
+
+ // Initialize the component displays
+ steering_wheel_display_ = std::make_unique();
+ gear_display_ = std::make_unique();
+ speed_display_ = std::make_unique();
+ turn_signals_display_ = std::make_unique();
+ traffic_display_ = std::make_unique();
+ speed_limit_display_ = std::make_unique();
+}
+
+void SignalDisplay::onInitialize()
+{
+ std::lock_guard lock(property_mutex_);
+
+ rviz_common::Display::onInitialize();
+ rviz_rendering::RenderSystem::get()->prepareOverlays(scene_manager_);
+ static int count = 0;
+ std::stringstream ss;
+ ss << "SignalDisplayObject" << count++;
+ overlay_.reset(new awf_2d_overlay_vehicle::OverlayObject(ss.str()));
+ overlay_->show();
+ updateOverlaySize();
+ updateOverlayPosition();
+
+ auto rviz_ros_node = context_->getRosNodeAbstraction();
+
+ gear_topic_property_ = std::make_unique(
+ "Gear Topic Test", "/vehicle/status/gear_status", "autoware_auto_vehicle_msgs/msg/GearReport",
+ "Topic for Gear Data", this, SLOT(topic_updated_gear()));
+ gear_topic_property_->initialize(rviz_ros_node);
+
+ turn_signals_topic_property_ = std::make_unique(
+ "Turn Signals Topic", "/vehicle/status/turn_indicators_status",
+ "autoware_auto_vehicle_msgs/msg/TurnIndicatorsReport", "Topic for Turn Signals Data", this,
+ SLOT(topic_updated_turn_signals()));
+ turn_signals_topic_property_->initialize(rviz_ros_node);
+
+ speed_topic_property_ = std::make_unique(
+ "Speed Topic", "/vehicle/status/velocity_status",
+ "autoware_auto_vehicle_msgs/msg/VelocityReport", "Topic for Speed Data", this,
+ SLOT(topic_updated_speed()));
+ speed_topic_property_->initialize(rviz_ros_node);
+
+ steering_topic_property_ = std::make_unique(
+ "Steering Topic", "/vehicle/status/steering_status",
+ "autoware_auto_vehicle_msgs/msg/SteeringReport", "Topic for Steering Data", this,
+ SLOT(topic_updated_steering()));
+ steering_topic_property_->initialize(rviz_ros_node);
+
+ hazard_lights_topic_property_ = std::make_unique(
+ "Hazard Lights Topic", "/vehicle/status/hazard_lights_status",
+ "autoware_auto_vehicle_msgs/msg/HazardLightsReport", "Topic for Hazard Lights Data", this,
+ SLOT(topic_updated_hazard_lights()));
+ hazard_lights_topic_property_->initialize(rviz_ros_node);
+
+ speed_limit_topic_property_ = std::make_unique(
+ "Speed Limit Topic", "/planning/scenario_planning/current_max_velocity",
+ "tier4_planning_msgs/msg/VelocityLimit", "Topic for Speed Limit Data", this,
+ SLOT(topic_updated_speed_limit()));
+ speed_limit_topic_property_->initialize(rviz_ros_node);
+
+ traffic_topic_property_ = std::make_unique(
+ "Traffic Topic", "/perception/traffic_light_recognition/traffic_signals",
+ "autoware_perception/msgs/msg/TrafficSignalArray", "Topic for Traffic Light Data", this,
+ SLOT(topic_updated_traffic()));
+ traffic_topic_property_->initialize(rviz_ros_node);
+}
+
+void SignalDisplay::setupRosSubscriptions()
+{
+ // Don't create a node, just use the one from the parent class
+ auto rviz_node_ = context_->getRosNodeAbstraction().lock()->get_raw_node();
+
+ gear_sub_ = rviz_node_->create_subscription(
+ gear_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_auto_vehicle_msgs::msg::GearReport::SharedPtr msg) {
+ updateGearData(msg);
+ });
+
+ steering_sub_ = rviz_node_->create_subscription(
+ steering_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_auto_vehicle_msgs::msg::SteeringReport::SharedPtr msg) {
+ updateSteeringData(msg);
+ });
+
+ speed_sub_ = rviz_node_->create_subscription(
+ speed_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_auto_vehicle_msgs::msg::VelocityReport::SharedPtr msg) {
+ updateSpeedData(msg);
+ });
+
+ turn_signals_sub_ =
+ rviz_node_->create_subscription(
+ turn_signals_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_auto_vehicle_msgs::msg::TurnIndicatorsReport::SharedPtr msg) {
+ updateTurnSignalsData(msg);
+ });
+
+ hazard_lights_sub_ =
+ rviz_node_->create_subscription(
+ hazard_lights_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_auto_vehicle_msgs::msg::HazardLightsReport::SharedPtr msg) {
+ updateHazardLightsData(msg);
+ });
+
+ traffic_sub_ = rviz_node_->create_subscription(
+ traffic_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_perception_msgs::msg::TrafficSignalArray::SharedPtr msg) {
+ updateTrafficLightData(msg);
+ });
+
+ speed_limit_sub_ = rviz_node_->create_subscription(
+ speed_limit_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const tier4_planning_msgs::msg::VelocityLimit::ConstSharedPtr msg) {
+ updateSpeedLimitData(msg);
+ });
+}
+
+SignalDisplay::~SignalDisplay()
+{
+ std::lock_guard lock(property_mutex_);
+ overlay_.reset();
+
+ gear_sub_.reset();
+ steering_sub_.reset();
+ speed_sub_.reset();
+ turn_signals_sub_.reset();
+ hazard_lights_sub_.reset();
+ traffic_sub_.reset();
+
+ steering_wheel_display_.reset();
+ gear_display_.reset();
+ speed_display_.reset();
+ turn_signals_display_.reset();
+ traffic_display_.reset();
+ speed_limit_display_.reset();
+
+ gear_topic_property_.reset();
+ turn_signals_topic_property_.reset();
+ speed_topic_property_.reset();
+ steering_topic_property_.reset();
+ hazard_lights_topic_property_.reset();
+ traffic_topic_property_.reset();
+}
+
+void SignalDisplay::update(float /* wall_dt */, float /* ros_dt */)
+{
+ if (!overlay_) {
+ return;
+ }
+ awf_2d_overlay_vehicle::ScopedPixelBuffer buffer = overlay_->getBuffer();
+ QImage hud = buffer.getQImage(*overlay_);
+ hud.fill(Qt::transparent);
+ drawWidget(hud);
+}
+
+void SignalDisplay::onEnable()
+{
+ std::lock_guard lock(property_mutex_);
+ if (overlay_) {
+ overlay_->show();
+ }
+ setupRosSubscriptions();
+}
+
+void SignalDisplay::onDisable()
+{
+ std::lock_guard lock(property_mutex_);
+
+ gear_sub_.reset();
+ steering_sub_.reset();
+ speed_sub_.reset();
+ turn_signals_sub_.reset();
+ hazard_lights_sub_.reset();
+
+ if (overlay_) {
+ overlay_->hide();
+ }
+}
+
+void SignalDisplay::updateTrafficLightData(
+ const autoware_perception_msgs::msg::TrafficSignalArray::ConstSharedPtr msg)
+{
+ std::lock_guard lock(property_mutex_);
+
+ if (traffic_display_) {
+ traffic_display_->updateTrafficLightData(msg);
+ }
+}
+
+void SignalDisplay::updateSpeedLimitData(
+ const tier4_planning_msgs::msg::VelocityLimit::ConstSharedPtr msg)
+{
+ std::lock_guard lock(property_mutex_);
+
+ if (speed_limit_display_) {
+ speed_limit_display_->updateSpeedLimitData(msg);
+ queueRender();
+ }
+}
+
+void SignalDisplay::updateHazardLightsData(
+ const autoware_auto_vehicle_msgs::msg::HazardLightsReport::ConstSharedPtr & msg)
+{
+ std::lock_guard lock(property_mutex_);
+
+ if (turn_signals_display_) {
+ turn_signals_display_->updateHazardLightsData(msg);
+ queueRender();
+ }
+}
+
+void SignalDisplay::updateGearData(
+ const autoware_auto_vehicle_msgs::msg::GearReport::ConstSharedPtr & msg)
+{
+ std::lock_guard lock(property_mutex_);
+
+ if (gear_display_) {
+ gear_display_->updateGearData(msg);
+ queueRender();
+ }
+}
+
+void SignalDisplay::updateSteeringData(
+ const autoware_auto_vehicle_msgs::msg::SteeringReport::ConstSharedPtr & msg)
+{
+ std::lock_guard lock(property_mutex_);
+
+ if (steering_wheel_display_) {
+ steering_wheel_display_->updateSteeringData(msg);
+ queueRender();
+ }
+}
+
+void SignalDisplay::updateSpeedData(
+ const autoware_auto_vehicle_msgs::msg::VelocityReport::ConstSharedPtr & msg)
+{
+ std::lock_guard lock(property_mutex_);
+
+ if (speed_display_) {
+ speed_display_->updateSpeedData(msg);
+ queueRender();
+ }
+}
+
+void SignalDisplay::updateTurnSignalsData(
+ const autoware_auto_vehicle_msgs::msg::TurnIndicatorsReport::ConstSharedPtr & msg)
+{
+ std::lock_guard lock(property_mutex_);
+
+ if (turn_signals_display_) {
+ turn_signals_display_->updateTurnSignalsData(msg);
+ queueRender();
+ }
+}
+
+void SignalDisplay::drawWidget(QImage & hud)
+{
+ std::lock_guard lock(property_mutex_);
+
+ if (!overlay_->isVisible()) {
+ return;
+ }
+
+ QPainter painter(&hud);
+ painter.setRenderHint(QPainter::Antialiasing, true);
+
+ QRectF backgroundRect(0, 0, 322, hud.height());
+ drawBackground(painter, backgroundRect);
+
+ // Draw components
+ if (steering_wheel_display_) {
+ steering_wheel_display_->drawSteeringWheel(painter, backgroundRect);
+ }
+ if (gear_display_) {
+ gear_display_->drawGearIndicator(painter, backgroundRect);
+ }
+ if (speed_display_) {
+ speed_display_->drawSpeedDisplay(painter, backgroundRect);
+ }
+ if (turn_signals_display_) {
+ turn_signals_display_->drawArrows(painter, backgroundRect, property_signal_color_->getColor());
+ }
+
+ // a 27px space between the two halves of the HUD
+
+ QRectF smallerBackgroundRect(349, 0, 168, hud.height() / 2);
+
+ drawBackground(painter, smallerBackgroundRect);
+
+ if (traffic_display_) {
+ traffic_display_->drawTrafficLightIndicator(painter, smallerBackgroundRect);
+ }
+
+ if (speed_limit_display_) {
+ speed_limit_display_->drawSpeedLimitIndicator(painter, smallerBackgroundRect);
+ }
+
+ painter.end();
+}
+
+void SignalDisplay::drawBackground(QPainter & painter, const QRectF & backgroundRect)
+{
+ painter.setBrush(QColor(0, 0, 0, 255 * 0.2)); // Black background with opacity
+ painter.setPen(Qt::NoPen);
+ painter.drawRoundedRect(
+ backgroundRect, backgroundRect.height() / 2, backgroundRect.height() / 2); // Circular ends
+}
+
+void SignalDisplay::reset()
+{
+ rviz_common::Display::reset();
+ overlay_->hide();
+}
+
+void SignalDisplay::updateOverlaySize()
+{
+ std::lock_guard lock(mutex_);
+ overlay_->updateTextureSize(property_width_->getInt(), property_height_->getInt());
+ overlay_->setDimensions(overlay_->getTextureWidth(), overlay_->getTextureHeight());
+ queueRender();
+}
+
+void SignalDisplay::updateOverlayPosition()
+{
+ std::lock_guard lock(mutex_);
+ overlay_->setPosition(property_left_->getInt(), property_top_->getInt());
+ queueRender();
+}
+
+void SignalDisplay::updateOverlayColor()
+{
+ std::lock_guard lock(mutex_);
+ queueRender();
+}
+
+void SignalDisplay::topic_updated_gear()
+{
+ // resubscribe to the topic
+ gear_sub_.reset();
+ auto rviz_ros_node = context_->getRosNodeAbstraction().lock();
+ gear_sub_ =
+ rviz_ros_node->get_raw_node()->create_subscription(
+ gear_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_auto_vehicle_msgs::msg::GearReport::SharedPtr msg) {
+ updateGearData(msg);
+ });
+}
+
+void SignalDisplay::topic_updated_steering()
+{
+ // resubscribe to the topic
+ steering_sub_.reset();
+ auto rviz_ros_node = context_->getRosNodeAbstraction().lock();
+ steering_sub_ = rviz_ros_node->get_raw_node()
+ ->create_subscription(
+ steering_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_auto_vehicle_msgs::msg::SteeringReport::SharedPtr msg) {
+ updateSteeringData(msg);
+ });
+}
+
+void SignalDisplay::topic_updated_speed()
+{
+ // resubscribe to the topic
+ speed_sub_.reset();
+ auto rviz_ros_node = context_->getRosNodeAbstraction().lock();
+ speed_sub_ = rviz_ros_node->get_raw_node()
+ ->create_subscription(
+ speed_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_auto_vehicle_msgs::msg::VelocityReport::SharedPtr msg) {
+ updateSpeedData(msg);
+ });
+}
+
+void SignalDisplay::topic_updated_speed_limit()
+{
+ // resubscribe to the topic
+ speed_limit_sub_.reset();
+ auto rviz_ros_node = context_->getRosNodeAbstraction().lock();
+ speed_limit_sub_ =
+ rviz_ros_node->get_raw_node()->create_subscription(
+ speed_limit_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const tier4_planning_msgs::msg::VelocityLimit::ConstSharedPtr msg) {
+ updateSpeedLimitData(msg);
+ });
+}
+
+void SignalDisplay::topic_updated_turn_signals()
+{
+ // resubscribe to the topic
+ turn_signals_sub_.reset();
+ auto rviz_ros_node = context_->getRosNodeAbstraction().lock();
+
+ turn_signals_sub_ =
+ rviz_ros_node->get_raw_node()
+ ->create_subscription(
+ turn_signals_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_auto_vehicle_msgs::msg::TurnIndicatorsReport::SharedPtr msg) {
+ updateTurnSignalsData(msg);
+ });
+}
+
+void SignalDisplay::topic_updated_hazard_lights()
+{
+ // resubscribe to the topic
+ hazard_lights_sub_.reset();
+ auto rviz_ros_node = context_->getRosNodeAbstraction().lock();
+
+ hazard_lights_sub_ =
+ rviz_ros_node->get_raw_node()
+ ->create_subscription(
+ hazard_lights_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_auto_vehicle_msgs::msg::HazardLightsReport::SharedPtr msg) {
+ updateHazardLightsData(msg);
+ });
+}
+
+void SignalDisplay::topic_updated_traffic()
+{
+ // resubscribe to the topic
+ traffic_sub_.reset();
+ auto rviz_ros_node = context_->getRosNodeAbstraction().lock();
+ traffic_sub_ =
+ rviz_ros_node->get_raw_node()
+ ->create_subscription(
+ traffic_topic_property_->getTopicStd(),
+ rclcpp::QoS(rclcpp::KeepLast(10)).durability_volatile().reliable(),
+ [this](const autoware_perception_msgs::msg::TrafficSignalArray::SharedPtr msg) {
+ updateTrafficLightData(msg);
+ });
+}
+
+} // namespace awf_2d_overlay_vehicle
+
+#include
+PLUGINLIB_EXPORT_CLASS(awf_2d_overlay_vehicle::SignalDisplay, rviz_common::Display)
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_display.cpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_display.cpp
new file mode 100644
index 0000000000000..8212758c09a9f
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_display.cpp
@@ -0,0 +1,109 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "speed_display.hpp"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+
+SpeedDisplay::SpeedDisplay() : current_speed_(0.0)
+{
+ std::string package_path = ament_index_cpp::get_package_share_directory("awf_2d_overlay_vehicle");
+ std::string font_path = package_path + "/assets/font/Quicksand/static/Quicksand-Regular.ttf";
+ std::string font_path2 = package_path + "/assets/font/Quicksand/static/Quicksand-Bold.ttf";
+ int fontId = QFontDatabase::addApplicationFont(
+ font_path.c_str()); // returns -1 on failure (see docs for more info)
+ int fontId2 = QFontDatabase::addApplicationFont(
+ font_path2.c_str()); // returns -1 on failure (see docs for more info)
+ if (fontId == -1 || fontId2 == -1) {
+ std::cout << "Failed to load the Quicksand font.";
+ }
+}
+
+void SpeedDisplay::updateSpeedData(
+ const autoware_auto_vehicle_msgs::msg::VelocityReport::ConstSharedPtr & msg)
+{
+ try {
+ // Assuming msg->state.longitudinal_velocity_mps is the field you're interested in
+ float speed = msg->longitudinal_velocity;
+ // we received it as a m/s value, but we want to display it in km/h
+ current_speed_ = (speed * 3.6);
+ } catch (const std::exception & e) {
+ // Log the error
+ std::cerr << "Error in processMessage: " << e.what() << std::endl;
+ }
+}
+
+// void SpeedDisplay::processMessage(const
+// autoware_auto_vehicle_msgs::msg::VelocityReport::ConstSharedPtr msg)
+// {
+// try
+// {
+// current_speed_ = std::round(msg->state.longitudinal_velocity_mps * 3.6);
+// }
+// catch (const std::exception &e)
+// {
+// std::cerr << "Error in processMessage: " << e.what() << std::endl;
+// }
+// }
+
+void SpeedDisplay::drawSpeedDisplay(QPainter & painter, const QRectF & backgroundRect)
+{
+ QFont referenceFont("Quicksand", 80, QFont::Bold);
+ painter.setFont(referenceFont);
+ QRect referenceRect = painter.fontMetrics().boundingRect("88");
+ QPointF referencePos(
+ backgroundRect.width() / 2 - referenceRect.width() / 2 - 5, backgroundRect.height() / 2);
+
+ QString speedNumber = QString::number(current_speed_, 'f', 0);
+ int fontSize = 60;
+ QFont speedFont("Quicksand", fontSize);
+ painter.setFont(speedFont);
+
+ // Calculate the bounding box of the speed number
+ QRect speedNumberRect = painter.fontMetrics().boundingRect(speedNumber);
+
+ // Center the speed number in the backgroundRect
+ QPointF speedPos(
+ backgroundRect.center().x() - speedNumberRect.width() / 2, backgroundRect.center().y());
+ painter.setPen(gray);
+ painter.drawText(speedPos, speedNumber);
+
+ QFont unitFont("Quicksand", 14);
+ painter.setFont(unitFont);
+ QString speedUnit = "km/h";
+ QRect unitRect = painter.fontMetrics().boundingRect(speedUnit);
+ QPointF unitPos(
+ (backgroundRect.width() / 2 - unitRect.width() / 2), referencePos.y() + unitRect.height());
+ painter.drawText(unitPos, speedUnit);
+}
+
+} // namespace awf_2d_overlay_vehicle
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_limit_display.cpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_limit_display.cpp
new file mode 100644
index 0000000000000..fcc1df998798b
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_limit_display.cpp
@@ -0,0 +1,105 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "speed_limit_display.hpp"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+namespace awf_2d_overlay_vehicle
+{
+
+SpeedLimitDisplay::SpeedLimitDisplay() : current_limit(0.0)
+{
+ std::string package_path = ament_index_cpp::get_package_share_directory("awf_2d_overlay_vehicle");
+ std::string font_path = package_path + "/assets/font/Quicksand/static/Quicksand-Regular.ttf";
+ std::string font_path2 = package_path + "/assets/font/Quicksand/static/Quicksand-Bold.ttf";
+ int fontId = QFontDatabase::addApplicationFont(
+ font_path.c_str()); // returns -1 on failure (see docs for more info)
+ int fontId2 = QFontDatabase::addApplicationFont(
+ font_path2.c_str()); // returns -1 on failure (see docs for more info)
+ if (fontId == -1 || fontId2 == -1) {
+ std::cout << "Failed to load the Quicksand font.";
+ }
+}
+
+void SpeedLimitDisplay::updateSpeedLimitData(
+ const tier4_planning_msgs::msg::VelocityLimit::ConstSharedPtr msg)
+{
+ current_limit = msg->max_velocity;
+}
+
+void SpeedLimitDisplay::drawSpeedLimitIndicator(QPainter & painter, const QRectF & backgroundRect)
+{
+ // Enable Antialiasing for smoother drawing
+ painter.setRenderHint(QPainter::Antialiasing, true);
+ painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
+
+ // #C2C2C2
+ painter.setPen(QPen(gray, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+ painter.setBrush(QBrush(gray, Qt::SolidPattern));
+
+ // Define the area for the outer circle
+ QRectF outerCircleRect = backgroundRect;
+ outerCircleRect.setWidth(backgroundRect.width() / 2 - 20);
+ outerCircleRect.setHeight(backgroundRect.height() - 20);
+ outerCircleRect.moveTopLeft(QPointF(backgroundRect.left() + 10, backgroundRect.top() + 10));
+
+ // Define the area for the inner circle
+ QRectF innerCircleRect = outerCircleRect;
+ innerCircleRect.setWidth(outerCircleRect.width() / 1.375);
+ innerCircleRect.setHeight(outerCircleRect.height() / 1.375);
+ innerCircleRect.moveCenter(outerCircleRect.center());
+
+ // Draw the outer circle
+ painter.drawEllipse(outerCircleRect);
+
+ // Change the composition mode and draw the inner circle
+ painter.setCompositionMode(QPainter::CompositionMode_Clear);
+ painter.drawEllipse(innerCircleRect);
+
+ // Reset the composition mode
+ painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
+
+ int current_limit_int = std::round(current_limit * 3.6);
+
+ // Define the text to be drawn
+ QString text = QString::number(current_limit_int);
+
+ // Set the font and color for the text
+ QFont font = QFont("Quicksand", 14, QFont::Bold);
+
+ painter.setFont(font);
+ // #C2C2C2
+ painter.setPen(QPen(gray, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+
+ // Draw the text in the center of the circle
+ painter.drawText(innerCircleRect, Qt::AlignCenter, text);
+}
+
+} // namespace awf_2d_overlay_vehicle
diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/steering_wheel_display.cpp b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/steering_wheel_display.cpp
new file mode 100644
index 0000000000000..b4da8ff5f8ffb
--- /dev/null
+++ b/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/steering_wheel_display.cpp
@@ -0,0 +1,123 @@
+// Copyright 2024 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "steering_wheel_display.hpp"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include