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
73994c6e
Commit
73994c6e
authored
9 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Enhance helpers
parent
fc063274
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/hpp/manipulation/graph/helper.hh
+76
-59
76 additions, 59 deletions
include/hpp/manipulation/graph/helper.hh
src/graph/helper.cc
+401
-168
401 additions, 168 deletions
src/graph/helper.cc
with
477 additions
and
227 deletions
include/hpp/manipulation/graph/helper.hh
+
76
−
59
View file @
73994c6e
...
@@ -27,75 +27,92 @@
...
@@ -27,75 +27,92 @@
namespace
hpp
{
namespace
hpp
{
namespace
manipulation
{
namespace
manipulation
{
namespace
graph
{
namespace
graph
{
/// \addtogroup constraint_graph
namespace
helper
/// \{
{
/// \defgroup helper Helpers to build the graph of constraints
struct
NumericalConstraintsAndPassiveDofs
{
/// \addtogroup helper
NumericalConstraints_t
nc
;
/// \{
IntervalsContainer_t
pdof
;
NumericalConstraintsAndPassiveDofs
merge
struct
NumericalConstraintsAndPassiveDofs
{
(
const
NumericalConstraintsAndPassiveDofs
&
other
)
{
NumericalConstraints_t
nc
;
NumericalConstraintsAndPassiveDofs
ret
;
IntervalsContainer_t
pdof
;
// ret.nc.reserve (nc.size() + other.nc.size());
NumericalConstraintsAndPassiveDofs
merge
ret
.
pdof
.
reserve
(
pdof
.
size
()
+
other
.
pdof
.
size
());
(
const
NumericalConstraintsAndPassiveDofs
&
other
)
{
NumericalConstraintsAndPassiveDofs
ret
;
std
::
copy
(
nc
.
begin
(),
nc
.
end
(),
ret
.
nc
.
begin
());
// ret.nc.reserve (nc.size() + other.nc.size());
std
::
copy
(
other
.
nc
.
begin
(),
other
.
nc
.
end
(),
ret
.
nc
.
begin
());
ret
.
pdof
.
reserve
(
pdof
.
size
()
+
other
.
pdof
.
size
());
std
::
copy
(
pdof
.
begin
(),
pdof
.
end
(),
ret
.
pdof
.
begin
());
std
::
copy
(
nc
.
begin
(),
nc
.
end
(),
ret
.
nc
.
begin
());
std
::
copy
(
other
.
pdof
.
begin
(),
other
.
pdof
.
end
(),
ret
.
pdof
.
begin
());
std
::
copy
(
other
.
nc
.
begin
(),
other
.
nc
.
end
(),
ret
.
nc
.
begin
());
return
ret
;
std
::
copy
(
pdof
.
begin
(),
pdof
.
end
(),
ret
.
pdof
.
begin
());
std
::
copy
(
other
.
pdof
.
begin
(),
other
.
pdof
.
end
(),
ret
.
pdof
.
begin
());
return
ret
;
}
template
<
bool
forPath
>
void
addToComp
(
GraphComponentPtr_t
comp
)
const
;
template
<
bool
param
>
void
specifyFoliation
(
LevelSetEdgePtr_t
lse
)
const
;
};
struct
FoliatedManifold
{
// Manifold definition
NumericalConstraintsAndPassiveDofs
nc
;
LockedJoints_t
lj
;
NumericalConstraintsAndPassiveDofs
nc_path
;
// Foliation definition
NumericalConstraintsAndPassiveDofs
nc_fol
;
LockedJoints_t
lj_fol
;
FoliatedManifold
merge
(
const
FoliatedManifold
&
other
)
{
FoliatedManifold
both
;
both
.
nc
=
nc
.
merge
(
other
.
nc
);
both
.
nc_path
=
nc_path
.
merge
(
other
.
nc_path
);
std
::
copy
(
lj
.
begin
(),
lj
.
end
(),
both
.
lj
.
end
());
std
::
copy
(
other
.
lj
.
begin
(),
other
.
lj
.
end
(),
both
.
lj
.
end
());
return
both
;
}
}
template
<
bool
forPath
>
void
addToComp
(
GraphComponentPtr_t
comp
)
const
;
void
addToNode
(
NodePtr_t
comp
)
const
;
void
addToEdge
(
EdgePtr_t
comp
)
const
;
template
<
bool
param
>
void
specifyFoliation
(
LevelSetEdgePtr_t
lse
)
const
;
void
specifyFoliation
(
LevelSetEdgePtr_t
lse
)
const
;
};
struct
FoliatedManifold
{
// Manifold definition
NumericalConstraintsAndPassiveDofs
nc
;
LockedJoints_t
lj
;
NumericalConstraintsAndPassiveDofs
nc_path
;
// Foliation definition
NumericalConstraintsAndPassiveDofs
nc_fol
;
LockedJoints_t
lj_fol
;
FoliatedManifold
merge
(
const
FoliatedManifold
&
other
)
{
FoliatedManifold
both
;
both
.
nc
=
nc
.
merge
(
other
.
nc
);
both
.
nc_path
=
nc_path
.
merge
(
other
.
nc_path
);
std
::
copy
(
lj
.
begin
(),
lj
.
end
(),
both
.
lj
.
end
());
std
::
copy
(
other
.
lj
.
begin
(),
other
.
lj
.
end
(),
both
.
lj
.
end
());
return
both
;
}
void
addToNode
(
NodePtr_t
comp
)
const
;
bool
isFoliated
()
const
{
void
addToEdge
(
EdgePtr_t
comp
)
const
;
return
lj_fol
.
empty
()
&&
nc_fol
.
nc
.
empty
();
void
specifyFoliation
(
LevelSetEdgePtr_t
lse
)
const
;
}
};
bool
isFoliated
()
const
{
return
lj_fol
.
empty
()
&&
nc_fol
.
nc
.
empty
();
typedef
std
::
pair
<
EdgePtr_t
,
EdgePtr_t
>
EdgePair_t
;
}
};
enum
GraspingCase
{
NoGrasp
=
0
,
class
HPP_MANIPULATION_DLLAPI
Helper
GraspOnly
=
1
<<
0
,
{
WithPreGrasp
=
1
<<
1
public:
};
typedef
std
::
pair
<
WaypointEdgePtr_t
,
WaypointEdgePtr_t
>
WaypointEdgePair_t
;
enum
PlacementCase
{
NoPlace
=
1
<<
2
,
WaypointEdgePair_t
createWaypoints
(
PlaceOnly
=
1
<<
3
,
WithPrePlace
=
1
<<
4
};
/// Create edges according to the case.
/// gCase is a logical OR combination of GraspingCase and PlacementCase
///
/// When an argument is not relevant, use the default constructor
/// of FoliatedManifold
template
<
int
gCase
>
EdgePair_t
createEdges
(
const
std
::
string
&
forwName
,
const
std
::
string
&
backName
,
const
std
::
string
&
forwName
,
const
std
::
string
&
backName
,
const
NodePtr_t
&
from
,
const
NodePtr_t
&
to
,
const
NodePtr_t
&
from
,
const
NodePtr_t
&
to
,
const
size_type
&
wForw
,
const
size_type
&
wBack
,
const
size_type
&
wForw
,
const
size_type
&
wBack
,
const
FoliatedManifold
&
grasp
,
const
FoliatedManifold
&
pregrasp
,
const
FoliatedManifold
&
grasp
,
const
FoliatedManifold
&
pregrasp
,
const
FoliatedManifold
&
place
,
const
FoliatedManifold
&
preplace
,
const
FoliatedManifold
&
place
,
const
FoliatedManifold
&
preplace
,
const
bool
levelSet
Place
,
const
bool
levelSet
Grasp
,
const
bool
levelSet
Grasp
,
const
bool
levelSet
Place
,
const
FoliatedManifold
&
submanifoldDef
=
FoliatedManifold
()
const
FoliatedManifold
&
submanifoldDef
=
FoliatedManifold
()
);
);
}
;
/// \
}
/// \}
}
// namespace helper
}
// namespace graph
}
// namespace graph
}
// namespace manipulation
}
// namespace manipulation
}
// namespace hpp
}
// namespace hpp
...
...
This diff is collapsed.
Click to expand it.
src/graph/helper.cc
+
401
−
168
View file @
73994c6e
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