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
8ce8234a
Commit
8ce8234a
authored
10 years ago
by
Peter Kaiser
Browse files
Options
Downloads
Patches
Plain Diff
RobotIK: Convert poses to reachability map coordinate frame before query
parent
e104c52c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/RobotAPI/components/RobotIK/RobotIK.cpp
+33
-2
33 additions, 2 deletions
source/RobotAPI/components/RobotIK/RobotIK.cpp
source/RobotAPI/components/RobotIK/RobotIK.h
+4
-0
4 additions, 0 deletions
source/RobotAPI/components/RobotIK/RobotIK.h
with
37 additions
and
2 deletions
source/RobotAPI/components/RobotIK/RobotIK.cpp
+
33
−
2
View file @
8ce8234a
...
...
@@ -93,6 +93,7 @@ namespace armarx
}
usingProxy
(
getProperty
<
std
::
string
>
(
"RobotStateComponentName"
).
getValue
());
offeringTopic
(
"DebugDrawerUpdates"
);
}
...
...
@@ -104,6 +105,8 @@ namespace armarx
<<
" This component, however, uses "
<<
_robotFile
<<
" Both models must be identical!"
;
}
_synchronizedRobot
=
_robotStateComponentPrx
->
getSynchronizedRobot
();
debugDrawer
=
getTopic
<
armarx
::
DebugDrawerInterfacePrx
>
(
"DebugDrawerUpdates"
);
}
void
RobotIK
::
onDisconnectComponent
()
...
...
@@ -326,7 +329,7 @@ namespace armarx
bool
RobotIK
::
isFramedPoseReachable
(
const
std
::
string
&
chainName
,
const
FramedPoseBasePtr
&
tcpPose
,
const
Ice
::
Current
&
)
const
{
return
isReachable
(
chainName
,
to
GlobalPose
(
tcpPos
e
));
return
isReachable
(
chainName
,
to
ReachabilityMapFrame
(
tcpPose
,
chainNam
e
));
}
bool
RobotIK
::
isPoseReachable
(
const
std
::
string
&
chainName
,
const
PoseBasePtr
&
tcpPose
,
const
Ice
::
Current
&
)
const
...
...
@@ -457,15 +460,43 @@ namespace armarx
return
globalTcpPose
->
toEigen
();
}
Eigen
::
Matrix4f
RobotIK
::
toReachabilityMapFrame
(
const
FramedPoseBasePtr
&
tcpPose
,
const
std
::
string
&
chainName
)
const
{
FramedPosePtr
p
=
FramedPosePtr
::
dynamicCast
(
tcpPose
);
PosePtr
p_global
(
new
Pose
(
toGlobalPose
(
tcpPose
)));
debugDrawer
->
setPoseDebugLayerVisu
(
"Grasp Pose"
,
p_global
);
std
::
lock_guard
<
std
::
recursive_mutex
>
lock
(
_accessReachabilityCacheMutex
);
if
(
_reachabilities
.
count
(
chainName
))
{
ReachabilityCacheType
::
const_iterator
it
=
_reachabilities
.
find
(
chainName
);
p
->
changeFrame
(
_synchronizedRobot
,
it
->
second
->
getBaseNode
()
->
getName
());
}
else
{
ARMARX_WARNING
<<
"Could not convert TCP pose to reachability map frame: Map not found."
;
}
return
p
->
toEigen
();
}
bool
RobotIK
::
isReachable
(
const
std
::
string
&
setName
,
const
Eigen
::
Matrix4f
&
tcpPose
)
const
{
ARMARX_INFO
<<
"Checking reachability for kinematic chain '"
<<
setName
<<
"': "
<<
tcpPose
;
std
::
lock_guard
<
std
::
recursive_mutex
>
lock
(
_accessReachabilityCacheMutex
);
if
(
_reachabilities
.
count
(
setName
))
{
ReachabilityCacheType
::
const_iterator
it
=
_reachabilities
.
find
(
setName
);
return
it
->
second
->
isCovered
(
tcpPose
);
}
return
false
;
else
{
ARMARX_WARNING
<<
"Could not find reachability map for kinematic chain '"
<<
setName
<<
"'"
;
return
false
;
}
}
VirtualRobot
::
IKSolver
::
CartesianSelection
RobotIK
::
convertCartesianSelection
(
armarx
::
CartesianSelection
cs
)
const
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/RobotIK/RobotIK.h
+
4
−
0
View file @
8ce8234a
...
...
@@ -30,6 +30,7 @@
#include
<RobotAPI/libraries/core/RobotAPIObjectFactories.h>
#include
<RobotAPI/interface/core/RobotIK.h>
#include
<RobotAPI/interface/visualization/DebugDrawerInterface.h>
#include
<VirtualRobot/IK/GenericIKSolver.h>
...
...
@@ -139,6 +140,7 @@ namespace armarx
armarx
::
CartesianSelection
cs
,
NameValueMap
&
iksolution
)
const
;
Eigen
::
Matrix4f
toGlobalPose
(
const
FramedPoseBasePtr
&
tcpPose
)
const
;
Eigen
::
Matrix4f
toReachabilityMapFrame
(
const
FramedPoseBasePtr
&
tcpPose
,
const
std
::
string
&
chainName
)
const
;
bool
isReachable
(
const
std
::
string
&
setName
,
const
Eigen
::
Matrix4f
&
tcpPose
)
const
;
...
...
@@ -160,6 +162,8 @@ namespace armarx
std
::
string
_robotFile
;
RobotStateComponentInterfacePrx
_robotStateComponentPrx
;
SharedRobotInterfacePrx
_synchronizedRobot
;
DebugDrawerInterfacePrx
debugDrawer
;
// Reachability cache: not thread safe, always lock!
typedef
std
::
map
<
std
::
string
,
VirtualRobot
::
WorkspaceRepresentationPtr
>
ReachabilityCacheType
;
ReachabilityCacheType
_reachabilities
;
...
...
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