Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gabriele Buondonno
pinocchio
Commits
6f90a7f5
Commit
6f90a7f5
authored
Mar 08, 2016
by
Valenza Florian
Browse files
[C++][GeomParser] Throw runtime if ROS_PACKAGE_PATH is empty
parent
f905f7a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/multibody/parser/urdf-with-geometry.hxx
View file @
6f90a7f5
...
...
@@ -149,7 +149,15 @@ namespace se3
{
GeometryModel
model_geom
(
model
);
appendRosPackagePaths
(
package_dirs
);
try
{
appendRosPackagePaths
(
package_dirs
);
}
catch
(
std
::
runtime_error
&
e
)
{
std
::
cout
<<
"ROS_PACKAGE_PATH environment variable is empty. Meshes may not be found when looking for geometry"
<<
std
::
endl
;
assert
(
!
package_dirs
.
empty
()
&&
"You did not specify any package directory. Geometric parsing will crash"
);
}
::
urdf
::
ModelInterfacePtr
urdfTree
=
::
urdf
::
parseURDFFile
(
filename
);
parseTreeForGeom
(
urdfTree
->
getRoot
(),
model
,
model_geom
,
package_dirs
,
root_joint
);
return
model_geom
;
...
...
@@ -162,7 +170,15 @@ namespace se3
GeometryModel
model_geom
(
model
);
std
::
vector
<
std
::
string
>
package_dirs
;
appendRosPackagePaths
(
package_dirs
);
try
{
appendRosPackagePaths
(
package_dirs
);
}
catch
(
std
::
runtime_error
&
e
)
{
std
::
cout
<<
"ROS_PACKAGE_PATH environment variable is empty. Meshes may not be found when looking for geometry"
<<
std
::
endl
;
assert
(
false
&&
"You did not specify any package directory. Geometric parsing will crash"
);
}
::
urdf
::
ModelInterfacePtr
urdfTree
=
::
urdf
::
parseURDFFile
(
filename
);
parseTreeForGeom
(
urdfTree
->
getRoot
(),
model
,
model_geom
,
package_dirs
,
root_joint
);
...
...
src/tools/file-explorer.hpp
View file @
6f90a7f5
...
...
@@ -21,6 +21,7 @@
#include
<string>
#include
<iostream>
#include
<vector>
#include
<exception>
#include
"boost/filesystem.hpp"
...
...
@@ -33,13 +34,17 @@ namespace se3
*
* @param[in][out] paths { The package directories where to search for meshes }
*/
void
appendRosPackagePaths
(
std
::
vector
<
std
::
string
>
&
package_dirs
)
void
appendRosPackagePaths
(
std
::
vector
<
std
::
string
>
&
package_dirs
)
throw
(
std
::
runtime_error
)
{
std
::
string
delimiter
=
":"
;
std
::
string
policyStr
=
std
::
getenv
(
"ROS_PACKAGE_PATH"
);
size_t
lastOffset
=
0
;
if
(
policyStr
.
empty
())
{
throw
std
::
runtime_error
(
"ROS_PACKAGE_PATH environment variable is empty"
);
}
while
(
true
)
{
size_t
offset
=
policyStr
.
find_first_of
(
delimiter
,
lastOffset
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment