26 #include <QDialogButtonBox>
28 #include <QPushButton>
29 #include <QVBoxLayout>
31 #include <VirtualRobot/Robot.h>
37 #include <RobotAPI/interface/core/RobotState.h>
41 #include <QtWidgets/QLabel>
49 _enabled =
new QCheckBox(
"Enable Visu",
this);
50 _enabled->setChecked(
true);
52 _collisionModel =
new QCheckBox(
"Use Collision Model",
this);
53 _collisionModel->setChecked(
false);
56 setLayout(
new QVBoxLayout());
57 layout()->addWidget(_enabled);
58 layout()->addWidget(_collisionModel);
62 connect(_collisionModel, &QCheckBox::toggled,
this, &
This::changed);
65 setContentsMargins(margin, margin, margin, margin);
72 return _enabled->isChecked();
79 return _collisionModel->isChecked();
90 _filename = robotStateComponent->getRobotFilename();
92 robotStateComponent,
"", {}, VirtualRobot::RobotIO::RobotDescription::eStructure);
105 _synchronize(synchronize);
110 std::map<std::string, float>
113 _synchronize(synchronize);
114 return _robot->getConfig()->getRobotNodeJointValueMap();
121 _synchronize(synchronize);
124 .pose(getGlobalPose(
false));
127 if (_settings and _settings->useCollisionModel())
139 return *_robotStateComponent;
146 return getRobotStateComponent()->ice_getIdentity().name;
151 robotvisu::Connection::_synchronize(
bool synchronize)
163 _statusLabel =
new QLabel(
"Not connected",
this);
164 _connectButton =
new QPushButton(
"Connect ...",
this);
167 _settings->setEnabled(
false);
170 QBoxLayout* layout =
new QVBoxLayout(
this);
173 layout->addWidget(_statusLabel);
174 layout->addWidget(_connectButton);
175 layout->addWidget(_settings);
187 QString name = QString::fromStdString(
connection().getConnectedName());
188 _statusLabel->setText(
"Connected to '" + name +
"'");
190 connect(
this, &
This::connected,
this, [
this]() { _settings->setEnabled(
true); });
204 return _connection.has_value();
211 return _connection.value();
219 "*RobotStateComponent", _component,
this);
220 switch (dialog.exec())
222 case QDialog::Accepted:
224 case QDialog::Rejected:
228 auto robotStateComponent = dialog.
getProxy();
229 if (robotStateComponent)
231 _connection.emplace(robotStateComponent, _settings);