Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Humanoid Path Planner
hpp-model-urdf
Commits
c1b1dc06
Commit
c1b1dc06
authored
Jan 30, 2015
by
Nassime BLIN
Browse files
Added sphere geometry type in Parser::addSolidComponentToJoint
parent
ffb0f808
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/urdf/parser.cc
View file @
c1b1dc06
...
...
@@ -705,33 +705,44 @@ namespace hpp
loadPolyhedronFromResource
(
collisionFilename
,
scale
,
polyhedron
);
geometry
=
polyhedron
;
}
// Handle the case where collision geometry is a cylinder
// Use FCL capsules for cylinders
if
(
collision
->
geometry
->
type
==
::
urdf
::
Geometry
::
CYLINDER
)
{
boost
::
shared_ptr
<
::
urdf
::
Cylinder
>
collisionGeometry
=
boost
::
dynamic_pointer_cast
<
::
urdf
::
Cylinder
>
(
collision
->
geometry
);
double
radius
=
collisionGeometry
->
radius
;
double
length
=
collisionGeometry
->
length
;
// Create fcl capsule geometry.
geometry
=
fcl
::
CollisionGeometryPtr_t
(
new
fcl
::
Capsule
(
radius
,
length
));
else
if
(
collision
->
geometry
->
type
==
::
urdf
::
Geometry
::
CYLINDER
)
{
boost
::
shared_ptr
<
::
urdf
::
Cylinder
>
collisionGeometry
=
boost
::
dynamic_pointer_cast
<
::
urdf
::
Cylinder
>
(
collision
->
geometry
);
double
radius
=
collisionGeometry
->
radius
;
double
length
=
collisionGeometry
->
length
;
// Create fcl capsule geometry.
geometry
=
fcl
::
CollisionGeometryPtr_t
(
new
fcl
::
Capsule
(
radius
,
length
));
}
// Handle the case where collision geometry is a box.
if
(
collision
->
geometry
->
type
==
::
urdf
::
Geometry
::
BOX
)
{
boost
::
shared_ptr
<
::
urdf
::
Box
>
collisionGeometry
=
boost
::
dynamic_pointer_cast
<
::
urdf
::
Box
>
(
collision
->
geometry
);
else
if
(
collision
->
geometry
->
type
==
::
urdf
::
Geometry
::
BOX
)
{
boost
::
shared_ptr
<
::
urdf
::
Box
>
collisionGeometry
=
boost
::
dynamic_pointer_cast
<
::
urdf
::
Box
>
(
collision
->
geometry
);
double
x
=
collisionGeometry
->
dim
.
x
;
double
y
=
collisionGeometry
->
dim
.
y
;
double
z
=
collisionGeometry
->
dim
.
z
;
geometry
=
fcl
::
CollisionGeometryPtr_t
(
new
fcl
::
Box
(
x
,
y
,
z
));
}
// Handle the case where collision geometry is a sphere.
else
if
(
collision
->
geometry
->
type
==
::
urdf
::
Geometry
::
SPHERE
)
{
boost
::
shared_ptr
<
::
urdf
::
Sphere
>
collisionGeometry
=
boost
::
dynamic_pointer_cast
<
::
urdf
::
Sphere
>
(
collision
->
geometry
);
double
x
=
collisionGeometry
->
dim
.
x
;
double
y
=
collisionGeometry
->
dim
.
y
;
double
z
=
collisionGeometry
->
dim
.
z
;
double
radius
=
collisionGeometry
->
radius
;
geometry
=
fcl
::
CollisionGeometryPtr_t
(
new
fcl
::
Sphere
(
radius
));
}
else
throw
std
::
runtime_error
(
std
::
string
(
"Unknown geometry type :"
));
// +
//collision->geometry->type);
geometry
=
fcl
::
CollisionGeometryPtr_t
(
new
fcl
::
Box
(
x
,
y
,
z
));
}
// Compute body position in world frame.
MatrixHomogeneousType
position
=
computeBodyAbsolutePosition
(
link
,
collision
->
origin
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment