Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
RobotAPI
Commits
7561c54d
Commit
7561c54d
authored
3 years ago
by
Fabian Paus
Browse files
Options
Downloads
Patches
Plain Diff
ArViz: Add client type for interaction feedback
parent
644a86bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/RobotAPI/components/ArViz/Client/Client.h
+157
-0
157 additions, 0 deletions
source/RobotAPI/components/ArViz/Client/Client.h
source/RobotAPI/components/ArViz/Client/Elements.h
+5
-0
5 additions, 0 deletions
source/RobotAPI/components/ArViz/Client/Elements.h
with
162 additions
and
0 deletions
source/RobotAPI/components/ArViz/Client/Client.h
+
157
−
0
View file @
7561c54d
...
@@ -61,9 +61,166 @@ namespace viz
...
@@ -61,9 +61,166 @@ namespace viz
viz
::
data
::
CommitInput
data_
;
viz
::
data
::
CommitInput
data_
;
};
};
enum
class
InteractionFeedbackType
{
None
,
Select
,
Deselect
,
ContextMenuOpen
,
ContextMenuChosen
,
Transform
,
};
inline
Eigen
::
Matrix4f
toEigen
(
data
::
GlobalPose
const
&
pose
)
{
Eigen
::
Quaternionf
ori
(
pose
.
qw
,
pose
.
qx
,
pose
.
qy
,
pose
.
qz
);
Eigen
::
Matrix4f
result
;
result
.
block
<
3
,
3
>
(
0
,
0
)
=
ori
.
toRotationMatrix
();
result
.
block
<
3
,
1
>
(
0
,
3
)
=
Eigen
::
Vector3f
(
pose
.
x
,
pose
.
y
,
pose
.
z
);
result
.
block
<
1
,
4
>
(
3
,
0
)
=
Eigen
::
Vector4f
(
0.0
f
,
0.0
f
,
0.0
f
,
1.0
f
);
return
result
;
}
struct
InteractionFeedback
struct
InteractionFeedback
{
{
InteractionFeedbackType
type
()
const
{
// Maks out all the flags in the higher bits
int
type
=
data_
.
type
&
0x7
;
switch
(
type
)
{
case
data
::
InteractionFeedbackType
::
NONE
:
return
InteractionFeedbackType
::
None
;
case
data
::
InteractionFeedbackType
::
SELECT
:
return
InteractionFeedbackType
::
Select
;
case
data
::
InteractionFeedbackType
::
DESELECT
:
return
InteractionFeedbackType
::
Deselect
;
case
data
::
InteractionFeedbackType
::
CONTEXT_MENU_OPEN
:
return
InteractionFeedbackType
::
ContextMenuOpen
;
case
data
::
InteractionFeedbackType
::
CONTEXT_MENU_CHOSEN
:
return
InteractionFeedbackType
::
ContextMenuChosen
;
case
data
::
InteractionFeedbackType
::
TRANSFORM
:
return
InteractionFeedbackType
::
Transform
;
default:
throw
std
::
runtime_error
(
"Unexpected InteractionFeedbackType"
);
}
}
bool
isTranslation
()
const
{
return
data_
.
type
&
data
::
InteractionFeedbackType
::
TRANSLATION_FLAG
;
}
bool
isRotation
()
const
{
return
data_
.
type
&
data
::
InteractionFeedbackType
::
ROTATION_FLAG
;
}
bool
isAxisX
()
const
{
return
data_
.
type
&
data
::
InteractionFeedbackType
::
AXIS_X_FLAG
;
}
bool
isAxisY
()
const
{
return
data_
.
type
&
data
::
InteractionFeedbackType
::
AXIS_Y_FLAG
;
}
bool
isAxisZ
()
const
{
return
data_
.
type
&
data
::
InteractionFeedbackType
::
AXIS_Z_FLAG
;
}
bool
isTransformBegin
()
const
{
return
data_
.
type
&
data
::
InteractionFeedbackType
::
TRANSFORM_BEGIN_FLAG
;
}
bool
isTransformDuring
()
const
{
return
data_
.
type
&
data
::
InteractionFeedbackType
::
TRANSFORM_DURING_FLAG
;
}
bool
isTransformEnd
()
const
{
return
data_
.
type
&
data
::
InteractionFeedbackType
::
TRANSFORM_END_FLAG
;
}
std
::
string
const
&
layer
()
const
{
return
data_
.
layer
;
}
std
::
string
const
&
element
()
const
{
return
data_
.
element
;
}
long
revision
()
const
{
return
data_
.
revision
;
}
int
chosenContextMenuEntry
()
const
{
return
data_
.
chosenContextMenuEntry
;
}
Eigen
::
Matrix4f
originalPose
()
const
{
return
toEigen
(
data_
.
originalPose
);
}
Eigen
::
Matrix4f
chosenPose
()
const
{
return
toEigen
(
data_
.
chosenPose
);
}
data
::
InteractionFeedback
data_
;
};
struct
InteractionFeedbackRange
{
InteractionFeedback
const
*
begin
()
const
{
return
begin_
;
}
InteractionFeedback
const
*
end
()
const
{
return
end_
;
}
InteractionFeedback
const
*
begin_
;
InteractionFeedback
const
*
end_
;
};
struct
CommitResult
{
long
revision
()
const
{
return
data_
.
revision
;
}
InteractionFeedbackRange
interactions
()
const
{
InteractionFeedback
*
begin
=
(
InteractionFeedback
*
)
data_
.
interactions
.
data
();
InteractionFeedback
*
end
=
begin
+
data_
.
interactions
.
size
();
return
InteractionFeedbackRange
{
begin
,
end
};
}
data
::
CommitResult
data_
;
};
};
struct
Client
struct
Client
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/ArViz/Client/Elements.h
+
5
−
0
View file @
7561c54d
...
@@ -270,6 +270,11 @@ namespace armarx::viz
...
@@ -270,6 +270,11 @@ namespace armarx::viz
return
*
this
;
return
*
this
;
}
}
Polygon
&
lineColor
(
int
r
,
int
g
,
int
b
)
{
return
lineColor
(
viz
::
Color
(
r
,
g
,
b
));
}
Polygon
&
lineColorGlasbeyLUT
(
std
::
size_t
id
,
int
alpha
=
255
)
Polygon
&
lineColorGlasbeyLUT
(
std
::
size_t
id
,
int
alpha
=
255
)
{
{
return
lineColor
(
Color
::
fromRGBA
(
simox
::
color
::
GlasbeyLUT
::
at
(
id
,
alpha
)));
return
lineColor
(
Color
::
fromRGBA
(
simox
::
color
::
GlasbeyLUT
::
at
(
id
,
alpha
)));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment