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
e8aa1148
Commit
e8aa1148
authored
Jun 03, 2016
by
Joseph Mirabel
Browse files
Merge pull request #6 from jmirabel/devel
Report bug when loading mesh.
parents
daad9315
75bb1ac9
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/hpp/model/urdf/parser.hh
View file @
e8aa1148
...
@@ -170,7 +170,8 @@ namespace hpp
...
@@ -170,7 +170,8 @@ namespace hpp
const
aiScene
*
scene
,
const
aiScene
*
scene
,
const
PolyhedronPtrType
&
mesh
);
const
PolyhedronPtrType
&
mesh
);
void
buildMesh
(
const
::
urdf
::
Vector3
&
scale
,
void
buildMesh
(
const
std
::
string
&
name
,
const
::
urdf
::
Vector3
&
scale
,
const
aiScene
*
scene
,
const
aiScene
*
scene
,
const
aiNode
*
node
,
const
aiNode
*
node
,
std
::
vector
<
unsigned
>&
subMeshIndexes
,
std
::
vector
<
unsigned
>&
subMeshIndexes
,
...
...
src/urdf/parser.cc
View file @
e8aa1148
...
@@ -595,7 +595,8 @@ namespace hpp
...
@@ -595,7 +595,8 @@ namespace hpp
return
position
;
return
position
;
}
}
void
Parser
::
buildMesh
(
const
::
urdf
::
Vector3
&
scale
,
void
Parser
::
buildMesh
(
const
std
::
string
&
name
,
const
::
urdf
::
Vector3
&
scale
,
const
aiScene
*
scene
,
const
aiScene
*
scene
,
const
aiNode
*
node
,
const
aiNode
*
node
,
std
::
vector
<
unsigned
>&
subMeshIndexes
,
std
::
vector
<
unsigned
>&
subMeshIndexes
,
...
@@ -632,6 +633,15 @@ namespace hpp
...
@@ -632,6 +633,15 @@ namespace hpp
// add the indices
// add the indices
for
(
uint32_t
j
=
0
;
j
<
input_mesh
->
mNumFaces
;
j
++
)
{
for
(
uint32_t
j
=
0
;
j
<
input_mesh
->
mNumFaces
;
j
++
)
{
aiFace
&
face
=
input_mesh
->
mFaces
[
j
];
aiFace
&
face
=
input_mesh
->
mFaces
[
j
];
if
(
face
.
mNumIndices
!=
3
)
{
std
::
stringstream
ss
;
ss
<<
"Mesh "
<<
name
<<
" has a face with "
<<
face
.
mNumIndices
<<
" vertices. This is not supported
\n
"
;
ss
<<
"Node name is: "
<<
node
->
mName
.
C_Str
()
<<
"
\n
"
;
ss
<<
"Mesh index: "
<<
i
<<
"
\n
"
;
ss
<<
"Face index: "
<<
j
<<
"
\n
"
;
throw
std
::
invalid_argument
(
ss
.
str
());
}
// FIXME: can add only triangular faces.
// FIXME: can add only triangular faces.
triangles_
.
push_back
(
fcl
::
Triangle
triangles_
.
push_back
(
fcl
::
Triangle
(
oldNbPoints
+
face
.
mIndices
[
0
],
(
oldNbPoints
+
face
.
mIndices
[
0
],
...
@@ -647,7 +657,7 @@ namespace hpp
...
@@ -647,7 +657,7 @@ namespace hpp
}
}
for
(
uint32_t
i
=
0
;
i
<
node
->
mNumChildren
;
++
i
)
{
for
(
uint32_t
i
=
0
;
i
<
node
->
mNumChildren
;
++
i
)
{
buildMesh
(
scale
,
scene
,
node
->
mChildren
[
i
],
subMeshIndexes
,
mesh
);
buildMesh
(
name
,
scale
,
scene
,
node
->
mChildren
[
i
],
subMeshIndexes
,
mesh
);
}
}
}
}
...
@@ -671,7 +681,7 @@ namespace hpp
...
@@ -671,7 +681,7 @@ namespace hpp
}
}
vertices_
.
clear
();
vertices_
.
clear
();
triangles_
.
clear
();
triangles_
.
clear
();
buildMesh
(
scale
,
scene
,
scene
->
mRootNode
,
subMeshIndexes
,
mesh
);
buildMesh
(
name
,
scale
,
scene
,
scene
->
mRootNode
,
subMeshIndexes
,
mesh
);
mesh
->
addSubModel
(
vertices_
,
triangles_
);
mesh
->
addSubModel
(
vertices_
,
triangles_
);
mesh
->
endModel
();
mesh
->
endModel
();
...
...
tests/CMakeLists.txt
View file @
e8aa1148
...
@@ -48,7 +48,6 @@ MACRO(ADD_TESTCASE NAME GENERATED)
...
@@ -48,7 +48,6 @@ MACRO(ADD_TESTCASE NAME GENERATED)
${
PROJECT_NAME
}
)
${
PROJECT_NAME
}
)
PKG_CONFIG_USE_DEPENDENCY
(
${
NAME
}
hpp-model
)
PKG_CONFIG_USE_DEPENDENCY
(
${
NAME
}
hpp-model
)
PKG_CONFIG_USE_DEPENDENCY
(
${
NAME
}
srdfdom
)
PKG_CONFIG_USE_DEPENDENCY
(
${
NAME
}
srdfdom
)
PKG_CONFIG_USE_DEPENDENCY
(
${
NAME
}
rcpdf
)
ENDMACRO
(
ADD_TESTCASE
)
ENDMACRO
(
ADD_TESTCASE
)
# Generated test.
# Generated test.
...
...
tests/display-robot.cc
View file @
e8aa1148
...
@@ -30,8 +30,8 @@ using boost::test_tools::output_test_stream;
...
@@ -30,8 +30,8 @@ using boost::test_tools::output_test_stream;
BOOST_AUTO_TEST_CASE
(
display_robot
)
BOOST_AUTO_TEST_CASE
(
display_robot
)
{
{
hpp
::
model
::
HumanoidRobot
Sh
Ptr
humanoidRobot
;
hpp
::
model
::
HumanoidRobotPtr
_t
humanoidRobot
;
hpp
::
model
::
urdf
::
loadRobotModel
(
humanoidRobot
,
"romeo"
,
""
,
""
,
""
);
hpp
::
model
::
urdf
::
loadRobotModel
(
humanoidRobot
,
"freeflyer"
,
"romeo"
,
""
,
""
,
""
);
std
::
ofstream
log
(
"./display-robot.log"
);
std
::
ofstream
log
(
"./display-robot.log"
);
log
<<
*
(
humanoidRobot
.
get
())
<<
std
::
endl
;
log
<<
*
(
humanoidRobot
.
get
())
<<
std
::
endl
;
...
...
Write
Preview
Supports
Markdown
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