29 #include <VirtualRobot/MathTools.h>
36 _layerName{Ice::generateUUID()}, _debugDrawer{_layerName}
39 _ui.setupUi(getWidget());
40 connect(_ui.pushButtonLayerClear,
43 SLOT(on_pushButtonLayerClear_clicked()));
44 connect(_ui.pushButtonPoseDelete,
47 SLOT(on_pushButtonPoseDelete_clicked()));
48 connect(_ui.pushButtonArrowDelete,
51 SLOT(on_pushButtonArrowDelete_clicked()));
53 connect(_ui.doubleSpinBoxPoseTX, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
54 connect(_ui.doubleSpinBoxPoseTY, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
55 connect(_ui.doubleSpinBoxPoseTZ, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
56 connect(_ui.doubleSpinBoxPoseRX, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
57 connect(_ui.doubleSpinBoxPoseRY, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
58 connect(_ui.doubleSpinBoxPoseRZ, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
59 connect(_ui.doubleSpinBoxPoseScale, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
61 connect(_ui.doubleSpinBoxArrowFX, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
62 connect(_ui.doubleSpinBoxArrowFY, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
63 connect(_ui.doubleSpinBoxArrowFZ, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
64 connect(_ui.doubleSpinBoxArrowTX, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
65 connect(_ui.doubleSpinBoxArrowTY, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
66 connect(_ui.doubleSpinBoxArrowTZ, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
68 _ui.doubleSpinBoxArrowClrR, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
70 _ui.doubleSpinBoxArrowClrG, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
72 _ui.doubleSpinBoxArrowClrB, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
74 _ui.doubleSpinBoxArrowClrA, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
76 _ui.doubleSpinBoxArrowWidth, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
104 _debugDrawer.
setDebugDrawer(getTopic<DebugDrawerInterfacePrx>(_debugDrawerTopicName));
114 DebugDrawerGuiPluginWidgetController::on_pushButtonArrowDelete_clicked()
116 const auto name = _ui.lineEditArrowName->text().toStdString();
122 DebugDrawerGuiPluginWidgetController::on_pushButtonPoseDelete_clicked()
124 const auto name = _ui.lineEditPoseName->text().toStdString();
130 DebugDrawerGuiPluginWidgetController::on_pushButtonLayerClear_clicked()
136 DebugDrawerGuiPluginWidgetController::updatePose()
138 const auto name = _ui.lineEditPoseName->text().toStdString();
141 const float deg2rad =
M_PI / 360;
145 VirtualRobot::MathTools::posrpy2eigen4f(_ui.doubleSpinBoxPoseTX->value(),
146 _ui.doubleSpinBoxPoseTY->value(),
147 _ui.doubleSpinBoxPoseTZ->value(),
148 _ui.doubleSpinBoxPoseRX->value() * deg2rad,
149 _ui.doubleSpinBoxPoseRY->value() * deg2rad,
150 _ui.doubleSpinBoxPoseRZ->value() * deg2rad),
151 _ui.doubleSpinBoxPoseScale->value());
155 DebugDrawerGuiPluginWidgetController::updateArrow()
157 const Eigen::Vector3f from{
static_cast<float>(_ui.doubleSpinBoxArrowFX->value()),
158 static_cast<float>(_ui.doubleSpinBoxArrowFY->value()),
159 static_cast<float>(_ui.doubleSpinBoxArrowFZ->value())};
161 const Eigen::Vector3f to{
static_cast<float>(_ui.doubleSpinBoxArrowTX->value()),
162 static_cast<float>(_ui.doubleSpinBoxArrowTY->value()),
163 static_cast<float>(_ui.doubleSpinBoxArrowTZ->value())};
165 const Eigen::Vector3f dir = to - from;
167 const float len = dir.norm();
169 const auto name = _ui.lineEditArrowName->text().toStdString();
175 {
static_cast<float>(_ui.doubleSpinBoxArrowClrR->value()),
176 static_cast<float>(_ui.doubleSpinBoxArrowClrG->value()),
177 static_cast<float>(_ui.doubleSpinBoxArrowClrB->value()),
178 static_cast<float>(_ui.doubleSpinBoxArrowClrA->value())},
180 static_cast<float>(_ui.doubleSpinBoxArrowWidth->value()));