Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update vehicle overlay plugin #6323

Merged
merged 23 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cfcaf9b
refactor: rename all files and classes to align with updated naming c…
Feb 5, 2024
dc5a5ad
style: get a darker background opacity
Feb 5, 2024
56f8718
style: update turn signals on/off default colors
Feb 5, 2024
5fcd1e5
style: gear box more rounded
Feb 5, 2024
ae6494a
style: font bigger inside speed limit
Feb 5, 2024
4c88a15
style: set opaque bg to speed limit text
Feb 5, 2024
466ad5f
style: scaled up circle and icon for the traffic light
Feb 5, 2024
2934ede
feat: vertical / horizontal rounded backgrounds
Feb 5, 2024
26e5dd4
style: correct positionning and sizing according to new vertical style
Feb 5, 2024
0df4c3b
style: better sizing of the donut in speed limit
Feb 5, 2024
4166e96
feat: update speed data in speed_limit_display as well
Feb 5, 2024
0613f20
feat: added color interpolation for speed limiter's donut according t…
Feb 5, 2024
bd9b0c7
style(pre-commit): autofix
pre-commit-ci[bot] Feb 5, 2024
747000d
fix: spell check partial qreal to float
Feb 5, 2024
0a247c0
rename package to autoware_overlay_rviz_plugin
Feb 6, 2024
72a223a
style(pre-commit): autofix
pre-commit-ci[bot] Feb 6, 2024
59c032e
Update turn signals ON color
KhalilSelyan Feb 6, 2024
1cd7e00
fix: circle no longer becomes black when speed higher than limit
Feb 6, 2024
01e64e7
fix: 0-70% light red 70%-100% interpolate to red
Feb 6, 2024
d1b7cd7
traffic light color overhaul
Feb 6, 2024
3fb80f1
update the readme
Feb 6, 2024
4d71c15
fix: update readme with traffic light and speed limit information
Feb 6, 2024
b67d420
simplify the color transition and switch to the hsv
Feb 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
)
Original file line number Diff line number Diff line change
@@ -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.

![select_add](./assets/images/select_add.png)

2. Under `By display type` tab, select `autoware_overlay_rviz_plugin/SignalDisplay` and press OK.

3. Enter the names of the topics if necessary.

![select_topic_name](./assets/images/select_topic_name.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <OgreMaterial.h>
#include <OgreTexture.h>

namespace awf_2d_overlay_vehicle
namespace autoware_overlay_rviz_plugin
{

class GearDisplay
Expand All @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -69,18 +69,18 @@
#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:
OverlayTextDisplay();
virtual ~OverlayTextDisplay();

protected:
awf_2d_overlay_vehicle::OverlayObject::SharedPtr overlay_;
autoware_overlay_rviz_plugin::OverlayObject::SharedPtr overlay_;

int texture_width_;
int texture_height_;
Expand Down Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -70,7 +70,7 @@
#include <memory>
#include <string>

namespace awf_2d_overlay_vehicle
namespace autoware_overlay_rviz_plugin
{
class OverlayObject;

Expand All @@ -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
};

/**
Expand Down Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <mutex>
#endif

namespace awf_2d_overlay_vehicle
namespace autoware_overlay_rviz_plugin
{
class SignalDisplay : public rviz_common::Display
{
Expand Down Expand Up @@ -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_;
Expand All @@ -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_;
Expand Down Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <OgreMaterial.h>
#include <OgreTexture.h>

namespace awf_2d_overlay_vehicle
namespace autoware_overlay_rviz_plugin
{

class SpeedDisplay
Expand All @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <OgreMaterial.h>
#include <OgreTexture.h>

namespace awf_2d_overlay_vehicle
namespace autoware_overlay_rviz_plugin
{

class SteeringWheelDisplay
Expand All @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <OgreMaterial.h>
#include <OgreTexture.h>

namespace awf_2d_overlay_vehicle
namespace autoware_overlay_rviz_plugin
{

class TrafficDisplay
Expand All @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include <chrono>

namespace awf_2d_overlay_vehicle
namespace autoware_overlay_rviz_plugin
{

class TurnSignalsDisplay
Expand All @@ -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
Expand All @@ -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_
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Loading
Loading