Skip to content
Snippets Groups Projects
Commit 57539bfd authored by Fabian Reister's avatar Fabian Reister
Browse files

remote gui: control group

parent 495f7ad0
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
#include "Navigator.h"
#include <cmath>
#include <iterator>
#include <boost/uuid/uuid.hpp>
......@@ -198,32 +199,121 @@ void armarx::nav::components::Navigator::createRemoteGuiTab()
// Setup the widgets.
tab.boxLayerName.setValue(0);
tab.numBoxes.setValue(1);
tab.numBoxes.setRange(0, 100);
{
tab.targetPoseGroup.group.setLabel("Target pose");
{
float max = 10'000;
tab.targetPoseGroup.targetPoseX.setRange(-max, max);
tab.targetPoseGroup.targetPoseX.setDecimals(0);
tab.targetPoseGroup.targetPoseX.setSteps(int(max / 10));
tab.targetPoseGroup.targetPoseX.setValue(0.F);
}
{
float max = 10'000;
tab.targetPoseGroup.targetPoseY.setRange(-max, max);
tab.targetPoseGroup.targetPoseY.setDecimals(0);
tab.targetPoseGroup.targetPoseY.setSteps(int(max / 10));
tab.targetPoseGroup.targetPoseY.setValue(0.F);
}
{
float max = 10'000;
tab.targetPoseGroup.targetPoseZ.setRange(-max, max);
tab.targetPoseGroup.targetPoseZ.setDecimals(0);
tab.targetPoseGroup.targetPoseZ.setSteps(int(max / 10));
tab.targetPoseGroup.targetPoseZ.setValue(0.F);
}
{
float max = 180;
tab.targetPoseGroup.targetPoseRoll.setRange(-max, max);
tab.targetPoseGroup.targetPoseRoll.setDecimals(0);
tab.targetPoseGroup.targetPoseRoll.setSteps(2 * max);
tab.targetPoseGroup.targetPoseRoll.setValue(0.F);
}
{
float max = 180;
tab.targetPoseGroup.targetPosePitch.setRange(-max, max);
tab.targetPoseGroup.targetPosePitch.setDecimals(0);
tab.targetPoseGroup.targetPosePitch.setSteps(2 * max);
tab.targetPoseGroup.targetPosePitch.setValue(0.F);
}
{
float max = 180;
tab.targetPoseGroup.targetPoseYaw.setRange(-max, max);
tab.targetPoseGroup.targetPoseYaw.setDecimals(0);
tab.targetPoseGroup.targetPoseYaw.setSteps(2 * max);
tab.targetPoseGroup.targetPoseYaw.setValue(0.F);
}
// tab.boxLayerName.setValue(0);
// tab.numBoxes.setValue(1);
// tab.numBoxes.setRange(0, 100);
// tab.drawBoxes.setLabel("Draw Boxes");
// Setup the layout.
GridLayout grid;
int row = 0;
{
grid.add(Label("X"), {row, 0}).add(tab.targetPoseGroup.targetPoseX, {row, 1});
++row;
grid.add(Label("Y"), {row, 0}).add(tab.targetPoseGroup.targetPoseY, {row, 1});
++row;
grid.add(Label("Z"), {row, 0}).add(tab.targetPoseGroup.targetPoseZ, {row, 1});
++row;
grid.add(Label("Roll"), {row, 0}).add(tab.targetPoseGroup.targetPoseRoll, {row, 1});
++row;
grid.add(Label("Pitch"), {row, 0}).add(tab.targetPoseGroup.targetPosePitch, {row, 1});
++row;
grid.add(Label("Yaw"), {row, 0}).add(tab.targetPoseGroup.targetPoseYaw, {row, 1});
++row;
// grid.add(Label("Num Boxes"), {row, 0}).add(tab.numBoxes, {row, 1});
// ++row;
// grid.add(tab.drawBoxes, {row, 0}, {2, 1});
// ++row;
}
VBoxLayout root = {grid, VSpacer()};
tab.targetPoseGroup.group.addChild(root);
}
tab.drawBoxes.setLabel("Draw Boxes");
{
tab.controlGroup.group.setLabel("Control");
// Setup the layout.
GridLayout grid;
int row = 0;
{
grid.add(tab.controlGroup.moveToButton, {row, 1});
++row;
GridLayout grid;
int row = 0;
{
grid.add(Label("Box Layer"), {row, 0}).add(tab.boxLayerName, {row, 1});
++row;
grid.add(tab.controlGroup.pauseButton, {row, 1});
++row;
grid.add(Label("Num Boxes"), {row, 0}).add(tab.numBoxes, {row, 1});
++row;
grid.add(tab.controlGroup.continueButton, {row, 1});
++row;
}
grid.add(tab.drawBoxes, {row, 0}, {2, 1});
++row;
VBoxLayout root = {grid, VSpacer()};
tab.controlGroup.group.addChild(root);
}
VBoxLayout root = {grid, VSpacer()};
ARMARX_TRACE;
RemoteGui_createTab(getName(), root, &tab);
RemoteGui_createTab(getName(), tab.targetPoseGroup.group, &tab);
}
void armarx::nav::components::Navigator::RemoteGui_update()
......@@ -242,12 +332,13 @@ void armarx::nav::components::Navigator::RemoteGui_update()
// sendDebugObserverBatch();
// }
// }
if (tab.drawBoxes.wasClicked())
{
// Lock shared variables in methods running in seperate threads
// and pass them to functions. This way, the called functions do
// not need to think about locking.
std::scoped_lock lock(propertiesMutex);
// drawBoxes(properties, arviz);
}
// if (tab.drawBoxes.wasClicked())
// {
// ARMARX_INFO << "Navigator control requested from remote GUI";
// // Lock shared variables in methods running in seperate threads
// // and pass them to functions. This way, the called functions do
// // not need to think about locking.
// std::scoped_lock lock(propertiesMutex);
// // drawBoxes(properties, arviz);
// }
}
......@@ -114,11 +114,9 @@ namespace armarx::nav::components
VirtualRobot::RobotPtr getRobot();
void createRemoteGuiTab();
void RemoteGui_update() override;
private:
// TODO update context periodically
......@@ -128,17 +126,32 @@ namespace armarx::nav::components
server::PlatformUnitExecutor executor;
std::map<std::string, server::Navigator> navigators;
std::mutex propertiesMutex;
struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
{
armarx::RemoteGui::Client::LineEdit boxLayerName;
armarx::RemoteGui::Client::IntSpinBox numBoxes;
struct
{
armarx::RemoteGui::Client::GroupBox group;
armarx::RemoteGui::Client::FloatSpinBox targetPoseX;
armarx::RemoteGui::Client::FloatSpinBox targetPoseY;
armarx::RemoteGui::Client::FloatSpinBox targetPoseZ;
armarx::RemoteGui::Client::FloatSpinBox targetPoseRoll;
armarx::RemoteGui::Client::FloatSpinBox targetPosePitch;
armarx::RemoteGui::Client::FloatSpinBox targetPoseYaw;
} targetPoseGroup;
struct
{
armarx::RemoteGui::Client::GroupBox group;
armarx::RemoteGui::Client::Button moveToButton;
armarx::RemoteGui::Client::Button pauseButton;
armarx::RemoteGui::Client::Button continueButton;
} controlGroup;
armarx::RemoteGui::Client::Button drawBoxes;
};
RemoteGuiTab tab;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment