diff --git a/common/awf_vehicle_rviz_plugin/rviz_2d_overlay_msgs/CHANGELOG.rst b/common/autoware_overlay_rviz_plugin/autoware_overlay_msgs/CHANGELOG.rst similarity index 100% rename from common/awf_vehicle_rviz_plugin/rviz_2d_overlay_msgs/CHANGELOG.rst rename to common/autoware_overlay_rviz_plugin/autoware_overlay_msgs/CHANGELOG.rst diff --git a/common/awf_vehicle_rviz_plugin/rviz_2d_overlay_msgs/CMakeLists.txt b/common/autoware_overlay_rviz_plugin/autoware_overlay_msgs/CMakeLists.txt similarity index 92% rename from common/awf_vehicle_rviz_plugin/rviz_2d_overlay_msgs/CMakeLists.txt rename to common/autoware_overlay_rviz_plugin/autoware_overlay_msgs/CMakeLists.txt index 9e9a8f277fd53..e23a4e755cbc4 100644 --- a/common/awf_vehicle_rviz_plugin/rviz_2d_overlay_msgs/CMakeLists.txt +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_msgs/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(rviz_2d_overlay_msgs) +project(autoware_overlay_msgs) if (NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 17) diff --git a/common/awf_vehicle_rviz_plugin/rviz_2d_overlay_msgs/msg/OverlayText.msg b/common/autoware_overlay_rviz_plugin/autoware_overlay_msgs/msg/OverlayText.msg similarity index 100% rename from common/awf_vehicle_rviz_plugin/rviz_2d_overlay_msgs/msg/OverlayText.msg rename to common/autoware_overlay_rviz_plugin/autoware_overlay_msgs/msg/OverlayText.msg diff --git a/common/awf_vehicle_rviz_plugin/rviz_2d_overlay_msgs/package.xml b/common/autoware_overlay_rviz_plugin/autoware_overlay_msgs/package.xml similarity index 96% rename from common/awf_vehicle_rviz_plugin/rviz_2d_overlay_msgs/package.xml rename to common/autoware_overlay_rviz_plugin/autoware_overlay_msgs/package.xml index 53396c64aa156..4881b126ffffb 100644 --- a/common/awf_vehicle_rviz_plugin/rviz_2d_overlay_msgs/package.xml +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_msgs/package.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> <package format="3"> - <name>rviz_2d_overlay_msgs</name> + <name>autoware_overlay_msgs</name> <version>1.3.0</version> <description>Messages describing 2D overlays for RVIZ, extracted/derived from the jsk_visualization package.</description> <maintainer email="team-spatzenhirn@uni-ulm.de">Team Spatzenhirn</maintainer> diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/CMakeLists.txt b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/CMakeLists.txt similarity index 94% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/CMakeLists.txt rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/CMakeLists.txt index da67a6f63aeae..afb12bffeeaa7 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/CMakeLists.txt +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(awf_2d_overlay_vehicle) +project(autoware_overlay_rviz_plugin) # find dependencies find_package(ament_cmake_auto REQUIRED) @@ -9,7 +9,7 @@ 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(autoware_overlay_msgs REQUIRED) find_package(rviz_common REQUIRED) find_package(rviz_rendering REQUIRED) @@ -90,7 +90,7 @@ ament_target_dependencies( PUBLIC rviz_common rviz_rendering - rviz_2d_overlay_msgs + autoware_overlay_msgs autoware_auto_vehicle_msgs tier4_planning_msgs autoware_perception_msgs @@ -136,5 +136,5 @@ install( add_definitions(-DQT_NO_KEYWORDS) ament_package( - CONFIG_EXTRAS "awf_2d_overlay_vehicle-extras.cmake" + CONFIG_EXTRAS "autoware_overlay_rviz_plugin-extras.cmake" ) diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/LICENSE b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/LICENSE similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/LICENSE rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/LICENSE diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/README.md b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/README.md new file mode 100644 index 0000000000000..0d0def1a46997 --- /dev/null +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/README.md @@ -0,0 +1,54 @@ +# autoware_overlay_rviz_plugin + +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 velocity | +| `/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 | +| `/planning/scenario_planning/current_max_velocity` | `tier4_planning_msgs::msg::VelocityLimit` | The topic is velocity limit | +| `/perception/traffic_light_recognition/traffic_signals` | `autoware_perception_msgs::msg::TrafficSignalArray` | The topic is status of traffic light | + +## 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 `rviz2` and click `Add` button under the `Displays` panel. + +  + +2. Under `By display type` tab, select `autoware_overlay_rviz_plugin/SignalDisplay` and press OK. + +3. Enter the names of the topics if necessary. + +  diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/LICENSE b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/LICENSE similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/LICENSE rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/LICENSE diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Bold.ttf b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/static/Quicksand-Bold.ttf similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Bold.ttf rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/static/Quicksand-Bold.ttf diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Light.ttf b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/static/Quicksand-Light.ttf similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Light.ttf rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/static/Quicksand-Light.ttf diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Medium.ttf b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/static/Quicksand-Medium.ttf similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Medium.ttf rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/static/Quicksand-Medium.ttf diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Regular.ttf b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/static/Quicksand-Regular.ttf similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-Regular.ttf rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/static/Quicksand-Regular.ttf diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-SemiBold.ttf b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/static/Quicksand-SemiBold.ttf similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/font/Quicksand/static/Quicksand-SemiBold.ttf rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/font/Quicksand/static/Quicksand-SemiBold.ttf diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/arrow.png b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/arrow.png similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/arrow.png rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/arrow.png diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_add.png b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/select_add.png similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_add.png rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/select_add.png diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/select_topic_name.png b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/select_topic_name.png new file mode 100644 index 0000000000000..490552efc114f Binary files /dev/null and b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/select_topic_name.png differ diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/traffic.png b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/traffic.png new file mode 100644 index 0000000000000..79715b0573e1a Binary files /dev/null and b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/traffic.png differ diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/wheel.png b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/wheel.png similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/wheel.png rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets/images/wheel.png diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/awf_2d_overlay_vehicle-extras.cmake b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin-extras.cmake similarity index 100% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/awf_2d_overlay_vehicle-extras.cmake rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin-extras.cmake diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/gear_display.hpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/gear_display.hpp similarity index 94% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/gear_display.hpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/gear_display.hpp index b289bfc541cee..3fe473d5d5123 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/gear_display.hpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/gear_display.hpp @@ -29,7 +29,7 @@ #include <OgreMaterial.h> #include <OgreTexture.h> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { class GearDisplay @@ -44,6 +44,6 @@ class GearDisplay QColor gray = QColor(194, 194, 194); }; -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #endif // GEAR_DISPLAY_HPP_ diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_text_display.hpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/overlay_text_display.hpp similarity index 93% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_text_display.hpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/overlay_text_display.hpp index 9b3ecccf6301c..ccea51b9a5349 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_text_display.hpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/overlay_text_display.hpp @@ -50,7 +50,7 @@ #ifndef OVERLAY_TEXT_DISPLAY_HPP_ #define OVERLAY_TEXT_DISPLAY_HPP_ -#include "rviz_2d_overlay_msgs/msg/overlay_text.hpp" +#include "autoware_overlay_msgs/msg/overlay_text.hpp" #ifndef Q_MOC_RUN #include "overlay_utils.hpp" @@ -69,10 +69,10 @@ #include <string> #endif -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { class OverlayTextDisplay -: public rviz_common::RosTopicDisplay<rviz_2d_overlay_msgs::msg::OverlayText> +: public rviz_common::RosTopicDisplay<autoware_overlay_msgs::msg::OverlayText> { Q_OBJECT public: @@ -80,7 +80,7 @@ class OverlayTextDisplay virtual ~OverlayTextDisplay(); protected: - awf_2d_overlay_vehicle::OverlayObject::SharedPtr overlay_; + autoware_overlay_rviz_plugin::OverlayObject::SharedPtr overlay_; int texture_width_; int texture_height_; @@ -150,8 +150,8 @@ protected Q_SLOTS: void updateLineWidth(); private: - void processMessage(rviz_2d_overlay_msgs::msg::OverlayText::ConstSharedPtr msg) override; + void processMessage(autoware_overlay_msgs::msg::OverlayText::ConstSharedPtr msg) override; }; -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #endif // OVERLAY_TEXT_DISPLAY_HPP_ diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_utils.hpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/overlay_utils.hpp similarity index 90% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_utils.hpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/overlay_utils.hpp index 1270f15ca80ae..8581628ef0bce 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/overlay_utils.hpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/overlay_utils.hpp @@ -54,7 +54,7 @@ #include <QColor> #include <QImage> -#include "rviz_2d_overlay_msgs/msg/overlay_text.hpp" +#include "autoware_overlay_msgs/msg/overlay_text.hpp" #include <OgreHardwarePixelBuffer.h> #include <OgreMaterialManager.h> @@ -70,7 +70,7 @@ #include <memory> #include <string> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { class OverlayObject; @@ -90,15 +90,15 @@ class ScopedPixelBuffer }; 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, + CENTER = autoware_overlay_msgs::msg::OverlayText::CENTER, + TOP = autoware_overlay_msgs::msg::OverlayText::TOP, + BOTTOM = autoware_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 + LEFT = autoware_overlay_msgs::msg::OverlayText::LEFT, + RIGHT = autoware_overlay_msgs::msg::OverlayText::RIGHT, + CENTER = autoware_overlay_msgs::msg::OverlayText::CENTER }; /** @@ -136,6 +136,6 @@ class OverlayObject Ogre::MaterialPtr panel_material_; Ogre::TexturePtr texture_; }; -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #endif // OVERLAY_UTILS_HPP_ diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/signal_display.hpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/signal_display.hpp similarity index 93% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/signal_display.hpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/signal_display.hpp index aff475aba2f33..4fa39f2c5a903 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/signal_display.hpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/signal_display.hpp @@ -39,7 +39,7 @@ #include <mutex> #endif -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { class SignalDisplay : public rviz_common::Display { @@ -70,7 +70,7 @@ private Q_SLOTS: private: std::mutex mutex_; - awf_2d_overlay_vehicle::OverlayObject::SharedPtr overlay_; + autoware_overlay_rviz_plugin::OverlayObject::SharedPtr overlay_; rviz_common::properties::IntProperty * property_width_; rviz_common::properties::IntProperty * property_height_; rviz_common::properties::IntProperty * property_left_; @@ -84,7 +84,8 @@ private Q_SLOTS: std::unique_ptr<rviz_common::properties::RosTopicProperty> traffic_topic_property_; std::unique_ptr<rviz_common::properties::RosTopicProperty> speed_limit_topic_property_; - void drawBackground(QPainter & painter, const QRectF & backgroundRect); + void drawHorizontalRoundedRectangle(QPainter & painter, const QRectF & backgroundRect); + void drawVerticalRoundedRectangle(QPainter & painter, const QRectF & backgroundRect); void setupRosSubscriptions(); std::unique_ptr<SteeringWheelDisplay> steering_wheel_display_; @@ -119,6 +120,6 @@ private Q_SLOTS: const autoware_perception_msgs::msg::TrafficSignalArray::ConstSharedPtr msg); void drawWidget(QImage & hud); }; -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #endif // SIGNAL_DISPLAY_HPP_ diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_display.hpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/speed_display.hpp similarity index 94% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_display.hpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/speed_display.hpp index 317e45917f927..0669028dba3b2 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_display.hpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/speed_display.hpp @@ -29,7 +29,7 @@ #include <OgreMaterial.h> #include <OgreTexture.h> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { class SpeedDisplay @@ -44,6 +44,6 @@ class SpeedDisplay QColor gray = QColor(194, 194, 194); }; -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #endif // SPEED_DISPLAY_HPP_ diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_limit_display.hpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/speed_limit_display.hpp similarity index 78% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_limit_display.hpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/speed_limit_display.hpp index 00eae077ff2ac..b59f4acf380db 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/speed_limit_display.hpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/speed_limit_display.hpp @@ -23,13 +23,14 @@ #include <rviz_common/properties/int_property.hpp> #include <rviz_common/ros_topic_display.hpp> +#include "autoware_auto_vehicle_msgs/msg/velocity_report.hpp" #include <tier4_planning_msgs/msg/velocity_limit.hpp> #include <OgreColourValue.h> #include <OgreMaterial.h> #include <OgreTexture.h> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { class SpeedLimitDisplay @@ -38,12 +39,14 @@ class SpeedLimitDisplay SpeedLimitDisplay(); void drawSpeedLimitIndicator(QPainter & painter, const QRectF & backgroundRect); void updateSpeedLimitData(const tier4_planning_msgs::msg::VelocityLimit::ConstSharedPtr msg); + void updateSpeedData(const autoware_auto_vehicle_msgs::msg::VelocityReport::ConstSharedPtr & msg); private: - float current_limit; // Internal variable to store current gear + float current_limit; // Internal variable to store current gear + float current_speed_; // Internal variable to store current speed QColor gray = QColor(194, 194, 194); }; -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #endif // SPEED_LIMIT_DISPLAY_HPP_ diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/steering_wheel_display.hpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/steering_wheel_display.hpp similarity index 94% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/steering_wheel_display.hpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/steering_wheel_display.hpp index a8291064c3807..121ee9a0a4d84 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/steering_wheel_display.hpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/steering_wheel_display.hpp @@ -29,7 +29,7 @@ #include <OgreMaterial.h> #include <OgreTexture.h> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { class SteeringWheelDisplay @@ -49,6 +49,6 @@ class SteeringWheelDisplay QImage coloredImage(const QImage & source, const QColor & color); }; -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #endif // STEERING_WHEEL_DISPLAY_HPP_ diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/traffic_display.hpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/traffic_display.hpp similarity index 84% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/traffic_display.hpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/traffic_display.hpp index bf776d27dfa94..20410a78edc44 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/traffic_display.hpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/traffic_display.hpp @@ -31,7 +31,7 @@ #include <OgreMaterial.h> #include <OgreTexture.h> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { class TrafficDisplay @@ -45,18 +45,15 @@ class TrafficDisplay 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); + + const QColor tl_red_; + const QColor tl_yellow_; + const QColor tl_green_; + const QColor tl_gray_; QImage coloredImage(const QImage & source, const QColor & color); }; -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #endif // TRAFFIC_DISPLAY_HPP_ diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/turn_signals_display.hpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/turn_signals_display.hpp similarity index 94% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/turn_signals_display.hpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/turn_signals_display.hpp index cd659883c9ca0..87f141353d5b2 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/include/turn_signals_display.hpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/turn_signals_display.hpp @@ -32,7 +32,7 @@ #include <chrono> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { class TurnSignalsDisplay @@ -47,7 +47,7 @@ class TurnSignalsDisplay private: QImage arrowImage; - QColor gray = QColor(194, 194, 194); + QColor gray = QColor(46, 46, 46); int current_turn_signal_; // Internal variable to store turn signal state int current_hazard_lights_; // Internal variable to store hazard lights state @@ -58,6 +58,6 @@ class TurnSignalsDisplay const std::chrono::milliseconds blink_interval_{500}; // Blink interval in milliseconds }; -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #endif // TURN_SIGNALS_DISPLAY_HPP_ diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/package.xml b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/package.xml similarity index 91% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/package.xml rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/package.xml index b19b384d020b6..cc0ada00fa41b 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/package.xml +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/package.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> <package format="3"> - <name>awf_2d_overlay_vehicle</name> + <name>autoware_overlay_rviz_plugin</name> <version>0.0.1</version> <description> RViz2 plugin for 2D overlays in the 3D view. Mainly a port of the JSK overlay plugin @@ -12,9 +12,9 @@ <license>BSD-3-Clause</license> <depend>autoware_auto_vehicle_msgs</depend> + <depend>autoware_overlay_msgs</depend> <depend>autoware_perception_msgs</depend> <depend>boost</depend> - <depend>rviz_2d_overlay_msgs</depend> <depend>rviz_common</depend> <depend>rviz_ogre_vendor</depend> <depend>rviz_rendering</depend> diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/plugins_description.xml b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/plugins_description.xml new file mode 100644 index 0000000000000..05c33f2fd10a5 --- /dev/null +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/plugins_description.xml @@ -0,0 +1,5 @@ +<library path="autoware_overlay_rviz_plugin"> + <class name="autoware_overlay_rviz_plugin/SignalDisplay" type="autoware_overlay_rviz_plugin::SignalDisplay" base_class_type="rviz_common::Display"> + <description>Signal overlay plugin for the 3D view.</description> + </class> +</library> diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/gear_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/gear_display.cpp similarity index 92% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/gear_display.cpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/gear_display.cpp index 153e106f04264..8f05ce6fdce1c 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/gear_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/gear_display.cpp @@ -31,12 +31,13 @@ #include <memory> #include <string> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { GearDisplay::GearDisplay() : current_gear_(0) { - std::string package_path = ament_index_cpp::get_package_share_directory("awf_2d_overlay_vehicle"); + std::string package_path = + ament_index_cpp::get_package_share_directory("autoware_overlay_rviz_plugin"); 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( @@ -91,8 +92,8 @@ void GearDisplay::drawGearIndicator(QPainter & painter, const QRectF & backgroun 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.drawRoundedRect(gearRect, 10, 10); painter.drawText(gearRect, Qt::AlignCenter, QString::fromStdString(gearString)); } -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_text_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/overlay_text_display.cpp similarity index 93% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_text_display.cpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/overlay_text_display.cpp index 053d0f6e981c0..b853e14a5858d 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_text_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/overlay_text_display.cpp @@ -67,7 +67,7 @@ #include <regex> #include <sstream> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { OverlayTextDisplay::OverlayTextDisplay() : texture_width_(0), @@ -105,15 +105,15 @@ OverlayTextDisplay::OverlayTextDisplay() 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); + hor_alignment_property_->addOption("left", autoware_overlay_msgs::msg::OverlayText::LEFT); + hor_alignment_property_->addOption("center", autoware_overlay_msgs::msg::OverlayText::CENTER); + hor_alignment_property_->addOption("right", autoware_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); + ver_alignment_property_->addOption("top", autoware_overlay_msgs::msg::OverlayText::TOP); + ver_alignment_property_->addOption("center", autoware_overlay_msgs::msg::OverlayText::CENTER); + ver_alignment_property_->addOption("bottom", autoware_overlay_msgs::msg::OverlayText::BOTTOM); width_property_ = new rviz_common::properties::IntProperty( "width", 128, "width position", this, SLOT(updateWidth())); width_property_->setMin(0); @@ -212,7 +212,7 @@ void OverlayTextDisplay::update(float /*wall_dt*/, float /*ros_dt*/) overlay_->updateTextureSize(texture_width_, texture_height_); { - awf_2d_overlay_vehicle::ScopedPixelBuffer buffer = overlay_->getBuffer(); + autoware_overlay_rviz_plugin::ScopedPixelBuffer buffer = overlay_->getBuffer(); QImage Hud = buffer.getQImage(*overlay_, bg_color_); QPainter painter(&Hud); painter.setRenderHint(QPainter::Antialiasing, true); @@ -288,7 +288,7 @@ void OverlayTextDisplay::reset() } } -void OverlayTextDisplay::processMessage(rviz_2d_overlay_msgs::msg::OverlayText::ConstSharedPtr msg) +void OverlayTextDisplay::processMessage(autoware_overlay_msgs::msg::OverlayText::ConstSharedPtr msg) { if (!isEnabled()) { return; @@ -297,13 +297,13 @@ void OverlayTextDisplay::processMessage(rviz_2d_overlay_msgs::msg::OverlayText:: static int count = 0; std::stringstream ss; ss << "OverlayTextDisplayObject" << count++; - overlay_.reset(new awf_2d_overlay_vehicle::OverlayObject(ss.str())); + overlay_.reset(new autoware_overlay_rviz_plugin::OverlayObject(ss.str())); overlay_->show(); } if (overlay_) { - if (msg->action == rviz_2d_overlay_msgs::msg::OverlayText::DELETE) { + if (msg->action == autoware_overlay_msgs::msg::OverlayText::DELETE) { overlay_->hide(); - } else if (msg->action == rviz_2d_overlay_msgs::msg::OverlayText::ADD) { + } else if (msg->action == autoware_overlay_msgs::msg::OverlayText::ADD) { overlay_->show(); } } @@ -550,7 +550,7 @@ void OverlayTextDisplay::updateLineWidth() } } -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #include <pluginlib/class_list_macros.hpp> -PLUGINLIB_EXPORT_CLASS(awf_2d_overlay_vehicle::OverlayTextDisplay, rviz_common::Display) +PLUGINLIB_EXPORT_CLASS(autoware_overlay_rviz_plugin::OverlayTextDisplay, rviz_common::Display) diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_utils.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/overlay_utils.cpp similarity index 99% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_utils.cpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/overlay_utils.cpp index e65a74415fb6a..d6f061e724369 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/overlay_utils.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/overlay_utils.cpp @@ -52,7 +52,7 @@ #include <rviz_common/logging.hpp> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { ScopedPixelBuffer::ScopedPixelBuffer(Ogre::HardwarePixelBufferSharedPtr pixel_buffer) : pixel_buffer_(pixel_buffer) @@ -264,4 +264,4 @@ unsigned int OverlayObject::getTextureHeight() const return 0; } } -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/signal_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/signal_display.cpp similarity index 92% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/signal_display.cpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/signal_display.cpp index f2a82dd386b37..b2995327eb472 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/signal_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/signal_display.cpp @@ -33,7 +33,7 @@ #include <mutex> #include <string> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { SignalDisplay::SignalDisplay() @@ -47,7 +47,7 @@ SignalDisplay::SignalDisplay() 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, + "Signal Color", QColor(QString("#00E678")), "Color of the signal arrows", this, SLOT(updateOverlayColor())); // Initialize the component displays @@ -68,7 +68,7 @@ void SignalDisplay::onInitialize() static int count = 0; std::stringstream ss; ss << "SignalDisplayObject" << count++; - overlay_.reset(new awf_2d_overlay_vehicle::OverlayObject(ss.str())); + overlay_.reset(new autoware_overlay_rviz_plugin::OverlayObject(ss.str())); overlay_->show(); updateOverlaySize(); updateOverlayPosition(); @@ -206,7 +206,7 @@ void SignalDisplay::update(float /* wall_dt */, float /* ros_dt */) if (!overlay_) { return; } - awf_2d_overlay_vehicle::ScopedPixelBuffer buffer = overlay_->getBuffer(); + autoware_overlay_rviz_plugin::ScopedPixelBuffer buffer = overlay_->getBuffer(); QImage hud = buffer.getQImage(*overlay_); hud.fill(Qt::transparent); drawWidget(hud); @@ -297,6 +297,7 @@ void SignalDisplay::updateSpeedData( if (speed_display_) { speed_display_->updateSpeedData(msg); + speed_limit_display_->updateSpeedData(msg); queueRender(); } } @@ -324,7 +325,7 @@ void SignalDisplay::drawWidget(QImage & hud) painter.setRenderHint(QPainter::Antialiasing, true); QRectF backgroundRect(0, 0, 322, hud.height()); - drawBackground(painter, backgroundRect); + drawHorizontalRoundedRectangle(painter, backgroundRect); // Draw components if (steering_wheel_display_) { @@ -342,9 +343,9 @@ void SignalDisplay::drawWidget(QImage & hud) // a 27px space between the two halves of the HUD - QRectF smallerBackgroundRect(349, 0, 168, hud.height() / 2); + QRectF smallerBackgroundRect(340, 0, 190.0 / 2, hud.height()); - drawBackground(painter, smallerBackgroundRect); + drawVerticalRoundedRectangle(painter, smallerBackgroundRect); if (traffic_display_) { traffic_display_->drawTrafficLightIndicator(painter, smallerBackgroundRect); @@ -357,13 +358,33 @@ void SignalDisplay::drawWidget(QImage & hud) painter.end(); } -void SignalDisplay::drawBackground(QPainter & painter, const QRectF & backgroundRect) +void SignalDisplay::drawHorizontalRoundedRectangle( + QPainter & painter, const QRectF & backgroundRect) { - painter.setBrush(QColor(0, 0, 0, 255 * 0.2)); // Black background with opacity + painter.setRenderHint(QPainter::Antialiasing, true); + QColor colorFromHSV; + colorFromHSV.setHsv(0, 0, 0); // Hue, Saturation, Value + colorFromHSV.setAlphaF(0.65); // Transparency + + painter.setBrush(colorFromHSV); + painter.setPen(Qt::NoPen); painter.drawRoundedRect( backgroundRect, backgroundRect.height() / 2, backgroundRect.height() / 2); // Circular ends } +void SignalDisplay::drawVerticalRoundedRectangle(QPainter & painter, const QRectF & backgroundRect) +{ + painter.setRenderHint(QPainter::Antialiasing, true); + QColor colorFromHSV; + colorFromHSV.setHsv(0, 0, 0); // Hue, Saturation, Value + colorFromHSV.setAlphaF(0.65); // Transparency + + painter.setBrush(colorFromHSV); + + painter.setPen(Qt::NoPen); + painter.drawRoundedRect( + backgroundRect, backgroundRect.width() / 2, backgroundRect.width() / 2); // Circular ends +} void SignalDisplay::reset() { @@ -495,7 +516,7 @@ void SignalDisplay::topic_updated_traffic() }); } -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin #include <pluginlib/class_list_macros.hpp> -PLUGINLIB_EXPORT_CLASS(awf_2d_overlay_vehicle::SignalDisplay, rviz_common::Display) +PLUGINLIB_EXPORT_CLASS(autoware_overlay_rviz_plugin::SignalDisplay, rviz_common::Display) diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_display.cpp similarity index 95% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_display.cpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_display.cpp index 8212758c09a9f..b1df14956d16c 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_display.cpp @@ -31,12 +31,13 @@ #include <memory> #include <string> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { SpeedDisplay::SpeedDisplay() : current_speed_(0.0) { - std::string package_path = ament_index_cpp::get_package_share_directory("awf_2d_overlay_vehicle"); + std::string package_path = + ament_index_cpp::get_package_share_directory("autoware_overlay_rviz_plugin"); 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( @@ -106,4 +107,4 @@ void SpeedDisplay::drawSpeedDisplay(QPainter & painter, const QRectF & backgroun painter.drawText(unitPos, speedUnit); } -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_limit_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp similarity index 54% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_limit_display.cpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp index fcc1df998798b..6913ef6a48ecd 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/speed_limit_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp @@ -31,12 +31,13 @@ #include <memory> #include <string> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { -SpeedLimitDisplay::SpeedLimitDisplay() : current_limit(0.0) +SpeedLimitDisplay::SpeedLimitDisplay() : current_limit(0.0), current_speed_(0.0) { - std::string package_path = ament_index_cpp::get_package_share_directory("awf_2d_overlay_vehicle"); + std::string package_path = + ament_index_cpp::get_package_share_directory("autoware_overlay_rviz_plugin"); 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( @@ -54,45 +55,81 @@ void SpeedLimitDisplay::updateSpeedLimitData( current_limit = msg->max_velocity; } +void SpeedLimitDisplay::updateSpeedData( + const autoware_auto_vehicle_msgs::msg::VelocityReport::ConstSharedPtr & msg) +{ + try { + float speed = msg->longitudinal_velocity; + current_speed_ = speed; + } catch (const std::exception & e) { + // Log the error + std::cerr << "Error in processMessage: " << e.what() << std::endl; + } +} + 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)); + const double color_s_min = 0.4; + const double color_s_max = 0.8; + QColor colorMin; + colorMin.setHsvF(0.0, color_s_min, 1.0); + QColor colorMax; + colorMax.setHsvF(0.0, color_s_max, 1.0); + + QColor borderColor = colorMin; + if (current_limit > 0.0) { + double speed_to_limit_ratio = current_speed_ / current_limit; + const double speed_to_limit_ratio_min = 0.6; + const double speed_to_limit_ratio_max = 0.9; + + if (speed_to_limit_ratio >= speed_to_limit_ratio_max) { + borderColor = colorMax; + } else if (speed_to_limit_ratio > speed_to_limit_ratio_min) { + double interpolation_factor = (speed_to_limit_ratio - speed_to_limit_ratio_min) / + (speed_to_limit_ratio_max - speed_to_limit_ratio_min); + // Interpolate between colorMin and colorMax + double saturation = color_s_min + (color_s_max - color_s_min) * interpolation_factor; + + borderColor.setHsvF(0.0, saturation, 1.0); + } + } // 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)); + outerCircleRect.setWidth(backgroundRect.width() - 30); + outerCircleRect.setHeight(backgroundRect.width() - 30); + outerCircleRect.moveTopLeft(QPointF(backgroundRect.left() + 15, backgroundRect.top() + 10)); + + // Now use borderColor for drawing + painter.setPen(QPen(borderColor, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter.setBrush(borderColor); + // Draw the outer circle for the speed limit indicator + painter.drawEllipse(outerCircleRect); // Define the area for the inner circle QRectF innerCircleRect = outerCircleRect; - innerCircleRect.setWidth(outerCircleRect.width() / 1.375); - innerCircleRect.setHeight(outerCircleRect.height() / 1.375); + innerCircleRect.setWidth(outerCircleRect.width() / 1.25); + innerCircleRect.setHeight(outerCircleRect.height() / 1.25); innerCircleRect.moveCenter(outerCircleRect.center()); - // Draw the outer circle - painter.drawEllipse(outerCircleRect); + painter.setRenderHint(QPainter::Antialiasing, true); + QColor colorFromHSV; + colorFromHSV.setHsv(0, 0, 0); // Hue, Saturation, Value - // Change the composition mode and draw the inner circle - painter.setCompositionMode(QPainter::CompositionMode_Clear); + painter.setBrush(colorFromHSV); 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); + QFont font = QFont("Quicksand", 24, QFont::Bold); painter.setFont(font); // #C2C2C2 @@ -102,4 +139,4 @@ void SpeedLimitDisplay::drawSpeedLimitIndicator(QPainter & painter, const QRectF painter.drawText(innerCircleRect, Qt::AlignCenter, text); } -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/steering_wheel_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/steering_wheel_display.cpp similarity index 95% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/steering_wheel_display.cpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/steering_wheel_display.cpp index b4da8ff5f8ffb..5882d7780dc92 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/steering_wheel_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/steering_wheel_display.cpp @@ -31,13 +31,14 @@ #include <memory> #include <string> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { SteeringWheelDisplay::SteeringWheelDisplay() { // Load the Quicksand font - std::string package_path = ament_index_cpp::get_package_share_directory("awf_2d_overlay_vehicle"); + std::string package_path = + ament_index_cpp::get_package_share_directory("autoware_overlay_rviz_plugin"); 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( @@ -120,4 +121,4 @@ QImage SteeringWheelDisplay::coloredImage(const QImage & source, const QColor & return result; } -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/traffic_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/traffic_display.cpp similarity index 54% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/traffic_display.cpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/traffic_display.cpp index 233da1f36b4a7..4fea8f78b80da 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/traffic_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/traffic_display.cpp @@ -31,13 +31,18 @@ #include <memory> #include <string> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { TrafficDisplay::TrafficDisplay() +: tl_red_(QString("#cc3d3d")), + tl_yellow_(QString("#ccb43d")), + tl_green_(QString("#3dcc55")), + tl_gray_(QString("#4f4f4f")) { // Load the traffic light image - std::string package_path = ament_index_cpp::get_package_share_directory("awf_2d_overlay_vehicle"); + std::string package_path = + ament_index_cpp::get_package_share_directory("autoware_overlay_rviz_plugin"); std::string image_path = package_path + "/assets/images/traffic.png"; traffic_light_image_.load(image_path.c_str()); } @@ -54,50 +59,60 @@ void TrafficDisplay::drawTrafficLightIndicator(QPainter & painter, const QRectF painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::SmoothPixmapTransform, true); + painter.setBrush(QBrush(tl_gray_, Qt::SolidPattern)); + painter.setPen(Qt::NoPen); // Define the area for the circle (background) QRectF circleRect = backgroundRect; - circleRect.setWidth(backgroundRect.width() / 2 - 20); - circleRect.setHeight(backgroundRect.height() - 20); - circleRect.moveTopRight(QPointF(backgroundRect.right() - 10, backgroundRect.top() + 10)); - - painter.setBrush(QBrush(gray)); - painter.drawEllipse(circleRect.center(), 30, 30); - - // Define the area for the traffic light image (should be smaller or positioned within the circle) - QRectF imageRect = - circleRect.adjusted(15, 15, -15, -15); // Adjusting the rectangle to make the image smaller - - QImage scaled_traffic_image = traffic_light_image_.scaled( - imageRect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation); - - if (current_traffic_.signals.size() > 0) { + circleRect.setWidth(backgroundRect.width() - 30); + circleRect.setHeight(backgroundRect.width() - 30); + circleRect.moveTopRight(QPointF( + backgroundRect.left() + circleRect.width() + 15, + backgroundRect.top() + circleRect.height() + 30)); + painter.drawEllipse(circleRect); + + if (!current_traffic_.signals.empty()) { switch (current_traffic_.signals[0].elements[0].color) { case 1: - painter.setBrush(QBrush(red)); - painter.drawEllipse(circleRect.center(), 30, 30); + painter.setBrush(QBrush(tl_red_)); + painter.drawEllipse(circleRect); break; case 2: - painter.setBrush(QBrush(yellow)); - painter.drawEllipse(circleRect.center(), 30, 30); + painter.setBrush(QBrush(tl_yellow_)); + painter.drawEllipse(circleRect); break; case 3: - painter.setBrush(QBrush(green)); - painter.drawEllipse(circleRect.center(), 30, 30); + painter.setBrush(QBrush(tl_green_)); + painter.drawEllipse(circleRect); break; case 4: - painter.setBrush(QBrush(gray)); - painter.drawEllipse(circleRect.center(), 30, 30); + painter.setBrush(tl_gray_); + painter.drawEllipse(circleRect); break; default: - painter.setBrush(QBrush(gray)); - painter.drawEllipse(circleRect.center(), 30, 30); + painter.setBrush(tl_gray_); + painter.drawEllipse(circleRect); break; } } - // make the image thicker - painter.setPen(QPen(Qt::black, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); - painter.drawImage(imageRect, scaled_traffic_image); + // Scaling factor (e.g., 1.5 for 150% size) + float scaleFactor = 1.00; + + // Calculate the scaled size + QSize scaledSize = traffic_light_image_.size() * scaleFactor; + + // Ensure the scaled image is still within the circle bounds or adjust scaleFactor accordingly + + // Calculate the centered rectangle for the scaled image + QRectF scaledImageRect(0, 0, scaledSize.width(), scaledSize.height()); + scaledImageRect.moveCenter(circleRect.center()); + + // Scale the image to the new size + QImage scaledTrafficImage = + traffic_light_image_.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); + + // Draw the scaled and centered image + painter.drawImage(scaledImageRect.topLeft(), scaledTrafficImage); } QImage TrafficDisplay::coloredImage(const QImage & source, const QColor & color) @@ -110,4 +125,4 @@ QImage TrafficDisplay::coloredImage(const QImage & source, const QColor & color) return result; } -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin diff --git a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/turn_signals_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/turn_signals_display.cpp similarity index 95% rename from common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/turn_signals_display.cpp rename to common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/turn_signals_display.cpp index a9b780cb4eab2..b6d37062bf08b 100644 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/src/turn_signals_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/turn_signals_display.cpp @@ -31,7 +31,7 @@ #include <memory> #include <string> -namespace awf_2d_overlay_vehicle +namespace autoware_overlay_rviz_plugin { TurnSignalsDisplay::TurnSignalsDisplay() : current_turn_signal_(0) @@ -39,7 +39,8 @@ TurnSignalsDisplay::TurnSignalsDisplay() : current_turn_signal_(0) last_toggle_time_ = std::chrono::steady_clock::now(); // Load the arrow image - std::string package_path = ament_index_cpp::get_package_share_directory("awf_2d_overlay_vehicle"); + std::string package_path = + ament_index_cpp::get_package_share_directory("autoware_overlay_rviz_plugin"); std::string image_path = package_path + "/assets/images/arrow.png"; arrowImage.load(image_path.c_str()); } @@ -119,4 +120,4 @@ QImage TurnSignalsDisplay::coloredImage(const QImage & source, const QColor & co return result; } -} // namespace awf_2d_overlay_vehicle +} // namespace autoware_overlay_rviz_plugin 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 deleted file mode 100644 index 6728f26878e10..0000000000000 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# 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. - -  - -2. Select any one of the tier4_vehicle_rviz_plugin and press OK. - -  - -3. Enter the name of the topic where you want to view the status. - -  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 deleted file mode 100644 index 5466bcf0050df..0000000000000 Binary files a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_topic_name.png and /dev/null 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 deleted file mode 100644 index 863f63d728616..0000000000000 Binary files a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/select_vehicle_plugin.png and /dev/null 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 deleted file mode 100644 index 960985a3da5de..0000000000000 Binary files a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/assets/images/traffic.png and /dev/null differ 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 deleted file mode 100644 index 8a5af0abcf0dd..0000000000000 --- a/common/awf_vehicle_rviz_plugin/awf_2d_overlay_vehicle/plugins_description.xml +++ /dev/null @@ -1,5 +0,0 @@ -<library path="awf_2d_overlay_vehicle"> - <class name="awf_2d_overlay_vehicle/SignalDisplay" type="awf_2d_overlay_vehicle::SignalDisplay" base_class_type="rviz_common::Display"> - <description>Signal overlay plugin for the 3D view.</description> - </class> -</library>