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
15be131a
Commit
15be131a
authored
9 years ago
by
jcarpent
Browse files
Options
Downloads
Patches
Plain Diff
[C++][Bug Fixed] Throw exception instead of a runtime error when file is missing
parent
979b7936
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/multibody/parser/from-collada-to-fcl.hpp
+9
-5
9 additions, 5 deletions
src/multibody/parser/from-collada-to-fcl.hpp
with
9 additions
and
5 deletions
src/multibody/parser/from-collada-to-fcl.hpp
+
9
−
5
View file @
15be131a
...
...
@@ -36,6 +36,8 @@
#include
<hpp/fcl/BV/OBBRSS.h>
#include
<hpp/fcl/BVH/BVH_model.h>
#include
<exception>
typedef
fcl
::
BVHModel
<
fcl
::
OBBRSS
>
PolyhedronType
;
typedef
boost
::
shared_ptr
<
PolyhedronType
>
PolyhedronPtrType
;
...
...
@@ -138,13 +140,13 @@ inline void buildMesh (const ::urdf::Vector3 & scale,
inline
void
meshFromAssimpScene
(
const
std
::
string
&
name
,
const
::
urdf
::
Vector3
&
scale
,
const
aiScene
*
scene
,
const
Polyhedron
PtrType
&
mesh
)
const
Polyhedron
_ptr
&
mesh
)
throw
(
std
::
invalid_argument
)
{
TriangleAndVertices
tv
;
if
(
!
scene
->
HasMeshes
())
{
throw
std
::
runtime_error
(
std
::
string
(
"No meshes found in file "
)
+
throw
std
::
invalid_argument
(
std
::
string
(
"No meshes found in file "
)
+
name
);
}
...
...
@@ -176,7 +178,7 @@ inline void meshFromAssimpScene (const std::string & name,
*/
inline
void
loadPolyhedronFromResource
(
const
std
::
string
&
resource_path
,
const
::
urdf
::
Vector3
&
scale
,
const
Polyhedron
PtrType
&
polyhedron
)
const
Polyhedron
_ptr
&
polyhedron
)
throw
(
std
::
invalid_argument
)
{
Assimp
::
Importer
importer
;
const
aiScene
*
scene
=
importer
.
ReadFile
(
resource_path
.
c_str
(),
aiProcess_SortByPType
|
aiProcess_GenNormals
|
...
...
@@ -184,8 +186,10 @@ inline void loadPolyhedronFromResource (const std::string & resource_path,
aiProcess_FlipUVs
);
if
(
!
scene
)
{
throw
std
::
runtime_error
(
std
::
string
(
"Could not load resource "
)
+
resource_path
+
std
::
string
(
"
\n
"
)
+
importer
.
GetErrorString
());
const
std
::
string
exception_message
(
std
::
string
(
"Could not load resource "
)
+
resource_path
+
std
::
string
(
"
\n
"
)
+
importer
.
GetErrorString
()
+
std
::
string
(
"
\n
"
)
+
"Hint: the mesh directory may be wrong."
);
throw
std
::
invalid_argument
(
exception_message
);
}
meshFromAssimpScene
(
resource_path
,
scale
,
scene
,
polyhedron
);
...
...
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