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
7cab9e84
Verified
Commit
7cab9e84
authored
6 years ago
by
Gabriele Buondonno
Committed by
Justin Carpentier
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[pythontest] Moved python tests in unittest folder
parent
ebb583f5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittest/python/bindings_geometry_object.py
+40
-13
40 additions, 13 deletions
unittest/python/bindings_geometry_object.py
with
40 additions
and
13 deletions
unittest/python/bindings_geometry_object.py
+
40
−
13
View file @
7cab9e84
import
unittest
import
pinocchio
as
se3
import
numpy
as
np
from
pinocchio.utils
import
eye
,
zero
,
rand
import
os
ones
=
lambda
n
:
np
.
matrix
(
np
.
ones
([
n
,
1
]
if
isinstance
(
n
,
int
)
else
n
),
np
.
double
)
# TODO: remove these lines. Do not use RobotWrapper. Do not use URDF
from
pinocchio.robot_wrapper
import
RobotWrapper
current_file
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
romeo_model_dir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
current_file
,
'
../../models/romeo
'
))
romeo_model_path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
romeo_model_dir
,
'
romeo_description/urdf/romeo.urdf
'
))
hint_list
=
[
romeo_model_dir
,
"
wrong/hint
"
]
# hint list
robot
=
RobotWrapper
(
romeo_model_path
,
hint_list
,
se3
.
JointModelFreeFlyer
())
expected_mesh_path
=
os
.
path
.
join
(
romeo_model_dir
,
'
romeo_description/meshes/V1/collision/LHipPitch.dae
'
)
class
TestGeometryObjectBindings
(
unittest
.
TestCase
):
v3zero
=
zero
(
3
)
v6zero
=
zero
(
6
)
v3ones
=
ones
(
3
)
m3zero
=
zero
([
3
,
3
])
m6zero
=
zero
([
6
,
6
])
m3ones
=
eye
(
3
)
m4ones
=
eye
(
4
)
# WARNING: the collision model is the same object is the same for all the tests.
# This can cause problems if a test expects the collision model to be in a certain way but a previous test has changed it
# Still, at the moment this is not the case.
# Loading the URDF and related meshes before each test would make the whole unit test run too slowly
#
# TODO: do not use URDF. Then, build self.collision_model from scratch for each test
def
setUp
(
self
):
model
=
se3
.
buildSampleModelHumanoid
()
self
.
collision_model
=
se3
.
buildSampleGeometryModelHumanoid
(
model
)
self
.
collision_model
=
robot
.
collision_model
self
.
expected_mesh_path
=
expected_mesh_path
def
test_name_get_set
(
self
):
col
=
self
.
collision_model
.
geometryObjects
[
0
]
self
.
assertTrue
(
col
.
name
==
'
rlegshoulder_object
'
)
col
=
self
.
collision_model
.
geometryObjects
[
1
]
self
.
assertTrue
(
col
.
name
==
'
LHipPitchLink_0
'
)
col
.
name
=
'
new_collision_name
'
self
.
assertTrue
(
col
.
name
==
'
new_collision_name
'
)
def
test_parent_get_set
(
self
):
col
=
self
.
collision_model
.
geometryObjects
[
0
]
self
.
assertTrue
(
col
.
parentJoint
==
2
)
col
.
parentJoint
=
3
self
.
assertTrue
(
col
.
parentJoint
==
3
)
col
=
self
.
collision_model
.
geometryObjects
[
1
]
self
.
assertTrue
(
col
.
parentJoint
==
4
)
col
.
parentJoint
=
5
self
.
assertTrue
(
col
.
parentJoint
==
5
)
def
test_placement_get_set
(
self
):
m
=
se3
.
SE3
.
Identity
(
)
new_m
=
se3
.
SE3
.
Random
(
)
col
=
self
.
collision_model
.
geometryObjects
[
0
]
m
=
se3
.
SE3
(
self
.
m3ones
,
self
.
v3zero
)
new_m
=
se3
.
SE3
(
rand
([
3
,
3
]),
rand
(
3
)
)
col
=
self
.
collision_model
.
geometryObjects
[
1
]
self
.
assertTrue
(
np
.
allclose
(
col
.
placement
.
homogeneous
,
m
.
homogeneous
))
col
.
placement
=
new_m
self
.
assertTrue
(
np
.
allclose
(
col
.
placement
.
homogeneous
,
new_m
.
homogeneous
))
def
test_meshpath_get
(
self
):
col
=
self
.
collision_model
.
geometryObjects
[
0
]
self
.
assertTrue
(
col
.
meshPath
==
""
)
col
=
self
.
collision_model
.
geometryObjects
[
1
]
self
.
assertTrue
(
col
.
meshPath
==
self
.
expected_mesh_path
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
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