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
c2850ac7
Commit
c2850ac7
authored
10 years ago
by
Valerij Wittenbeck
Browse files
Options
Downloads
Patches
Plain Diff
MovePlatformToLandmark - added some error checking
parent
4c3d740c
Branches
feature/skills-manager-edit-arguments
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/statecharts/MovePlatformToLandmark/MovePlatformToLandmark.cpp
+18
-43
18 additions, 43 deletions
...echarts/MovePlatformToLandmark/MovePlatformToLandmark.cpp
with
18 additions
and
43 deletions
source/RobotAPI/statecharts/MovePlatformToLandmark/MovePlatformToLandmark.cpp
+
18
−
43
View file @
c2850ac7
...
...
@@ -108,36 +108,6 @@ namespace armarx
void
StateCalculatePath
::
onEnter
()
{
ARMARX_LOG
<<
eVERBOSE
<<
"Entering StateCalculatePath"
;
// std::string targetLandmark = getInput<std::string>("targetLandmark");
// SingleTypeVariantListPtr landmarkTags = getInput<SingleTypeVariantList>("landmarkTags");
// int targetIndex = -1;
// for (int i = 0; i < landmarkTags->getSize(); i++) {
// if (landmarkTags->getVariant(i)->getString() == targetLandmark) {
// targetIndex = i;
// break;
// }
// }
// SingleTypeVariantList targetPositions(VariantType::Vector3);
// if (targetIndex >= 0) {
// Vector3Ptr v = getInput<SingleTypeVariantList>("landmarkPositions")->getVariant(targetIndex)->get<Vector3>();
// Vector3 vv;
// vv.x = v->x;
// vv.y = v->y;
// vv.z = v->z;
// ARMARX_LOG << eVERBOSE << vv.x << " " << vv.y << " " << vv.z << flush;
// targetPositions.addVariant(Variant(vv));
//// targetPositions.addVariant(v);
// sendEvent<EvPathFound>();
// } else {
// ARMARX_LOG << eWARN << "Could not map from landmark tag to target position(s)";
// sendEvent<EvNoPathFound>();
// }
// setOutput("targetPositions", targetPositions);
//read the nodes into a tag to node map
SingleTypeVariantListPtr
landmarkNodes
=
getInput
<
SingleTypeVariantList
>
(
"landmarkNodes"
);
...
...
@@ -192,23 +162,28 @@ namespace armarx
std
::
string
landmark
=
getInput
<
std
::
string
>
(
"targetLandmark"
);
NodePtr
goal
=
nameToNodeMap
[
landmark
];
if
(
!
goal
)
{
ARMARX_LOG
<<
eWARN
<<
"Target landmark doesn't exist in graph"
<<
flush
;
sendEvent
<
EvNoPathFound
>
();
return
;
}
std
::
list
<
NodePtr
>
path
=
aStar
(
closest
,
goal
);
SingleTypeVariantList
targetPositions
(
VariantType
::
Vector3
);
if
(
path
.
empty
())
{
ARMARX_LOG
<<
eWARN
<<
"No path found"
;
ARMARX_LOG
<<
eWARN
<<
"No path found"
<<
flush
;
sendEvent
<
EvNoPathFound
>
();
}
else
{
const
float
goalAlpha
=
path
.
back
()
->
framedPos
->
z
;
for
(
std
::
list
<
NodePtr
>::
iterator
it
=
path
.
begin
();
it
!=
path
.
end
();
it
++
)
{
Vector3
v
;
v
.
x
=
(
*
it
)
->
framedPos
->
x
;
v
.
y
=
(
*
it
)
->
framedPos
->
y
;
v
.
z
=
goalAlpha
;
targetPositions
.
addVariant
(
v
);
}
sendEvent
<
EvPathFound
>
();
setOutput
(
"targetPositions"
,
targetPositions
);
return
;
}
SingleTypeVariantList
targetPositions
(
VariantType
::
Vector3
);
const
float
goalAlpha
=
path
.
back
()
->
framedPos
->
z
;
for
(
std
::
list
<
NodePtr
>::
iterator
it
=
path
.
begin
();
it
!=
path
.
end
();
it
++
)
{
Vector3
v
;
v
.
x
=
(
*
it
)
->
framedPos
->
x
;
v
.
y
=
(
*
it
)
->
framedPos
->
y
;
v
.
z
=
goalAlpha
;
targetPositions
.
addVariant
(
v
);
}
setOutput
(
"targetPositions"
,
targetPositions
);
sendEvent
<
EvPathFound
>
();
ARMARX_LOG
<<
eVERBOSE
<<
"StateCalculatePath: Done onEnter()"
<<
flush
;
}
...
...
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