Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ActionError and render flag to RenderTrajectory #214

Merged
merged 2 commits into from
Oct 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/prpy/action/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env python

from actionlibrary import ActionLibrary, ActionMethod
from actionlibrary import ActionLibrary, ActionMethod, ActionError
3 changes: 3 additions & 0 deletions src/prpy/action/actionlibrary.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env python

class ActionError(Exception):
pass

class ActionMethod(object):

def __init__(self, func):
Expand Down
11 changes: 7 additions & 4 deletions src/prpy/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ class RenderTrajectory:
@param robot robot executing the trajectory
@param traj input trajectory
@param num_samples number of samples to use for interpolation
@param radius sphere radius for waypoint indicators
@param linewidth The width of the rendered line representing the trajecotry
@param color interpolated line color
@param interpolation flag to enable or disable path rendering
@param waypoints flag to enable or disable waypoint rendering
@param render If true, perform the render
"""
def __init__(self, robot, traj, num_samples=20, linewidth=2, color=[1, 0, 0, 1]):
def __init__(self, robot, traj, num_samples=20, linewidth=2, color=[1, 0, 0, 1], render=True):
self.env = robot.GetEnv()
self.robot = robot
self.handles = list()
self.render = render

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

def __enter__(self):

if not self.render:
return

with self.env:
with self.robot.CreateRobotStateSaver():
config_spec = self.traj.GetConfigurationSpecification()
Expand Down