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
6694918d
Commit
6694918d
authored
Mar 19, 2020
by
Pierre Fernbach
Browse files
Update the scenario classes to be ran without a viewer
parent
86658f5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/hpp/corbaserver/rbprm/scenarios/abstract_contact_generator.py
View file @
6694918d
...
...
@@ -118,7 +118,10 @@ class AbstractContactGenerator:
"""
Create a Viewer instance
"""
self
.
v
=
Viewer
(
self
.
ps
,
viewerClient
=
self
.
path_planner
.
v
.
client
,
displayCoM
=
True
)
if
self
.
path_planner
.
v
.
client
is
not
None
:
self
.
v
=
Viewer
(
self
.
ps
,
viewerClient
=
self
.
path_planner
.
v
.
client
,
displayCoM
=
True
)
else
:
self
.
v
=
self
.
path_planner
.
v
def
compute_configs_from_guide
(
self
,
use_acc_init
=
True
,
use_acc_end
=
False
,
set_ref_height
=
True
):
"""
...
...
@@ -201,15 +204,16 @@ class AbstractContactGenerator:
"""
display the guide path planned
"""
self
.
v
.
client
.
gui
.
setVisibility
(
self
.
robot_node_name
,
"OFF"
)
self
.
path_planner
.
show_rom
()
self
.
cl
.
problem
.
selectProblem
(
"guide_planning"
)
# this is not the same problem as in the guide_planner. We only added the final path in this problem,
# thus there is only 1 path in this problem
self
.
path_planner
.
pp
(
0
)
self
.
cl
.
problem
.
selectProblem
(
"default"
)
self
.
path_planner
.
hide_rom
()
self
.
v
.
client
.
gui
.
setVisibility
(
self
.
robot_node_name
,
"ON"
)
if
self
.
v
.
client
is
not
None
:
self
.
v
.
client
.
gui
.
setVisibility
(
self
.
robot_node_name
,
"OFF"
)
self
.
path_planner
.
show_rom
()
self
.
cl
.
problem
.
selectProblem
(
"guide_planning"
)
# this is not the same problem as in the guide_planner. We only added the final path in this problem,
# thus there is only 1 path in this problem
self
.
path_planner
.
pp
(
0
)
self
.
cl
.
problem
.
selectProblem
(
"default"
)
self
.
path_planner
.
hide_rom
()
self
.
v
.
client
.
gui
.
setVisibility
(
self
.
robot_node_name
,
"ON"
)
def
run
(
self
):
"""
...
...
src/hpp/corbaserver/rbprm/scenarios/abstract_path_planner.py
View file @
6694918d
...
...
@@ -112,11 +112,15 @@ class AbstractPathPlanner:
self
.
afftool
.
loadObstacleModel
(
env_package
,
env_name
,
"planning"
,
vf
,
reduceSizes
=
reduce_sizes
)
try
:
self
.
v
=
vf
.
createViewer
(
displayArrows
=
True
)
self
.
pp
=
PathPlayer
(
self
.
v
)
for
aff_type
in
visualize_affordances
:
self
.
afftool
.
visualiseAffordances
(
aff_type
,
self
.
v
,
self
.
v
.
color
.
lightBrown
)
except
Exception
:
print
(
"No viewer started !"
)
class
FakeViewer
():
def
__init__
(
self
):
self
.
client
=
None
return
def
__call__
(
self
,
q
):
...
...
@@ -126,12 +130,6 @@ class AbstractPathPlanner:
return
self
.
v
=
FakeViewer
()
try
:
self
.
pp
=
PathPlayer
(
self
.
v
)
except
Exception
:
pass
for
aff_type
in
visualize_affordances
:
self
.
afftool
.
visualiseAffordances
(
aff_type
,
self
.
v
,
self
.
v
.
color
.
lightBrown
)
def
init_planner
(
self
,
kinodynamic
=
True
,
optimize
=
True
):
"""
...
...
@@ -196,13 +194,15 @@ class AbstractPathPlanner:
"""
Remove the current robot from the display
"""
self
.
v
.
client
.
gui
.
setVisibility
(
self
.
robot_node_name
,
"OFF"
)
if
self
.
v
.
client
is
not
None
:
self
.
v
.
client
.
gui
.
setVisibility
(
self
.
robot_node_name
,
"OFF"
)
def
show_rom
(
self
):
"""
Add the current robot to the display
"""
self
.
v
.
client
.
gui
.
setVisibility
(
self
.
robot_node_name
,
"ON"
)
if
self
.
v
.
client
is
not
None
:
self
.
v
.
client
.
gui
.
setVisibility
(
self
.
robot_node_name
,
"ON"
)
@
abstractmethod
def
run
(
self
):
...
...
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