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
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Hofmann
RobotAPI
Commits
b7cd9c8e
Commit
b7cd9c8e
authored
3 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Add context menu to switch between Ik methods
Signed-off-by:
Rainer Kartmann
<
rainer.kartmann@kit.edu
>
parent
b6d21795
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/ik_demo/IkDemo.cpp
+49
-4
49 additions, 4 deletions
source/RobotAPI/components/ik_demo/IkDemo.cpp
source/RobotAPI/components/ik_demo/PoseGizmo.cpp
+1
-1
1 addition, 1 deletion
source/RobotAPI/components/ik_demo/PoseGizmo.cpp
with
50 additions
and
5 deletions
source/RobotAPI/components/ik_demo/IkDemo.cpp
+
49
−
4
View file @
b7cd9c8e
#include
"IkDemo.h"
#include
<SimoxUtility/algorithm/string.h>
#include
<SimoxUtility/meta/EnumNames.hpp>
#include
<SimoxUtility/math/pose/invert.h>
#include
<VirtualRobot/Robot.h>
...
...
@@ -29,6 +30,11 @@ namespace armar6::skills::components::armar6_ik_demo
SimpleDiffIk
,
CompositeDiffIk
,
};
const
simox
::
meta
::
EnumNames
<
IkMethod
>
IkMethodNames
=
{
{
IkMethod
::
SimpleDiffIk
,
"Simple Diff IK"
},
{
IkMethod
::
CompositeDiffIk
,
"Composite Diff IK"
},
};
struct
Manipulator
{
...
...
@@ -40,7 +46,7 @@ namespace armar6::skills::components::armar6_ik_demo
{
}
bool
handle
(
viz
::
InteractionFeedback
const
&
interaction
,
viz
::
StagedCommit
*
stage
)
virtual
bool
handle
(
viz
::
InteractionFeedback
const
&
interaction
,
viz
::
StagedCommit
*
stage
)
{
bool
updated
=
false
;
if
(
interaction
.
layer
()
==
gizmo
.
layer
.
data_
.
name
)
...
...
@@ -53,7 +59,6 @@ namespace armar6::skills::components::armar6_ik_demo
virtual
void
visualize
(
viz
::
Client
&
arviz
)
=
0
;
virtual
void
runIk
(
IkDemo
::
Robot
&
robot
)
=
0
;
viz
::
PoseGizmo
gizmo
;
};
...
...
@@ -62,7 +67,15 @@ namespace armar6::skills::components::armar6_ik_demo
{
TcpManipulator
()
{
gizmo
.
box
.
size
({
75
,
100
,
200
});
std
::
vector
<
std
::
string
>
options
;
for
(
IkMethod
method
:
IkMethodNames
.
values
())
{
options
.
push_back
(
"Use "
+
IkMethodNames
.
to_name
(
method
));
}
gizmo
.
box
.
size
({
75
,
100
,
200
})
.
enable
(
viz
::
interaction
().
selection
().
transform
().
hideDuringTransform
()
.
contextMenu
(
options
));
};
void
visualize
(
viz
::
Client
&
arviz
)
override
...
...
@@ -70,6 +83,38 @@ namespace armar6::skills::components::armar6_ik_demo
gizmo
.
setLayer
(
arviz
.
layer
(
tcp
->
getName
()));
gizmo
.
update
();
}
bool
handle
(
viz
::
InteractionFeedback
const
&
interaction
,
viz
::
StagedCommit
*
stage
)
override
{
bool
updated
=
Manipulator
::
handle
(
interaction
,
stage
);
if
(
interaction
.
layer
()
==
gizmo
.
layer
.
data_
.
name
)
{
switch
(
interaction
.
type
())
{
case
viz
::
InteractionFeedbackType
::
ContextMenuChosen
:
{
int
i
=
0
;
for
(
IkMethod
method
:
IkMethodNames
.
values
())
{
if
(
i
==
interaction
.
chosenContextMenuEntry
())
{
this
->
method
=
method
;
updated
|=
true
;
ARMARX_IMPORTANT
<<
"["
<<
tcp
->
getName
()
<<
"] Using "
<<
IkMethodNames
.
to_name
(
method
);
break
;
}
++
i
;
}
}
break
;
default
:
break
;
}
}
return
updated
;
}
void
runIk
(
IkDemo
::
Robot
&
robot
)
override
{
const
Eigen
::
Matrix4f
tcpPoseInRobotFrame
=
...
...
@@ -230,7 +275,7 @@ namespace armar6::skills::components::armar6_ik_demo
VirtualRobot
::
RobotNodeSetPtr
nodeSet
;
VirtualRobot
::
RobotNodePtr
tcp
;
IkMethod
method
=
IkMethod
::
Composit
eDiffIk
;
IkMethod
method
=
IkMethod
::
Simpl
eDiffIk
;
};
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/ik_demo/PoseGizmo.cpp
+
1
−
1
View file @
b7cd9c8e
...
...
@@ -9,7 +9,7 @@ namespace armarx::viz
PoseGizmo
::
PoseGizmo
()
{
box
.
enable
(
viz
::
interaction
().
selection
().
transform
());
box
.
enable
(
viz
::
interaction
().
selection
().
transform
()
.
hideDuringTransform
()
);
}
void
PoseGizmo
::
setLayer
(
const
Layer
&
layer_
)
...
...
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