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
Humanoid Path Planner
hpp-fcl
Commits
6bdbe5d3
Verified
Commit
6bdbe5d3
authored
Jul 16, 2020
by
Joseph Mirabel
Committed by
Justin Carpentier
Aug 14, 2020
Browse files
Update gepetto-viewer utility functions.
parent
88cc70a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
python/hppfcl/viewer.py
View file @
6bdbe5d3
...
...
@@ -54,3 +54,27 @@ def displayDistanceResult(gui, group_name, res, closest_points = True, normal =
gui
.
applyConfiguration
(
n
,
res
.
getNearestPoint1
().
tolist
()
+
hppfcl
.
Quaternion
.
FromTwoVectors
(
np
.
array
([
1
,
0
,
0
]),
res
.
normal
).
coeffs
().
tolist
())
gui
.
refresh
()
def
displayCollisionResult
(
gui
,
group_name
,
res
,
color
=
Color
.
green
):
if
res
.
isCollision
():
if
gui
.
nodeExists
(
group_name
):
gui
.
setVisibility
(
group_name
,
"ON"
)
else
:
gui
.
createGroup
(
group_name
)
for
i
in
range
(
res
.
numContacts
()):
contact
=
res
.
getContact
(
i
)
n
=
group_name
+
"/contact"
+
str
(
i
)
depth
=
contact
.
penetration_depth
if
gui
.
nodeExists
(
n
):
gui
.
setFloatProperty
(
n
,
'Size'
,
depth
)
gui
.
setFloatProperty
(
n
,
'Radius'
,
0.1
*
depth
)
gui
.
setColor
(
n
,
color
)
else
:
gui
.
addArrow
(
n
,
depth
*
0.1
,
depth
,
color
)
N
=
contact
.
normal
P
=
contact
.
pos
gui
.
applyConfiguration
(
n
,
(
P
-
depth
*
N
/
2
).
tolist
()
+
hppfcl
.
Quaternion
.
FromTwoVectors
(
np
.
array
([
1
,
0
,
0
]),
N
).
coeffs
().
tolist
())
gui
.
refresh
()
elif
gui
.
nodeExists
(
group_name
):
gui
.
setVisibility
(
group_name
,
"OFF"
)
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