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
Guilhem Saurel
hpp-manipulation
Commits
b419fab8
Commit
b419fab8
authored
9 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update GraphOptimizer
parent
d7d4fbe0
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/graph-optimizer.hh
+8
-3
8 additions, 3 deletions
include/hpp/manipulation/graph-optimizer.hh
src/graph-optimizer.cc
+15
-0
15 additions, 0 deletions
src/graph-optimizer.cc
with
23 additions
and
3 deletions
include/hpp/manipulation/graph-optimizer.hh
+
8
−
3
View file @
b419fab8
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
# include <hpp/core/path-vector.hh>
# include <hpp/core/path-vector.hh>
# include <hpp/core/path-optimizer.hh>
# include <hpp/core/path-optimizer.hh>
# include <hpp/core/problem.hh>
# include <hpp/core/problem.hh>
# include <hpp/core/problem-solver.hh>
# include <hpp/manipulation/fwd.hh>
# include <hpp/manipulation/fwd.hh>
# include <hpp/manipulation/graph/fwd.hh>
# include <hpp/manipulation/graph/fwd.hh>
...
@@ -46,6 +47,8 @@ namespace hpp {
...
@@ -46,6 +47,8 @@ namespace hpp {
class
HPP_MANIPULATION_DLLAPI
GraphOptimizer
:
public
PathOptimizer
class
HPP_MANIPULATION_DLLAPI
GraphOptimizer
:
public
PathOptimizer
{
{
public:
public:
typedef
core
::
ProblemSolver
::
PathOptimizerBuilder_t
PathOptimizerBuilder_t
;
template
<
typename
InnerPathOptimizer_t
>
template
<
typename
InnerPathOptimizer_t
>
static
GraphOptimizerPtr_t
create
(
const
core
::
Problem
&
problem
);
static
GraphOptimizerPtr_t
create
(
const
core
::
Problem
&
problem
);
...
@@ -59,11 +62,13 @@ namespace hpp {
...
@@ -59,11 +62,13 @@ namespace hpp {
protected
:
protected
:
/// Constructor
/// Constructor
GraphOptimizer
(
const
core
::
Problem
&
problem
,
PathOptimizer
Ptr_t
inner
)
:
GraphOptimizer
(
const
core
::
Problem
&
problem
,
PathOptimizer
Builder_t
factory
)
:
PathOptimizer
(
problem
),
pathOptimizer_
(
inner
)
PathOptimizer
(
problem
),
factory_
(
factory
),
pathOptimizer_
()
{}
{}
private
:
private
:
PathOptimizerBuilder_t
factory_
;
/// The encapsulated PathOptimizer
/// The encapsulated PathOptimizer
PathOptimizerPtr_t
pathOptimizer_
;
PathOptimizerPtr_t
pathOptimizer_
;
...
@@ -80,7 +85,7 @@ namespace hpp {
...
@@ -80,7 +85,7 @@ namespace hpp {
(
const
core
::
Problem
&
problem
)
(
const
core
::
Problem
&
problem
)
{
{
return
GraphOptimizerPtr_t
(
return
GraphOptimizerPtr_t
(
new
GraphOptimizer
(
problem
,
InnerPathOptimizer_t
::
create
(
problem
)
)
new
GraphOptimizer
(
problem
,
InnerPathOptimizer_t
::
create
)
);
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/graph-optimizer.cc
+
15
−
0
View file @
b419fab8
...
@@ -16,10 +16,20 @@
...
@@ -16,10 +16,20 @@
#include
<hpp/manipulation/graph-optimizer.hh>
#include
<hpp/manipulation/graph-optimizer.hh>
#include
<hpp/core/steering-method-straight.hh>
namespace
hpp
{
namespace
hpp
{
namespace
manipulation
{
namespace
manipulation
{
PathVectorPtr_t
GraphOptimizer
::
optimize
(
const
PathVectorPtr_t
&
path
)
PathVectorPtr_t
GraphOptimizer
::
optimize
(
const
PathVectorPtr_t
&
path
)
{
{
core
::
Problem
&
p
=
const_cast
<
core
::
Problem
&>
(
this
->
problem
());
core
::
SteeringMethodPtr_t
sm
=
p
.
steeringMethod
();
core
::
ConstraintSetPtr_t
oldC
=
p
.
constraints
();
core
::
SteeringMethodStraightPtr_t
smS
=
core
::
SteeringMethodStraight
::
create
(
p
.
robot
());
p
.
steeringMethod
(
smS
);
PathVectorPtr_t
opted
=
PathVector
::
create
PathVectorPtr_t
opted
=
PathVector
::
create
(
path
->
outputSize
(),
path
->
outputDerivativeSize
()),
(
path
->
outputSize
(),
path
->
outputDerivativeSize
()),
expanded
=
PathVector
::
create
expanded
=
PathVector
::
create
...
@@ -34,6 +44,7 @@ namespace hpp {
...
@@ -34,6 +44,7 @@ namespace hpp {
toOpt
->
appendPath
(
current
);
toOpt
->
appendPath
(
current
);
graph
::
EdgePtr_t
edge
;
graph
::
EdgePtr_t
edge
;
c
=
HPP_DYNAMIC_PTR_CAST
(
ConstraintSet
,
current
->
constraints
());
c
=
HPP_DYNAMIC_PTR_CAST
(
ConstraintSet
,
current
->
constraints
());
p
.
constraints
(
c
);
if
(
c
)
edge
=
c
->
edge
();
if
(
c
)
edge
=
c
->
edge
();
std
::
size_t
i_e
=
i_s
+
1
;
std
::
size_t
i_e
=
i_s
+
1
;
for
(;
i_e
<
expanded
->
numberPaths
();
++
i_e
)
{
for
(;
i_e
<
expanded
->
numberPaths
();
++
i_e
)
{
...
@@ -43,10 +54,14 @@ namespace hpp {
...
@@ -43,10 +54,14 @@ namespace hpp {
if
(
c
&&
edge
!=
c
->
edge
())
break
;
if
(
c
&&
edge
!=
c
->
edge
())
break
;
toOpt
->
appendPath
(
current
);
toOpt
->
appendPath
(
current
);
}
}
pathOptimizer_
=
factory_
(
this
->
problem
());
toConcat
=
pathOptimizer_
->
optimize
(
toOpt
);
toConcat
=
pathOptimizer_
->
optimize
(
toOpt
);
i_s
=
i_e
;
i_s
=
i_e
;
opted
->
concatenate
(
*
toConcat
);
opted
->
concatenate
(
*
toConcat
);
}
}
p
.
steeringMethod
(
sm
);
p
.
constraints
(
oldC
);
pathOptimizer_
.
reset
();
return
opted
;
return
opted
;
}
}
...
...
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