Skip to content

Commit 07bd109

Browse files
committed
Merge pull request #214 from personalrobotics/feature/action_error
Added a render flag to RenderTrajectory.
2 parents acd5ac9 + 2520df1 commit 07bd109

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/prpy/action/__init__.py

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

3-
from actionlibrary import ActionLibrary, ActionMethod
3+
from actionlibrary import ActionLibrary, ActionMethod, ActionError

src/prpy/action/actionlibrary.py

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

3+
class ActionError(Exception):
4+
pass
5+
36
class ActionMethod(object):
47

58
def __init__(self, func):

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)