-
Notifications
You must be signed in to change notification settings - Fork 664
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 autoware state panel #7036
Conversation
…me groupboxes to vboxlayouts
…r_label_ptr_ to QPushButton
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Could you put all the colors we used to a header file and include it in required files? We have material colors and they all have names. This will make styling easier for the future. The material theme builder supports exporting themes: I've exported our theme: M3.json Ideally we would read from this json and fill in the variables as it loads. But having them preset is good too. I've used the following prompt: https://chatgpt.com/share/13727ef6-e4ca-4ca2-bc2a-0a6438bff542 You can directly use the final |
Co-authored-by: M. Fatih Cırıt <[email protected]>
Co-authored-by: M. Fatih Cırıt <[email protected]>
Co-authored-by: M. Fatih Cırıt <[email protected]>
Co-authored-by: M. Fatih Cırıt <[email protected]>
… group Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
…colors all over the place Signed-off-by: KhalilSelyan <[email protected]>
@xmfcx All bugs, and suggestions have been dealt with. debugging the switch toggle was the hardest but the fix was a simple if statement at the end. if there any discrepancies please let me know, if you would like to change colors as needed the material_colors.hpp is where all components now get their colors. so it should much simpler to edit now 👍🏼 |
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: KhalilSelyan <[email protected]>
Signed-off-by: M. Fatih Cırıt <[email protected]>
Signed-off-by: M. Fatih Cırıt <[email protected]>
Click to expand // Diagnostic
// QLabel * diagnostic_label_ptr_{nullptr};
// QVBoxLayout * diagnostic_layout_{nullptr};
// std::unordered_map<std::string, QLabel *> statusLabels;
// rclcpp::Subscription<DiagnosticArray>::SharedPtr sub_diag_;
// void onDiagnostics(const DiagnosticArray::ConstSharedPtr msg);
// void addStatusLabel(const std::string & name, int level);
// void updateStatusLabel(const std::string & name, int level);
Click to expand/* void AutowareStatePanel::onDiagnostics(const DiagnosticArray::ConstSharedPtr msg)
{
for (const auto & status : msg->status) {
std::string statusName = status.name; // Assuming name is a std::string
int level = status.level; // Assuming level is an int
// Check if this status name already has an associated QLabel
auto it = statusLabels.find(statusName);
if (it != statusLabels.end()) {
// Status exists, update its display (QLabel) with the new level
updateStatusLabel(statusName, level);
} else {
// New status, add a QLabel for it to the map and the layout
addStatusLabel(statusName, level);
}
}
} */
/* void AutowareStatePanel::addStatusLabel(const std::string & name, int level)
{
QString baseStyle =
"QLabel {"
" border-radius: 4px;"
" padding: 4px;"
" margin: 2px;"
" font-weight: bold;"
" color: #003546;";
QString okStyle = baseStyle + "background-color: #84c2e6;}";
QString warnStyle = baseStyle + "background-color: #FFCC00;}";
QString errorStyle = baseStyle + "background-color: #f08b8b;}";
QString staleStyle = baseStyle + "background-color: #6c757d;}";
QString labelText = QString::fromStdString(name);
// + ": " +
// (level == diagnostic_msgs::msg::DiagnosticStatus::OK ? "OK"
// : level == diagnostic_msgs::msg::DiagnosticStatus::WARN ? "WARN"
// : level == diagnostic_msgs::msg::DiagnosticStatus::ERROR ? "ERROR"
// : "STALE");
auto * label = new QLabel(labelText);
label->setMinimumHeight(30); // for example, set a minimum height
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
// Adjust style based on level
QString styleSheet;
switch (level) {
case diagnostic_msgs::msg::DiagnosticStatus::OK:
styleSheet = okStyle;
break;
case diagnostic_msgs::msg::DiagnosticStatus::WARN:
styleSheet = warnStyle;
break;
case diagnostic_msgs::msg::DiagnosticStatus::ERROR:
styleSheet = errorStyle;
break;
default:
styleSheet = staleStyle;
break;
}
label->setStyleSheet(styleSheet);
diagnostic_layout_->addWidget(label);
statusLabels[name] = label;
} */
/* void AutowareStatePanel::updateStatusLabel(const std::string & name, int level)
{
QString baseStyle =
"QLabel {"
" border-radius: 4px;"
" padding: 4px;"
" margin: 2px;"
" font-weight: bold;"
" color: #003546;";
QString okStyle = baseStyle + "background-color: #84c2e6;}";
QString warnStyle = baseStyle + "background-color: #FFCC00;}";
QString errorStyle = baseStyle + "background-color: #f08b8b;}";
QString staleStyle = baseStyle + "background-color: #6c757d;}";
// Find the QLabel* associated with this status name
auto it = statusLabels.find(name);
if (it != statusLabels.end()) {
QLabel * label = it->second;
// Update label's text
QString labelText = QString::fromStdString(name);
// +": " + (level == diagnostic_msgs::msg::DiagnosticStatus::OK ? "OK"
// : level == diagnostic_msgs::msg::DiagnosticStatus::WARN ? "WARN"
// : level == diagnostic_msgs::msg::DiagnosticStatus::ERROR ? "ERROR"
// : "STALE");
label->setText(labelText);
// Update style based on level, similar to addStatusLabel
QString styleSheet;
switch (level) {
case diagnostic_msgs::msg::DiagnosticStatus::OK:
styleSheet = okStyle;
break;
case diagnostic_msgs::msg::DiagnosticStatus::WARN:
styleSheet = warnStyle;
break;
case diagnostic_msgs::msg::DiagnosticStatus::ERROR:
styleSheet = errorStyle;
break;
default:
styleSheet = staleStyle;
break;
}
label->setStyleSheet(styleSheet);
label->adjustSize(); // Adjust the size of the label to fit the content if needed
label->update(); // Ensure the label is updated immediately
}
} */ Removed commented out future code |
Signed-off-by: M. Fatih Cırıt <[email protected]>
Signed-off-by: M. Fatih Cırıt <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thank you!
Signed-off-by: KhalilSelyan <[email protected]>
Description
This PR updates the Autoware state panel RViz plugin with new custom components to enhance its appearance and functionality, aligning it with the newly set up RViz dark mode.
Related links
Screenshot Demo
Tests performed
Effects on system behavior
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.