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
0241b0cd
Commit
0241b0cd
authored
9 years ago
by
Mirko Wächter
Browse files
Options
Downloads
Patches
Plain Diff
HeadIK uses also not so good results
parent
9a661911
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/RobotAPI/components/units/HeadIKUnit.cpp
+40
-31
40 additions, 31 deletions
source/RobotAPI/components/units/HeadIKUnit.cpp
with
40 additions
and
31 deletions
source/RobotAPI/components/units/HeadIKUnit.cpp
+
40
−
31
View file @
0241b0cd
...
...
@@ -280,47 +280,56 @@ namespace armarx
if
(
!
solutionFound
)
{
ARMARX_WARNING
<<
"IKSolver found no solution!"
;
}
else
{
ARMARX_
DEBUG
<<
"Sol
ution found
"
;
if
(
drawer
&&
localRobot
->
hasRobotNode
(
"Cameras"
))
Eigen
::
Vector3f
position
=
globalPos
->
toEigen
()
-
kinematicChain
->
getTCP
()
->
getGlobalPose
().
block
(
0
,
3
,
3
,
1
)
;
float
error
=
position
.
norm
();
if
(
error
<
200
)
{
ARMARX_
INFO
<<
"
IK
Sol
ver found no solution! applying best solution with "
<<
error
<<
"mm error
"
;
}
else
{
Vector3Ptr
startPos
=
new
Vector3
(
localRobot
->
getRobotNode
(
"Cameras"
)
->
getGlobalPose
());
drawer
->
setSphereDebugLayerVisu
(
"HeadViewTargetSolution"
,
startPos
,
DrawColor
{
0
,
1
,
1
,
0.2
},
17
);
ARMARX_WARNING
<<
"IKSolver found no solution! "
<<
error
<<
"mm error"
;
return
;
}
}
ARMARX_DEBUG
<<
"Solution found"
;
NameValueMap
targetJointAngles
;
NameControlModeMap
controlModes
;
if
(
drawer
&&
localRobot
->
hasRobotNode
(
"Cameras"
))
{
Vector3Ptr
startPos
=
new
Vector3
(
localRobot
->
getRobotNode
(
"Cameras"
)
->
getGlobalPose
());
drawer
->
setSphereDebugLayerVisu
(
"HeadViewTargetSolution"
,
startPos
,
DrawColor
{
0
,
1
,
1
,
0.2
},
17
);
}
for
(
int
i
=
0
;
i
<
(
signed
int
)
kinematicChain
->
getSize
();
i
++
)
{
if
(
kinematicChain
->
getNode
(
i
)
->
getName
().
compare
(
"VirtualCentralGaze"
)
!=
0
)
{
targetJointAngles
[
kinematicChain
->
getNode
(
i
)
->
getName
()]
=
kinematicChain
->
getNode
(
i
)
->
getJointValue
();
controlModes
[
kinematicChain
->
getNode
(
i
)
->
getName
()]
=
ePositionControl
;
}
ARMARX_DEBUG
<<
kinematicChain
->
getNode
(
i
)
->
getName
()
<<
": "
<<
kinematicChain
->
getNode
(
i
)
->
getJoint
Value
()
;
}
NameValueMap
tar
getJoint
Angles
;
NameControlModeMap
controlModes
;
try
{
kinematicUnitPrx
->
switchControlMode
(
controlModes
);
ARMARX_DEBUG
<<
"setting new joint angles"
<<
targetJointAngles
;
kinematicUnitPrx
->
setJointAngles
(
targetJointAngles
);
}
catch
(...)
for
(
int
i
=
0
;
i
<
(
signed
int
)
kinematicChain
->
getSize
();
i
++
)
{
if
(
kinematicChain
->
getNode
(
i
)
->
getName
().
compare
(
"VirtualCentralGaze"
)
!=
0
)
{
ARMARX_IMPORTANT
<<
"setJointAngles failed"
;
targetJointAngles
[
kinematicChain
->
getNode
(
i
)
->
getName
()]
=
kinematicChain
->
getNode
(
i
)
->
getJointValue
();
controlModes
[
kinematicChain
->
getNode
(
i
)
->
getName
()]
=
ePositionControl
;
}
ARMARX_DEBUG
<<
kinematicChain
->
getNode
(
i
)
->
getName
()
<<
": "
<<
kinematicChain
->
getNode
(
i
)
->
getJointValue
();
}
try
{
kinematicUnitPrx
->
switchControlMode
(
controlModes
);
ARMARX_DEBUG
<<
"setting new joint angles"
<<
targetJointAngles
;
kinematicUnitPrx
->
setJointAngles
(
targetJointAngles
);
}
catch
(...)
{
ARMARX_IMPORTANT
<<
"setJointAngles failed"
;
}
}
}
...
...
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