diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/turn_signals_display.hpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/turn_signals_display.hpp index 87f141353d5b2..ca10c92c06a3e 100644 --- a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/turn_signals_display.hpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/include/turn_signals_display.hpp @@ -47,7 +47,7 @@ class TurnSignalsDisplay private: QImage arrowImage; - QColor gray = QColor(46, 46, 46); + QColor gray = QColor(79, 79, 79); int current_turn_signal_; // Internal variable to store turn signal state int current_hazard_lights_; // Internal variable to store hazard lights state diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/gear_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/gear_display.cpp index 8f05ce6fdce1c..825c7c1620e2c 100644 --- a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/gear_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/gear_display.cpp @@ -81,18 +81,19 @@ void GearDisplay::drawGearIndicator(QPainter & painter, const QRectF & backgroun break; } - QFont gearFont("Quicksand", 16, QFont::Bold); + QFont gearFont("Quicksand", 12, QFont::Bold); painter.setFont(gearFont); QPen borderPen(gray); - borderPen.setWidth(4); + borderPen.setWidth(1); painter.setPen(borderPen); - int gearBoxSize = 30; - int gearX = backgroundRect.left() + 30 + gearBoxSize; - int gearY = backgroundRect.height() - gearBoxSize - 20; + double gearBoxSize = 37.5; + double gearX = backgroundRect.left() + 54; + double gearY = backgroundRect.height() / 2 - gearBoxSize / 2; QRect gearRect(gearX, gearY, gearBoxSize, gearBoxSize); - painter.setBrush(QColor(0, 0, 0, 0)); + painter.setBrush(gray); painter.drawRoundedRect(gearRect, 10, 10); + painter.setPen(Qt::black); painter.drawText(gearRect, Qt::AlignCenter, QString::fromStdString(gearString)); } diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/signal_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/signal_display.cpp index 3b1536919512b..841b33c29fbb0 100644 --- a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/signal_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/signal_display.cpp @@ -39,11 +39,11 @@ namespace autoware_overlay_rviz_plugin SignalDisplay::SignalDisplay() { property_width_ = new rviz_common::properties::IntProperty( - "Width", 517, "Width of the overlay", this, SLOT(updateOverlaySize())); + "Width", 550, "Width of the overlay", this, SLOT(updateOverlaySize())); property_height_ = new rviz_common::properties::IntProperty( - "Height", 175, "Height of the overlay", this, SLOT(updateOverlaySize())); + "Height", 100, "Height of the overlay", this, SLOT(updateOverlaySize())); property_left_ = new rviz_common::properties::IntProperty( - "Left", 10, "Left position of the overlay", this, SLOT(updateOverlayPosition())); + "Left", 0, "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( @@ -325,16 +325,18 @@ void SignalDisplay::drawWidget(QImage & hud) QPainter painter(&hud); painter.setRenderHint(QPainter::Antialiasing, true); - QRectF backgroundRect(0, 0, 322, hud.height()); + QRectF backgroundRect(0, 0, 550, hud.height()); drawHorizontalRoundedRectangle(painter, backgroundRect); // Draw components - if (steering_wheel_display_) { - steering_wheel_display_->drawSteeringWheel(painter, backgroundRect); - } if (gear_display_) { gear_display_->drawGearIndicator(painter, backgroundRect); } + + if (steering_wheel_display_) { + steering_wheel_display_->drawSteeringWheel(painter, backgroundRect); + } + if (speed_display_) { speed_display_->drawSpeedDisplay(painter, backgroundRect); } @@ -342,18 +344,12 @@ void SignalDisplay::drawWidget(QImage & hud) turn_signals_display_->drawArrows(painter, backgroundRect, property_signal_color_->getColor()); } - // a 27px space between the two halves of the HUD - - QRectF smallerBackgroundRect(340, 0, 190.0 / 2, hud.height()); - - drawVerticalRoundedRectangle(painter, smallerBackgroundRect); - if (traffic_display_) { - traffic_display_->drawTrafficLightIndicator(painter, smallerBackgroundRect); + traffic_display_->drawTrafficLightIndicator(painter, backgroundRect); } if (speed_limit_display_) { - speed_limit_display_->drawSpeedLimitIndicator(painter, smallerBackgroundRect); + speed_limit_display_->drawSpeedLimitIndicator(painter, backgroundRect); } painter.end(); @@ -364,8 +360,8 @@ void SignalDisplay::drawHorizontalRoundedRectangle( { painter.setRenderHint(QPainter::Antialiasing, true); QColor colorFromHSV; - colorFromHSV.setHsv(0, 0, 0); // Hue, Saturation, Value - colorFromHSV.setAlphaF(0.65); // Transparency + colorFromHSV.setHsv(0, 0, 29); // Hue, Saturation, Value + colorFromHSV.setAlphaF(0.60); // Transparency painter.setBrush(colorFromHSV); @@ -404,7 +400,9 @@ void SignalDisplay::updateOverlaySize() void SignalDisplay::updateOverlayPosition() { std::lock_guard lock(mutex_); - overlay_->setPosition(property_left_->getInt(), property_top_->getInt()); + overlay_->setPosition( + property_left_->getInt(), property_top_->getInt(), HorizontalAlignment::CENTER, + VerticalAlignment::TOP); queueRender(); } diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_display.cpp index b1df14956d16c..5c5342259005b 100644 --- a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_display.cpp @@ -85,7 +85,7 @@ void SpeedDisplay::drawSpeedDisplay(QPainter & painter, const QRectF & backgroun backgroundRect.width() / 2 - referenceRect.width() / 2 - 5, backgroundRect.height() / 2); QString speedNumber = QString::number(current_speed_, 'f', 0); - int fontSize = 60; + int fontSize = 40; QFont speedFont("Quicksand", fontSize); painter.setFont(speedFont); @@ -94,16 +94,17 @@ void SpeedDisplay::drawSpeedDisplay(QPainter & painter, const QRectF & backgroun // Center the speed number in the backgroundRect QPointF speedPos( - backgroundRect.center().x() - speedNumberRect.width() / 2, backgroundRect.center().y()); + backgroundRect.center().x() - speedNumberRect.width() / 2, + backgroundRect.center().y() + speedNumberRect.bottom()); painter.setPen(gray); painter.drawText(speedPos, speedNumber); - QFont unitFont("Quicksand", 14); + QFont unitFont("Quicksand", 8, QFont::DemiBold); 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()); + (backgroundRect.width() / 2 - unitRect.width() / 2), referencePos.y() + unitRect.height() + 15); painter.drawText(unitPos, speedUnit); } diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp index 6913ef6a48ecd..4c83b4a73c0c2 100644 --- a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -99,10 +100,9 @@ void SpeedLimitDisplay::drawSpeedLimitIndicator(QPainter & painter, const QRectF } // Define the area for the outer circle - QRectF outerCircleRect = backgroundRect; - outerCircleRect.setWidth(backgroundRect.width() - 30); - outerCircleRect.setHeight(backgroundRect.width() - 30); - outerCircleRect.moveTopLeft(QPointF(backgroundRect.left() + 15, backgroundRect.top() + 10)); + QRectF outerCircleRect = QRectF(45, 45, 45, 45); + outerCircleRect.moveTopRight( + QPointF(backgroundRect.right() - 44, backgroundRect.top() + outerCircleRect.height() / 2 + 5)); // Now use borderColor for drawing painter.setPen(QPen(borderColor, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); @@ -112,24 +112,30 @@ void SpeedLimitDisplay::drawSpeedLimitIndicator(QPainter & painter, const QRectF // Define the area for the inner circle QRectF innerCircleRect = outerCircleRect; - innerCircleRect.setWidth(outerCircleRect.width() / 1.25); - innerCircleRect.setHeight(outerCircleRect.height() / 1.25); + innerCircleRect.setWidth(outerCircleRect.width() / 1.09); + innerCircleRect.setHeight(outerCircleRect.height() / 1.09); innerCircleRect.moveCenter(outerCircleRect.center()); + QRectF innerCircleRect2 = innerCircleRect; + painter.setRenderHint(QPainter::Antialiasing, true); QColor colorFromHSV; - colorFromHSV.setHsv(0, 0, 0); // Hue, Saturation, Value - + colorFromHSV.setHsv(0, 0, 29); // Hue, Saturation, Value + colorFromHSV.setAlphaF(0.60); // Transparency painter.setBrush(colorFromHSV); painter.drawEllipse(innerCircleRect); + // Add a second inner circle as a mask to make the speed limit indicator look like a ring + // and follow the rest of the background color as close as possible + painter.drawEllipse(innerCircleRect2); + 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", 24, QFont::Bold); + QFont font = QFont("Quicksand", 16, QFont::Bold); painter.setFont(font); // #C2C2C2 diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/steering_wheel_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/steering_wheel_display.cpp index 5882d7780dc92..45ebcde086165 100644 --- a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/steering_wheel_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/steering_wheel_display.cpp @@ -82,8 +82,8 @@ void SteeringWheelDisplay::drawSteeringWheel(QPainter & painter, const QRectF & // Rotate the wheel float steeringAngle = steering_angle_; // No need to round here // Calculate the position - int wheelCenterX = backgroundRect.right() - wheel.width() - 17.5; - int wheelCenterY = backgroundRect.height() - wheel.height() + 15; + int wheelCenterX = backgroundRect.left() + wheel.width() + 54 + 54; + int wheelCenterY = backgroundRect.height() / 2; // Rotate the wheel image QTransform rotationTransform; diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/traffic_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/traffic_display.cpp index a1b991e4742e3..f6d232709a333 100644 --- a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/traffic_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/traffic_display.cpp @@ -62,12 +62,10 @@ void TrafficDisplay::drawTrafficLightIndicator(QPainter & painter, const QRectF 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() - 30); - circleRect.setHeight(backgroundRect.width() - 30); + QRectF circleRect = QRectF(50, 50, 50, 50); circleRect.moveTopRight(QPointF( - backgroundRect.left() + circleRect.width() + 15, - backgroundRect.top() + circleRect.height() + 30)); + backgroundRect.right() - circleRect.width() - 75, + backgroundRect.top() + circleRect.height() / 2)); painter.drawEllipse(circleRect); if (!current_traffic_.elements.empty()) { @@ -96,7 +94,7 @@ void TrafficDisplay::drawTrafficLightIndicator(QPainter & painter, const QRectF } // Scaling factor (e.g., 1.5 for 150% size) - float scaleFactor = 1.00; + float scaleFactor = 0.75; // Calculate the scaled size QSize scaledSize = traffic_light_image_.size() * scaleFactor; diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/turn_signals_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/turn_signals_display.cpp index b6d37062bf08b..1aaa5871015a8 100644 --- a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/turn_signals_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/turn_signals_display.cpp @@ -72,12 +72,12 @@ void TurnSignalsDisplay::updateHazardLightsData( void TurnSignalsDisplay::drawArrows( QPainter & painter, const QRectF & backgroundRect, const QColor & color) { - QImage scaledLeftArrow = arrowImage.scaled(64, 43, Qt::KeepAspectRatio, Qt::SmoothTransformation); + QImage scaledLeftArrow = arrowImage.scaled(50, 32, Qt::KeepAspectRatio, Qt::SmoothTransformation); scaledLeftArrow = coloredImage(scaledLeftArrow, gray); QImage scaledRightArrow = scaledLeftArrow.mirrored(true, false); - int arrowYPos = (backgroundRect.height() / 3 - scaledLeftArrow.height() / 2); - int leftArrowXPos = backgroundRect.width() / 4 - scaledLeftArrow.width(); // Adjust as needed - int rightArrowXPos = backgroundRect.width() * 3 / 4; // Adjust as needed + int arrowYPos = (backgroundRect.height() / 2 - scaledLeftArrow.height() / 2 - 4); + int leftArrowXPos = backgroundRect.left() + scaledLeftArrow.width() * 2 + 180; + int rightArrowXPos = backgroundRect.right() - scaledRightArrow.width() * 3 - 175; bool leftActive = (current_turn_signal_ == autoware_auto_vehicle_msgs::msg::TurnIndicatorsReport::ENABLE_LEFT ||