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
Guilhem Saurel
hpp-rbprm-corba
Commits
8a057f97
Commit
8a057f97
authored
Feb 12, 2019
by
Pierre Fernbach
Browse files
merge tools.py and display_tools.py scripts
parent
4da93bb2
Changes
2
Hide whitespace changes
Inline
Side-by-side
script/scenarios/sandbox/dynamic/tools.py
deleted
100644 → 0
View file @
4da93bb2
def
addSphere
(
viewer
,
color
,
pos
,
rotation
=
None
,
name
=
None
,
radius
=
0.01
):
gui
=
viewer
.
client
.
gui
if
name
==
None
:
i
=
0
name
=
'sphere_'
+
str
(
i
)
while
name
in
gui
.
getNodeList
():
i
=
i
+
1
name
=
'sphere_'
+
str
(
i
)
gui
.
addSphere
(
name
,
radius
,
color
)
gui
.
setVisibility
(
name
,
"ALWAYS_ON_TOP"
)
gui
.
addToGroup
(
name
,
viewer
.
sceneName
)
if
len
(
pos
)
==
7
:
rotation
=
pos
[
3
:
7
]
pos
=
pos
[
0
:
3
]
if
rotation
==
None
:
rotation
=
[
1
,
0
,
0
,
0
]
else
:
viewer
.
addLandmark
(
name
,
0.1
)
gui
.
applyConfiguration
(
name
,
pos
+
rotation
)
gui
.
refresh
()
def
moveObject
(
viewer
,
pos
,
rotation
=
[
1
,
0
,
0
,
0
]):
viewer
.
client
.
gui
.
applyConfiguration
(
name
,
pos
+
rotation
)
viewer
.
client
.
gui
.
refresh
()
def
addVector
(
viewer
,
rbprmBuilder
,
color
,
v
,
name
=
None
):
gui
=
viewer
.
client
.
gui
if
name
==
None
:
i
=
0
name
=
'vector_'
+
str
(
i
)
while
name
in
gui
.
getNodeList
():
i
=
i
+
1
name
=
'sphere_'
+
str
(
i
)
quat
=
rbprmBuilder
.
quaternionFromVector
(
v
[
3
:
6
])
v
[
3
:
7
]
=
quat
[::]
gui
.
addArrow
(
name
,
0.02
,
1
,
color
)
gui
.
addToGroup
(
name
,
viewer
.
sceneName
)
gui
.
setVisibility
(
name
,
"ON"
)
gui
.
applyConfiguration
(
name
,
v
)
gui
.
refresh
()
script/tools/display_tools.py
View file @
8a057f97
...
...
@@ -16,3 +16,25 @@ def displayContactSequence(r,configs,pause=1.):
for
i
in
range
(
0
,
len
(
configs
)):
r
(
configs
[
i
])
time
.
sleep
(
pause
)
def
moveObject
(
viewer
,
pos
,
rotation
=
[
1
,
0
,
0
,
0
]):
viewer
.
client
.
gui
.
applyConfiguration
(
name
,
pos
+
rotation
)
viewer
.
client
.
gui
.
refresh
()
def
addVector
(
viewer
,
rbprmBuilder
,
color
,
v
,
name
=
None
):
gui
=
viewer
.
client
.
gui
if
name
==
None
:
i
=
0
name
=
'vector_'
+
str
(
i
)
while
name
in
gui
.
getNodeList
():
i
=
i
+
1
name
=
'sphere_'
+
str
(
i
)
quat
=
rbprmBuilder
.
quaternionFromVector
(
v
[
3
:
6
])
v
[
3
:
7
]
=
quat
[::]
gui
.
addArrow
(
name
,
0.02
,
1
,
color
)
gui
.
addToGroup
(
name
,
viewer
.
sceneName
)
gui
.
setVisibility
(
name
,
"ON"
)
gui
.
applyConfiguration
(
name
,
v
)
gui
.
refresh
()
Write
Preview
Markdown
is supported
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