Skip to content

Commit fa79682

Browse files
author
M. Fatih Cırıt
committed
fix anchoring, update readme
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
1 parent 6c35ab9 commit fa79682

File tree

3 files changed

+21
-42
lines changed

3 files changed

+21
-42
lines changed

common/autoware_overlay_rviz_plugin/autoware_mission_details_overlay_rviz_plugin/README.md

+14-27
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,34 @@
11
# autoware_mission_details_overlay_rviz_plugin
22

3-
Plugin for displaying 2D overlays over the RViz2 3D scene for mission details (such as remaining distance and time).
4-
5-
Based on the [jsk_visualization](https://github.com/jsk-ros-pkg/jsk_visualization)
6-
package, under the 3-Clause BSD license.
7-
8-
## Purpose
9-
10-
This plugin provides a visual and easy-to-understand display of mission details (remaining distance and time)
3+
This RViz plugin displays the remaining distance and time for the current mission.
114

125
## Inputs / Outputs
136

147
### Input
158

16-
| Name | Type | Description |
17-
| ------------------------------------------- | ----------------------------------------------------------- | --------------------------------------------------------- |
18-
| `/planning/mission_remaining_distance_time` | `autoware_planning_msgs::msg::MissionRemainingDistanceTime` | The topic is for mission remaining distance and time Data |
19-
20-
## Parameter
9+
| Name | Type | Description |
10+
|---------------------------------------------|-------------------------------------------------------------|------------------------------------------------------|
11+
| `/planning/mission_remaining_distance_time` | `autoware_planning_msgs::msg::MissionRemainingDistanceTime` | The topic is for mission remaining distance and time |
2112

22-
### Core Parameters
13+
## Overlay Parameters
2314

24-
#### SignalDisplay
15+
| Name | Type | Default Value | Description |
16+
|----------|------|---------------|-----------------------------------|
17+
| `Width` | int | 170 | Width of the overlay [px] |
18+
| `Height` | int | 100 | Height of the overlay [px] |
19+
| `Right` | int | 10 | Margin from the right border [px] |
20+
| `Top` | int | 10 | Margin from the top border [px] |
2521

26-
| Name | Type | Default Value | Description |
27-
| ------------------ | ---- | ------------- | --------------------------------- |
28-
| `property_width_` | int | 225 | Width of the plotter window [px] |
29-
| `property_height_` | int | 100 | Height of the plotter window [px] |
30-
| `property_left_` | int | 10 | Left of the plotter window [px] |
31-
| `property_top_` | int | 10 | Top of the plotter window [px] |
32-
33-
Note that mission details display is aligned with top right corner of the screen.
34-
35-
## Assumptions / Known limits
36-
37-
TBD.
22+
The mission details display is aligned with top right corner of the screen.
3823

3924
## Usage
4025

4126
Similar to [autoware_overlay_rviz_plugin](../autoware_overlay_rviz_plugin/README.md)
4227

4328
## Credits
4429

30+
Based on the [jsk_visualization](https://github.com/jsk-ros-pkg/jsk_visualization) package.
31+
4532
### Icons
4633

4734
- <https://fonts.google.com/icons?selected=Material+Symbols+Outlined:conversion_path:FILL@1;wght@400;GRAD@200;opsz@20&icon.size=20&icon.color=%23e8eaed&icon.query=path>

common/autoware_overlay_rviz_plugin/autoware_mission_details_overlay_rviz_plugin/include/mission_details_display.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class MissionDetailsDisplay : public rviz_common::Display
5353
private Q_SLOTS:
5454
void updateOverlaySize();
5555
void updateSmallOverlaySize();
56-
void updateOverlayPosition();
5756
void updateOverlayColor();
5857
void topic_updated_remaining_distance_time();
5958

@@ -62,7 +61,7 @@ private Q_SLOTS:
6261
autoware::mission_details_overlay_rviz_plugin::OverlayObject::SharedPtr overlay_;
6362
rviz_common::properties::IntProperty * property_width_;
6463
rviz_common::properties::IntProperty * property_height_;
65-
rviz_common::properties::IntProperty * property_left_;
64+
rviz_common::properties::IntProperty * property_right_;
6665
rviz_common::properties::IntProperty * property_top_;
6766
std::unique_ptr<rviz_common::properties::RosTopicProperty>
6867
remaining_distance_time_topic_property_;

common/autoware_overlay_rviz_plugin/autoware_mission_details_overlay_rviz_plugin/src/mission_details_display.cpp

+6-13
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ namespace autoware::mission_details_overlay_rviz_plugin
3232
MissionDetailsDisplay::MissionDetailsDisplay()
3333
{
3434
property_width_ = new rviz_common::properties::IntProperty(
35-
"Width", 225, "Width of the overlay", this, SLOT(updateOverlaySize()));
35+
"Width", 170, "Width of the overlay", this, SLOT(updateOverlaySize()));
3636
property_height_ = new rviz_common::properties::IntProperty(
3737
"Height", 100, "Height of the overlay", this, SLOT(updateOverlaySize()));
38-
property_left_ = new rviz_common::properties::IntProperty(
39-
"Left", 10, "Left position of the overlay", this, SLOT(updateOverlayPosition()));
38+
property_right_ = new rviz_common::properties::IntProperty(
39+
"Right", 10, "Margin from the right border", this, SLOT(updateOverlaySize()));
4040
property_top_ = new rviz_common::properties::IntProperty(
41-
"Top", 10, "Top position of the overlay", this, SLOT(updateOverlayPosition()));
41+
"Top", 10, "Margin from the top border", this, SLOT(updateOverlaySize()));
4242

4343
// Initialize the component displays
4444
remaining_distance_time_display_ = std::make_unique<RemainingDistanceTimeDisplay>();
@@ -56,7 +56,6 @@ void MissionDetailsDisplay::onInitialize()
5656
overlay_.reset(new autoware::mission_details_overlay_rviz_plugin::OverlayObject(ss.str()));
5757
overlay_->show();
5858
updateOverlaySize();
59-
updateOverlayPosition();
6059

6160
auto rviz_ros_node = context_->getRosNodeAbstraction();
6261

@@ -150,7 +149,7 @@ void MissionDetailsDisplay::drawWidget(QImage & hud)
150149
QPainter painter(&hud);
151150
painter.setRenderHint(QPainter::Antialiasing, true);
152151

153-
QRectF backgroundRect(0, 0, 170, 100);
152+
QRectF backgroundRect(0, 0, qreal(property_width_->getInt()), qreal(property_height_->getInt()));
154153
drawHorizontalRoundedRectangle(painter, backgroundRect);
155154

156155
if (remaining_distance_time_display_) {
@@ -200,14 +199,8 @@ void MissionDetailsDisplay::updateOverlaySize()
200199
std::lock_guard<std::mutex> lock(mutex_);
201200
overlay_->updateTextureSize(property_width_->getInt(), property_height_->getInt());
202201
overlay_->setDimensions(overlay_->getTextureWidth(), overlay_->getTextureHeight());
203-
queueRender();
204-
}
205-
206-
void MissionDetailsDisplay::updateOverlayPosition()
207-
{
208-
std::lock_guard<std::mutex> lock(mutex_);
209202
overlay_->setPosition(
210-
property_left_->getInt(), property_top_->getInt(), HorizontalAlignment::RIGHT,
203+
property_right_->getInt(), property_top_->getInt(), HorizontalAlignment::RIGHT,
211204
VerticalAlignment::TOP);
212205
queueRender();
213206
}

0 commit comments

Comments
 (0)