Skip to content

Commit 9246d90

Browse files
committed
Add a render flag to RenderTrajectory. Add an ActionError to the action library.
1 parent ce7b6e2 commit 9246d90

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/prpy/action/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/usr/bin/env python
22

33
from actionlibrary import ActionLibrary, ActionMethod
4+
from exceptions import ActionError

src/prpy/action/exceptions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
class ActionError(Exception):
3+
pass

src/prpy/viz.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ class RenderTrajectory:
88
@param robot robot executing the trajectory
99
@param traj input trajectory
1010
@param num_samples number of samples to use for interpolation
11-
@param radius sphere radius for waypoint indicators
11+
@param linewidth The width of the rendered line representing the trajecotry
1212
@param color interpolated line color
13-
@param interpolation flag to enable or disable path rendering
14-
@param waypoints flag to enable or disable waypoint rendering
13+
@param render If true, perform the render
1514
"""
16-
def __init__(self, robot, traj, num_samples=20, linewidth=2, color=[1, 0, 0, 1]):
15+
def __init__(self, robot, traj, num_samples=20, linewidth=2, color=[1, 0, 0, 1], render=True):
1716
self.env = robot.GetEnv()
1817
self.robot = robot
1918
self.handles = list()
19+
self.render = render
2020

2121
# Rendering options.
2222
self.num_samples = num_samples
@@ -30,6 +30,9 @@ def __init__(self, robot, traj, num_samples=20, linewidth=2, color=[1, 0, 0, 1])
3030

3131
def __enter__(self):
3232

33+
if not self.render:
34+
return
35+
3336
with self.env:
3437
with self.robot.CreateRobotStateSaver():
3538
config_spec = self.traj.GetConfigurationSpecification()

0 commit comments

Comments
 (0)