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
2e599238
Commit
2e599238
authored
9 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add a second graph builder
parent
33ca25d1
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/helper.hh
+15
-2
15 additions, 2 deletions
include/hpp/manipulation/graph/helper.hh
src/graph/helper.cc
+62
-2
62 additions, 2 deletions
src/graph/helper.cc
with
77 additions
and
4 deletions
include/hpp/manipulation/graph/helper.hh
+
15
−
2
View file @
2e599238
...
...
@@ -29,8 +29,7 @@
namespace
hpp
{
namespace
manipulation
{
namespace
graph
{
namespace
helper
{
namespace
helper
{
/// \defgroup helper Helpers to build the graph of constraints
/// \addtogroup helper
/// \{
...
...
@@ -169,6 +168,20 @@ namespace hpp {
const
Objects_t
&
objects
,
const
Grippers_t
&
grippers
,
GraphPtr_t
graph
);
struct
ObjectDef_t
{
std
::
string
name
;
JointPtr_t
lastJoint
;
StringList_t
handles
,
shapes
;
};
GraphPtr_t
graphBuilder
(
const
ProblemSolverPtr_t
&
ps
,
const
std
::
string
&
graphName
,
const
StringList_t
&
griNames
,
const
std
::
list
<
ObjectDef_t
>&
objs
,
const
StringList_t
&
envNames
,
const
value_type
&
prePlaceWidth
=
0.05
);
/// \}
}
// namespace helper
}
// namespace graph
...
...
This diff is collapsed.
Click to expand it.
src/graph/helper.cc
+
62
−
2
View file @
2e599238
...
...
@@ -24,11 +24,11 @@
#include
<hpp/constraints/differentiable-function.hh>
#include
<hpp/manipulation/handle.hh>
#include
<hpp/manipulation/graph/node.hh>
#include
<hpp/manipulation/graph/edge.hh>
#include
<hpp/manipulation/graph/node-selector.hh>
#include
<hpp/manipulation/handle.hh>
#include
<hpp/manipulation/problem-solver.hh>
namespace
hpp
{
namespace
manipulation
{
...
...
@@ -828,6 +828,66 @@ namespace hpp {
recurseGrippers
(
r
,
availG
,
availOH
,
iG
);
}
GraphPtr_t
graphBuilder
(
const
ProblemSolverPtr_t
&
ps
,
const
std
::
string
&
graphName
,
const
StringList_t
&
griNames
,
const
std
::
list
<
ObjectDef_t
>&
objs
,
const
StringList_t
&
envNames
,
const
value_type
&
prePlaceWidth
)
{
const
Device
&
robot
=
*
(
ps
->
robot
());
Grippers_t
grippers
(
griNames
.
size
());
index_t
i
=
0
;
BOOST_FOREACH
(
const
std
::
string
&
gn
,
griNames
)
{
grippers
[
i
]
=
robot
.
get
<
GripperPtr_t
>
(
gn
);
++
i
;
}
Objects_t
objects
(
objs
.
size
());
i
=
0
;
const
value_type
margin
=
1e-3
;
bool
prePlace
=
(
prePlaceWidth
>
0
);
BOOST_FOREACH
(
const
ObjectDef_t
&
od
,
objs
)
{
// Create handles
objects
[
i
].
get
<
1
>
().
resize
(
od
.
handles
.
size
());
Handles_t
::
iterator
it
=
objects
[
i
].
get
<
1
>
().
begin
();
BOOST_FOREACH
(
const
std
::
string
hn
,
od
.
handles
)
{
*
it
=
robot
.
get
<
HandlePtr_t
>
(
hn
);
++
it
;
}
// Create placement
if
(
!
od
.
shapes
.
empty
())
{
const
std
::
string
placeN
=
"place_"
+
od
.
name
;
ps
->
createPlacementConstraint
(
placeN
,
od
.
shapes
,
envNames
,
margin
);
objects
[
i
].
get
<
0
>
().
get
<
0
>
()
=
ps
->
get
<
NumericalConstraintPtr_t
>
(
placeN
);
if
(
prePlace
)
{
ps
->
createPrePlacementConstraint
(
"pre"
+
placeN
,
od
.
shapes
,
envNames
,
margin
,
prePlaceWidth
);
objects
[
i
].
get
<
0
>
().
get
<
1
>
()
=
ps
->
get
<
NumericalConstraintPtr_t
>
(
"pre"
+
placeN
);
}
}
// Create object lock
for
(
JointPtr_t
oj
=
od
.
lastJoint
;
oj
!=
NULL
;
oj
=
oj
->
parentJoint
())
{
LockedJointPtr_t
lj
=
core
::
LockedJoint
::
create
(
oj
,
robot
.
currentConfiguration
()
.
segment
(
oj
->
rankInConfiguration
(),
oj
->
configSize
()));
ps
->
add
<
LockedJointPtr_t
>
(
"lock_"
+
oj
->
name
(),
lj
);
objects
[
i
].
get
<
0
>
().
get
<
2
>
().
push_back
(
lj
);
}
++
i
;
}
GraphPtr_t
graph
=
Graph
::
create
(
graphName
,
ps
->
robot
(),
ps
->
problem
());
graph
->
createNodeSelector
(
"nodeSelector"
);
graphBuilder
(
objects
,
grippers
,
graph
);
ps
->
constraintGraph
(
graph
);
return
graph
;
}
}
// namespace helper
}
// namespace graph
}
// namespace manipulation
...
...
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