27 #include <VirtualRobot/MathTools.h>
36 _layerName{Ice::generateUUID()},
37 _debugDrawer{_layerName}
40 _ui.setupUi(getWidget());
41 connect(_ui.pushButtonLayerClear, SIGNAL(clicked()),
this, SLOT(on_pushButtonLayerClear_clicked()));
42 connect(_ui.pushButtonPoseDelete, SIGNAL(clicked()),
this, SLOT(on_pushButtonPoseDelete_clicked()));
43 connect(_ui.pushButtonArrowDelete, SIGNAL(clicked()),
this, SLOT(on_pushButtonArrowDelete_clicked()));
45 connect(_ui.doubleSpinBoxPoseTX, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
46 connect(_ui.doubleSpinBoxPoseTY, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
47 connect(_ui.doubleSpinBoxPoseTZ, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
48 connect(_ui.doubleSpinBoxPoseRX, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
49 connect(_ui.doubleSpinBoxPoseRY, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
50 connect(_ui.doubleSpinBoxPoseRZ, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
51 connect(_ui.doubleSpinBoxPoseScale, SIGNAL(valueChanged(
double)),
this, SLOT(updatePose()));
53 connect(_ui.doubleSpinBoxArrowFX, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
54 connect(_ui.doubleSpinBoxArrowFY, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
55 connect(_ui.doubleSpinBoxArrowFZ, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
56 connect(_ui.doubleSpinBoxArrowTX, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
57 connect(_ui.doubleSpinBoxArrowTY, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
58 connect(_ui.doubleSpinBoxArrowTZ, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
59 connect(_ui.doubleSpinBoxArrowClrR, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
60 connect(_ui.doubleSpinBoxArrowClrG, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
61 connect(_ui.doubleSpinBoxArrowClrB, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
62 connect(_ui.doubleSpinBoxArrowClrA, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
63 connect(_ui.doubleSpinBoxArrowWidth, SIGNAL(valueChanged(
double)),
this, SLOT(updateArrow()));
92 _debugDrawer.
setDebugDrawer(getTopic<DebugDrawerInterfacePrx>(_debugDrawerTopicName));
100 void DebugDrawerGuiPluginWidgetController::on_pushButtonArrowDelete_clicked()
102 const auto name = _ui.lineEditArrowName->text().toStdString();
107 void DebugDrawerGuiPluginWidgetController::on_pushButtonPoseDelete_clicked()
109 const auto name = _ui.lineEditPoseName->text().toStdString();
114 void DebugDrawerGuiPluginWidgetController::on_pushButtonLayerClear_clicked()
119 void DebugDrawerGuiPluginWidgetController::updatePose()
121 const auto name = _ui.lineEditPoseName->text().toStdString();
124 const float deg2rad =
M_PI / 360;
128 VirtualRobot::MathTools::posrpy2eigen4f(
129 _ui.doubleSpinBoxPoseTX->value(),
130 _ui.doubleSpinBoxPoseTY->value(),
131 _ui.doubleSpinBoxPoseTZ->value(),
132 _ui.doubleSpinBoxPoseRX->value() * deg2rad,
133 _ui.doubleSpinBoxPoseRY->value() * deg2rad,
134 _ui.doubleSpinBoxPoseRZ->value() * deg2rad
136 _ui.doubleSpinBoxPoseScale->value());
139 void DebugDrawerGuiPluginWidgetController::updateArrow()
141 const Eigen::Vector3f from
143 static_cast<float>(_ui.doubleSpinBoxArrowFX->value()),
144 static_cast<float>(_ui.doubleSpinBoxArrowFY->value()),
145 static_cast<float>(_ui.doubleSpinBoxArrowFZ->value())
148 const Eigen::Vector3f to
150 static_cast<float>(_ui.doubleSpinBoxArrowTX->value()),
151 static_cast<float>(_ui.doubleSpinBoxArrowTY->value()),
152 static_cast<float>(_ui.doubleSpinBoxArrowTZ->value())
155 const Eigen::Vector3f dir = to - from;
157 const float len = dir.norm();
159 const auto name = _ui.lineEditArrowName->text().toStdString();
167 static_cast<float>(_ui.doubleSpinBoxArrowClrR->value()),
168 static_cast<float>(_ui.doubleSpinBoxArrowClrG->value()),
169 static_cast<float>(_ui.doubleSpinBoxArrowClrB->value()),
170 static_cast<float>(_ui.doubleSpinBoxArrowClrA->value())
173 static_cast<float>(_ui.doubleSpinBoxArrowWidth->value()));