Commit a1576131 authored by Pierre Fernbach's avatar Pierre Fernbach
Browse files

[Scripts] use new 'ghost' argument of gepetto viewer

parent 418e5af5
......@@ -118,10 +118,7 @@ class AbstractContactGenerator:
"""
Create a Viewer instance
"""
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
self.v = Viewer(self.ps, viewerClient=self.path_planner.v.client, displayCoM=True)
def compute_configs_from_guide(self, use_acc_init=True, use_acc_end=False, set_ref_height=True):
"""
......@@ -204,16 +201,15 @@ class AbstractContactGenerator:
"""
display the guide path planned
"""
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")
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):
"""
......
......@@ -111,26 +111,11 @@ class AbstractPathPlanner:
self.afftool.setAffordanceConfig('Support', [0.5, 0.03, 0.00005])
self.afftool.loadObstacleModel("package://"+env_package + "/urdf/" + env_name + ".urdf",
"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):
return
def addLandmark(self, a, b):
return
self.v = FakeViewer()
self.v = vf.createViewer(ghost = True, displayArrows=True)
self.pp = PathPlayer(self.v)
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):
"""
......@@ -195,15 +180,13 @@ class AbstractPathPlanner:
"""
Remove the current robot from the display
"""
if self.v.client is not None:
self.v.client.gui.setVisibility(self.robot_node_name, "OFF")
self.v.client.gui.setVisibility(self.robot_node_name, "OFF")
def show_rom(self):
"""
Add the current robot to the display
"""
if self.v.client is not None:
self.v.client.gui.setVisibility(self.robot_node_name, "ON")
self.v.client.gui.setVisibility(self.robot_node_name, "ON")
@abstractmethod
def run(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment