25#include <RobotAPI/gui-plugins/DebugDrawerGuiPlugin/ui_DebugDrawerGuiPluginWidget.h>
31#include <VirtualRobot/MathTools.h>
38 _layerName{
Ice::generateUUID()}, _debugDrawer{_layerName}
41 _ui = std::make_unique<Ui::DebugDrawerGuiPluginWidget>();
43 connect(_ui->pushButtonLayerClear,
46 SLOT(on_pushButtonLayerClear_clicked()));
47 connect(_ui->pushButtonPoseDelete,
50 SLOT(on_pushButtonPoseDelete_clicked()));
51 connect(_ui->pushButtonArrowDelete,
54 SLOT(on_pushButtonArrowDelete_clicked()));
56 connect(_ui->doubleSpinBoxPoseTX, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
57 connect(_ui->doubleSpinBoxPoseTY, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
58 connect(_ui->doubleSpinBoxPoseTZ, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
59 connect(_ui->doubleSpinBoxPoseRX, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
60 connect(_ui->doubleSpinBoxPoseRY, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
61 connect(_ui->doubleSpinBoxPoseRZ, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
62 connect(_ui->doubleSpinBoxPoseScale, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
64 connect(_ui->doubleSpinBoxArrowFX, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
65 connect(_ui->doubleSpinBoxArrowFY, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
66 connect(_ui->doubleSpinBoxArrowFZ, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
67 connect(_ui->doubleSpinBoxArrowTX, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
68 connect(_ui->doubleSpinBoxArrowTY, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
69 connect(_ui->doubleSpinBoxArrowTZ, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
71 _ui->doubleSpinBoxArrowClrR, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
73 _ui->doubleSpinBoxArrowClrG, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
75 _ui->doubleSpinBoxArrowClrB, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
77 _ui->doubleSpinBoxArrowClrA, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
79 _ui->doubleSpinBoxArrowWidth, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
113 _debugDrawer.clearLayer();
117 DebugDrawerGuiPluginWidgetController::on_pushButtonArrowDelete_clicked()
119 const auto name = _ui->lineEditArrowName->text().toStdString();
125 DebugDrawerGuiPluginWidgetController::on_pushButtonPoseDelete_clicked()
127 const auto name = _ui->lineEditPoseName->text().toStdString();
133 DebugDrawerGuiPluginWidgetController::on_pushButtonLayerClear_clicked()
135 _debugDrawer.clearLayer();
139 DebugDrawerGuiPluginWidgetController::updatePose()
141 const auto name = _ui->lineEditPoseName->text().toStdString();
144 const float deg2rad =
M_PI / 360;
146 _debugDrawer.drawPose(
148 VirtualRobot::MathTools::posrpy2eigen4f(_ui->doubleSpinBoxPoseTX->value(),
149 _ui->doubleSpinBoxPoseTY->value(),
150 _ui->doubleSpinBoxPoseTZ->value(),
151 _ui->doubleSpinBoxPoseRX->value() * deg2rad,
152 _ui->doubleSpinBoxPoseRY->value() * deg2rad,
153 _ui->doubleSpinBoxPoseRZ->value() * deg2rad),
154 _ui->doubleSpinBoxPoseScale->value());
158 DebugDrawerGuiPluginWidgetController::updateArrow()
160 const Eigen::Vector3f
from{
static_cast<float>(_ui->doubleSpinBoxArrowFX->value()),
161 static_cast<float>(_ui->doubleSpinBoxArrowFY->value()),
162 static_cast<float>(_ui->doubleSpinBoxArrowFZ->value())};
164 const Eigen::Vector3f to{
static_cast<float>(_ui->doubleSpinBoxArrowTX->value()),
165 static_cast<float>(_ui->doubleSpinBoxArrowTY->value()),
166 static_cast<float>(_ui->doubleSpinBoxArrowTZ->value())};
168 const Eigen::Vector3f dir = to -
from;
170 const float len = dir.norm();
172 const auto name = _ui->lineEditArrowName->text().toStdString();
175 _debugDrawer.drawArrow(name,
178 {static_cast<float>(_ui->doubleSpinBoxArrowClrR->value()),
179 static_cast<float>(_ui->doubleSpinBoxArrowClrG->value()),
180 static_cast<float>(_ui->doubleSpinBoxArrowClrB->value()),
181 static_cast<float>(_ui->doubleSpinBoxArrowClrA->value())},
183 static_cast<float>(_ui->doubleSpinBoxArrowWidth->value()));
const DebugDrawerInterfacePrx & getDebugDrawer() const
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
#define ARMARX_INFO
The normal logging level.
state::Type from(Eigen::Vector3f targetPosition)
This file offers overloads of toIce() and fromIce() functions for STL container types.