Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hpp-manipulation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Humanoid Path Planner
hpp-manipulation
Commits
bcaae337
Commit
bcaae337
authored
9 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add Roadmap::nearestNode.
parent
67406dd1
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
include/hpp/manipulation/roadmap.hh
+9
-0
9 additions, 0 deletions
include/hpp/manipulation/roadmap.hh
src/roadmap.cc
+24
-0
24 additions, 0 deletions
src/roadmap.cc
with
33 additions
and
0 deletions
include/hpp/manipulation/roadmap.hh
+
9
−
0
View file @
bcaae337
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
# include <hpp/core/constraint-set.hh>
# include <hpp/core/constraint-set.hh>
# include "hpp/manipulation/fwd.hh"
# include "hpp/manipulation/fwd.hh"
# include "hpp/manipulation/graph/fwd.hh"
# include "hpp/manipulation/graph/statistics.hh"
# include "hpp/manipulation/graph/statistics.hh"
namespace
hpp
{
namespace
hpp
{
...
@@ -54,6 +55,13 @@ namespace hpp {
...
@@ -54,6 +55,13 @@ namespace hpp {
/// Catch event 'New node added'
/// Catch event 'New node added'
void
push_node
(
const
core
::
NodePtr_t
&
n
);
void
push_node
(
const
core
::
NodePtr_t
&
n
);
/// Get the nearest neighbor in a given graph::Node and in a given
/// core::ConnectedComponent.
core
::
NodePtr_t
nearestNode
(
const
ConfigurationPtr_t
&
configuration
,
const
ConnectedComponentPtr_t
&
connectedComponent
,
const
graph
::
NodePtr_t
&
node
,
value_type
&
minDistance
)
const
;
protected:
protected:
/// Register a new configuration.
/// Register a new configuration.
void
statInsert
(
const
core
::
NodePtr_t
&
n
);
void
statInsert
(
const
core
::
NodePtr_t
&
n
);
...
@@ -66,6 +74,7 @@ namespace hpp {
...
@@ -66,6 +74,7 @@ namespace hpp {
/// Keep track of the leaf that are explored.
/// Keep track of the leaf that are explored.
/// There should be one histogram per foliation.
/// There should be one histogram per foliation.
Histograms
histograms_
;
Histograms
histograms_
;
graph
::
GraphPtr_t
graph_
;
};
};
/// \}
/// \}
}
// namespace manipulation
}
// namespace manipulation
...
...
This diff is collapsed.
Click to expand it.
src/roadmap.cc
+
24
−
0
View file @
bcaae337
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include
"hpp/manipulation/roadmap.hh"
#include
"hpp/manipulation/roadmap.hh"
#include
<hpp/util/pointer.hh>
#include
<hpp/util/pointer.hh>
#include
<hpp/core/connected-component.hh>
namespace
hpp
{
namespace
hpp
{
namespace
manipulation
{
namespace
manipulation
{
...
@@ -65,6 +66,7 @@ namespace hpp {
...
@@ -65,6 +66,7 @@ namespace hpp {
void
Roadmap
::
constraintGraph
(
const
graph
::
GraphPtr_t
&
graph
)
void
Roadmap
::
constraintGraph
(
const
graph
::
GraphPtr_t
&
graph
)
{
{
graph_
=
graph
;
Histograms
::
iterator
it
=
histograms_
.
begin
();
Histograms
::
iterator
it
=
histograms_
.
begin
();
for
(;
it
!=
histograms_
.
end
();)
{
for
(;
it
!=
histograms_
.
end
();)
{
if
(
HPP_DYNAMIC_PTR_CAST
(
graph
::
NodeHistogram
,
*
it
))
if
(
HPP_DYNAMIC_PTR_CAST
(
graph
::
NodeHistogram
,
*
it
))
...
@@ -74,5 +76,27 @@ namespace hpp {
...
@@ -74,5 +76,27 @@ namespace hpp {
}
}
insertHistogram
(
graph
::
HistogramPtr_t
(
new
graph
::
NodeHistogram
(
graph
)));
insertHistogram
(
graph
::
HistogramPtr_t
(
new
graph
::
NodeHistogram
(
graph
)));
}
}
core
::
NodePtr_t
Roadmap
::
nearestNode
(
const
ConfigurationPtr_t
&
configuration
,
const
ConnectedComponentPtr_t
&
connectedComponent
,
const
graph
::
NodePtr_t
&
node
,
value_type
&
minDistance
)
const
{
core
::
NodePtr_t
result
=
NULL
;
minDistance
=
std
::
numeric_limits
<
value_type
>::
infinity
();
for
(
core
::
Nodes_t
::
const_iterator
itNode
=
connectedComponent
->
nodes
().
begin
();
itNode
!=
connectedComponent
->
nodes
().
end
();
++
itNode
)
{
if
(
graph_
->
getNode
(
*
(
*
itNode
)
->
configuration
())
!=
node
)
continue
;
value_type
d
=
(
*
distance
())
(
*
(
*
itNode
)
->
configuration
(),
*
configuration
);
if
(
d
<
minDistance
)
{
minDistance
=
d
;
result
=
*
itNode
;
}
}
return
result
;
}
}
// namespace manipulation
}
// namespace manipulation
}
// namespace hpp
}
// namespace hpp
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