Skip to content
Snippets Groups Projects
Commit 01976b7e authored by Fabian Paus's avatar Fabian Paus
Browse files

ArViz: Add initial interface for interactions

parent d35869fc
No related branches found
No related tags found
No related merge requests found
......@@ -500,6 +500,18 @@ namespace armarx
}
void fillInteractionLayer(viz::Layer& layer)
{
// TODO: Add interaction to client code
// 1. Make box selectable
viz::Box box = viz::Box("box")
.position(Eigen::Vector3f(2000.0f, 0.0f, 2000.0f))
.size(Eigen::Vector3f(200.0f, 200.0f, 200.0f))
.color(viz::Color::fromRGBA(0, 165, 255));
layer.add(box);
}
void ArVizExample::run()
{
......@@ -524,6 +536,7 @@ namespace armarx
viz::Layer objectsLayer = arviz.layer("Objects");
viz::Layer disAppearingLayer = arviz.layer("DisAppearing");
viz::Layer robotHandsLayer = arviz.layer("RobotHands");
viz::Layer interactionLayer = arviz.layer("Interaction");
// These layers are not updated in the loop.
......@@ -545,6 +558,9 @@ namespace armarx
arviz.commit(colorMapsLayer);
}
fillInteractionLayer(interactionLayer);
arviz.commit(interactionLayer);
CycleUtil c(20);
while (!task->isStopped())
......
......@@ -2,7 +2,6 @@
#include <ArmarXCore/interface/core/BasicTypes.ice>
#include <ArmarXCore/interface/core/BasicVectorTypes.ice>
#include <RobotAPI/interface/core/PoseBase.ice>
module armarx
......@@ -30,6 +29,75 @@ module data
byte b = 100;
};
module InteractionEnableFlags
{
const int NONE = 0;
const int SELECT = 1;
const int CONTEXT_MENU = 2;
const int TRANSLATION_X = 4;
const int TRANSLATION_Y = 8;
const int TRANSLATION_Z = 16;
const int ROTATION_X = 32;
const int ROTATION_Y = 64;
const int ROTATION_Z = 128;
};
struct InteractionDescription
{
int enableFlags = 0;
Ice::StringSeq contextMenuOptions;
};
module InteractionFeedbackType
{
const int NONE = 0;
const int SELCECT = 1;
const int DESELECT = 2;
const int CONTEXT_MENU_OPEN = 3;
const int CONTEXT_MENU_CHOSEN = 4;
const int TRANSFORM = 5;
// Flag to indicate the kind of transformation
const int TRANSLATION_FLAG = 16;
const int ROTATION_FLAG = 32;
// Flag to indicate the axis used for transformation
const int AXIS_X_FLAG = 64;
const int AXIS_Y_FLAG = 128;
const int AXIS_Z_FLAG = 256;
// Flag to indicate state of the transformation
const int TRANSFORM_BEGIN_FLAG = 512;
const int TRANSFORM_DURING_FLAG = 1024;
const int TRANSFORM_END_FLAG = 2048;
};
struct InteractionFeedback
{
// The type of interaction that happened (in the lower 4 bits)
// The higher bits are used for flags specifying more details of the interaction
int type = 0;
// The element with which the interaction took place
string layer;
string element;
// The revision in which the interaction took place
long revision = 0;
// Chosen context menu entry is only relevant for type == CONTEXT_MENU_CHOSEN
string chosenContextMenuEntry;
// Original and chosen poase are only relevant for type == TRANSFORM
GlobalPose originalPose;
GlobalPose chosenPose;
};
module ElementFlags
{
const int NONE = 0;
......@@ -40,6 +108,8 @@ module data
class Element
{
string id;
InteractionDescription interaction;
GlobalPose pose;
float scale = 1.0f;
Color color;
......
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