Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pinocchio
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
Stack Of Tasks
pinocchio
Commits
e66994ba
Verified
Commit
e66994ba
authored
6 years ago
by
Justin Carpentier
Browse files
Options
Downloads
Patches
Plain Diff
multibody/geom: restore behavior with model input in addGeometryObject
parent
7571b465
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/multibody/geometry.hpp
+21
-2
21 additions, 2 deletions
src/multibody/geometry.hpp
src/multibody/geometry.hxx
+5
-12
5 additions, 12 deletions
src/multibody/geometry.hxx
unittest/geom.cpp
+11
-8
11 additions, 8 deletions
unittest/geom.cpp
with
37 additions
and
22 deletions
src/multibody/geometry.hpp
+
21
−
2
View file @
e66994ba
...
...
@@ -70,6 +70,7 @@ namespace se3
/**
* @brief Add a geometry object to a GeometryModel
* @deprecated This method has been set to deprecated. Please use other signature of addGeometryObject.
*
* @param[in] object Object
* @param[in] model Corresponding model, used to assert the attributes of object.
...
...
@@ -82,16 +83,34 @@ namespace se3
PINOCCHIO_DEPRECATED
GeomIndex
addGeometryObject
(
GeometryObject
object
,
const
ModelTpl
<
S2
,
O2
,
_JointCollectionTpl
>
&
model
,
const
bool
autofillJointParent
=
false
);
const
bool
autofillJointParent
)
{
if
(
autofillJointParent
)
addGeometryObject
(
object
,
model
);
else
addGeometryObject
(
object
);
}
/**
* @brief Add a geometry object to a GeometryModel.
* @brief Add a geometry object to a GeometryModel
and set its parent joint
.
*
* @param[in] object Object
* @param[in] model Corresponding model, used to assert the attributes of object.
*
* @return The index of the new added GeometryObject in geometryObjects
* @note object is a nonconst copy to ease the insertion code.
*/
template
<
typename
S2
,
int
O2
,
template
<
typename
,
int
>
class
_JointCollectionTpl
>
GeomIndex
addGeometryObject
(
const
GeometryObject
&
object
,
const
ModelTpl
<
S2
,
O2
,
_JointCollectionTpl
>
&
model
);
/**
* @brief Add a geometry object to a GeometryModel.
*
* @param[in] object Object
*
* @return The index of the new added GeometryObject in geometryObjects.
*/
GeomIndex
addGeometryObject
(
const
GeometryObject
&
object
);
/**
...
...
This diff is collapsed.
Click to expand it.
src/multibody/geometry.hxx
+
5
−
12
View file @
e66994ba
...
...
@@ -50,19 +50,11 @@ namespace se3
#else
{}
#endif // WITH_HPP_FCL
template
<
typename
S2
,
int
O2
,
template
<
typename
,
int
>
class
JointCollectionTpl
>
PINOCCHIO_DEPRECATED
GeomIndex
GeometryModel
::
addGeometryObject
(
GeometryObject
object
,
const
ModelTpl
<
S2
,
O2
,
JointCollectionTpl
>
&
model
,
const
bool
autofillJointParent
)
GeomIndex
GeometryModel
::
addGeometryObject
(
const
GeometryObject
&
object
,
const
ModelTpl
<
S2
,
O2
,
JointCollectionTpl
>
&
model
)
{
// TODO reenable when relevant: assert( (object.parentFrame != -1) || (object.parentJoint != -1) );
if
(
autofillJointParent
)
// TODO: this might be automatically done for some default value of parentJoint (eg ==-1)
object
.
parentJoint
=
model
.
frames
[
object
.
parentFrame
].
parent
;
assert
(
//TODO: reenable when relevant (object.parentFrame == -1) ||
(
model
.
frames
[
object
.
parentFrame
].
type
==
se3
::
BODY
)
);
assert
(
//TODO: reenable when relevant (object.parentFrame == -1) ||
...
...
@@ -70,11 +62,12 @@ namespace se3
GeomIndex
idx
=
(
GeomIndex
)
(
ngeoms
++
);
geometryObjects
.
push_back
(
object
);
geometryObjects
.
back
().
parentJoint
=
model
.
frames
[
object
.
parentFrame
].
parent
;
return
idx
;
}
inline
GeomIndex
GeometryModel
::
addGeometryObject
(
const
GeometryObject
&
object
)
{
{
GeomIndex
idx
=
(
GeomIndex
)
(
ngeoms
++
);
geometryObjects
.
push_back
(
object
);
return
idx
;
...
...
This diff is collapsed.
Click to expand it.
unittest/geom.cpp
+
11
−
8
View file @
e66994ba
...
...
@@ -64,18 +64,21 @@ BOOST_AUTO_TEST_CASE ( simple_boxes )
boost
::
shared_ptr
<
fcl
::
Box
>
sample
(
new
fcl
::
Box
(
1
,
1
,
1
));
Model
::
FrameIndex
body_id_1
=
model
.
getBodyId
(
"planar1_body"
);
Model
::
JointIndex
joint_parent_1
=
model
.
frames
[
body_id_1
].
parent
;
geomModel
.
addGeometryObject
(
GeometryObject
(
"ff1_collision_object"
,
model
.
getBodyId
(
"planar1_body"
),
joint_parent_1
,
sample
,
SE3
::
Identity
(),
""
,
Eigen
::
Vector3d
::
Ones
())
);
Model
::
JointIndex
idx_geom1
=
geomModel
.
addGeometryObject
(
GeometryObject
(
"ff1_collision_object"
,
model
.
getBodyId
(
"planar1_body"
),
joint_parent_1
,
sample
,
SE3
::
Identity
(),
""
,
Eigen
::
Vector3d
::
Ones
())
);
geomModel
.
geometryObjects
[
idx_geom1
].
parentJoint
=
model
.
frames
[
body_id_1
].
parent
;
boost
::
shared_ptr
<
fcl
::
Box
>
sample2
(
new
fcl
::
Box
(
1
,
1
,
1
));
Model
::
FrameIndex
body_id_2
=
model
.
getBodyId
(
"planar2_body"
);
Model
::
JointIndex
joint_parent_2
=
model
.
frames
[
body_id_2
].
parent
;
geomModel
.
addGeometryObject
(
GeometryObject
(
"ff2_collision_object"
,
model
.
getBodyId
(
"planar2_body"
),
joint_parent_2
,
sample2
,
SE3
::
Identity
(),
""
,
Eigen
::
Vector3d
::
Ones
())
);
Model
::
JointIndex
idx_geom2
=
geomModel
.
addGeometryObject
(
GeometryObject
(
"ff2_collision_object"
,
model
.
getBodyId
(
"planar2_body"
),
joint_parent_2
,
sample2
,
SE3
::
Identity
(),
""
,
Eigen
::
Vector3d
::
Ones
()),
model
);
BOOST_CHECK
(
geomModel
.
geometryObjects
[
idx_geom2
].
parentJoint
==
model
.
frames
[
body_id_2
].
parent
);
geomModel
.
addAllCollisionPairs
();
se3
::
Data
data
(
model
);
...
...
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