Skip to content

Commit a6f4284

Browse files
author
Shushman Choudhury
committed
Merge branch 'block_sorting' of https://github.com/personalrobotics/prpy into block_sorting
2 parents b6643ab + 4708328 commit a6f4284

39 files changed

+1243
-817
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
*.pyc
2+
3+
# Generated by nosetest
4+
*.noseids
5+
6+
# Generated by CBiRRT
7+
**/cmovetraj.txt

catkin.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ catkin_package()
55
catkin_python_setup()
66

77
if (CATKIN_ENABLE_TESTING)
8-
#catkin_add_nosetests(tests/test_PlanningPipeline.py)
9-
#catkin_add_nosetests(tests/test_DistanceFieldManager.py)
8+
catkin_add_nosetests(tests)
109
endif()

src/prpy/base/mico.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ def __init__(self, sim,
4545
with env:
4646
dof_indices = self.GetIndices()
4747
accel_limits = robot.GetDOFAccelerationLimits()
48-
accel_limits[dof_indices[0:3]] = 1.2
49-
accel_limits[dof_indices[3:6]] = 1.0
48+
accel_limits[dof_indices[0]] = 1.45
49+
accel_limits[dof_indices[1]] = 1.56
50+
accel_limits[dof_indices[2]] = 1.56
51+
accel_limits[dof_indices[3]] = 1.5
52+
accel_limits[dof_indices[4]] = 1.48
53+
accel_limits[dof_indices[5]] = 1.49
5054
robot.SetDOFAccelerationLimits(accel_limits)
5155

5256
# Load or_nlopt_ik as the IK solver. Unfortunately, IKFast doesn't work

src/prpy/base/robot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ def PostProcessPath(self, path, defer=False, executor=None,
215215
curve through the waypoints (not implemented). If this curve is
216216
not collision free, then we fall back on...
217217
4. By default, we run a smoother that jointly times and smooths the
218-
path via self.smoother. This algorithm can change the geometric path to
219-
optimize runtime.
218+
path via self.smoother. This algorithm can change the geometric path
219+
to optimize runtime.
220220
221221
The behavior in (2) and (3) can be forced by passing constrained=True
222222
or smooth=True. By default, the case is inferred by the tag(s) attached
@@ -421,8 +421,8 @@ def do_execute():
421421
else:
422422
raise ValueError('Received unexpected value "{:s}" for defer.'.format(str(defer)))
423423

424-
425-
def ExecuteTrajectory(self, traj, defer=False, timeout=None, period=0.01, **kwargs):
424+
def ExecuteTrajectory(self, traj, defer=False, timeout=None, period=0.01,
425+
**kwargs):
426426
""" Executes a time trajectory on the robot.
427427
428428
This function directly executes a timed OpenRAVE trajectory on the
@@ -460,7 +460,7 @@ def ExecuteTrajectory(self, traj, defer=False, timeout=None, period=0.01, **kwar
460460
# Check that the current configuration of the robot matches the
461461
# initial configuration specified by the trajectory.
462462
if not util.IsAtTrajectoryStart(self, traj):
463-
raise exceptions.TrajectoryAborted(
463+
raise exceptions.TrajectoryNotExecutable(
464464
'Trajectory started from different configuration than robot.')
465465

466466
# If there was only one waypoint, at this point we are done!

src/prpy/exceptions.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,50 @@ class PrPyException(Exception):
33
Generic PrPy exception.
44
"""
55

6-
class TrajectoryAborted(PrPyException):
6+
7+
class TrajectoryException(PrPyException):
8+
"""
9+
Trajectory failed to execute.
10+
"""
11+
12+
13+
class TrajectoryNotExecutable(TrajectoryException):
14+
"""
15+
Trajectory could not begin execution.
16+
17+
This exception typically indicates that some precondition of trajectory
18+
execution was violated, such as the robot starting at a different
19+
configuration, the trajectory not being in the correct format.
20+
21+
This exception indicates that the trajectory was not even attempted due to
22+
one of these conditions.
23+
"""
24+
25+
26+
class TrajectoryAborted(TrajectoryException):
727
"""
828
Trajectory was aborted.
929
"""
1030

11-
class TrajectoryStalled(PrPyException):
31+
32+
class TrajectoryStalled(TrajectoryException):
1233
"""
1334
Trajectory stalled.
1435
"""
1536

37+
1638
class SynchronizationException(PrPyException):
1739
"""
1840
Controller synchronization failed.
1941
"""
2042

43+
2144
class SerializationException(PrPyException):
2245
"""
2346
Serialization failed.
2447
"""
2548

49+
2650
class UnsupportedTypeSerializationException(SerializationException):
2751
"""
2852
Serialization failed due to an unknown type.
@@ -35,6 +59,7 @@ def __init__(self, value):
3559
'Serializing type "{:s}.{:s}" is not supported.'.format(
3660
self.type.__module__, self.type.__name__))
3761

62+
3863
class UnsupportedTypeDeserializationException(SerializationException):
3964
"""
4065
Deserialization failed due to an unknown type.

src/prpy/planning/base.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,44 @@
4141

4242
class Tags(object):
4343
SMOOTH = 'smooth'
44+
"""
45+
The `SMOOTH` tag means waypoints are close enough together that we can
46+
approximate derivatives at the waypoints using divided differences. i.e.
47+
we can safely fit a spline without collision checking.
48+
"""
49+
4450
CONSTRAINED = 'constrained'
51+
"""
52+
The `CONSTRAINED` tag means that the geometric path described by these
53+
waypoints respects a constraint. This means that the path cannot be
54+
geometrically altered arbitrarily, at the risk of violating the original
55+
constraint, it should only be changed in timing.
56+
"""
57+
4558
PLANNER = 'planner'
59+
"""
60+
The name of the planner used to generate a trajectory.
61+
"""
62+
4663
METHOD = 'planning_method'
64+
"""
65+
The type of planning call used to generate a trajectory.
66+
"""
67+
4768
PLAN_TIME = 'planning_time'
69+
"""
70+
The amount of time that was spent by a planner finding a solution.
71+
"""
72+
4873
POSTPROCESS_TIME = 'postprocess_time'
74+
"""
75+
The amount of time that was spent modifying the trajectory for execution.
76+
"""
77+
4978
EXECUTION_TIME = 'execution_time'
79+
"""
80+
The amount of time that was spent actually running a trajectory.
81+
"""
5082

5183

5284
class MetaPlanningError(PlanningError):

src/prpy/planning/chomp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def sync(self, robot):
7474
# existing distance field if there is a key mismatch.
7575
cached_state = self.cache.get(body.GetName(), None)
7676
if cached_state is not None and cached_state != current_state:
77-
logger.debug('Clearing distance field for "{:s}".', body_name)
77+
logger.debug('Clearing distance field for "%s".', body_name)
7878
self.module.removefield(body)
7979
cached_state = None
8080

src/prpy/planning/snap.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,17 @@ def _Snap(self, robot, goal, **kw_args):
118118
if check != 0:
119119
raise PlanningError('Straight line trajectory is not valid.')
120120

121-
# Create a trajectory that starts at our current configuration.
122-
cspec = robot.GetActiveConfigurationSpecification()
121+
# Create a two-point trajectory that starts at our current
122+
# configuration and takes us to the goal.
123123
traj = openravepy.RaveCreateTrajectory(self.env, '')
124-
traj.Init(cspec)
124+
cspec = robot.GetActiveConfigurationSpecification('linear')
125+
active_indices = robot.GetActiveDOFIndices()
125126

126127
start_waypoint = numpy.zeros(cspec.GetDOF())
127128
cspec.InsertJointValues(start_waypoint, start, robot,
128129
active_indices, False)
130+
131+
traj.Init(cspec)
129132
traj.Insert(0, start_waypoint.ravel())
130133

131134
# Make the trajectory end at the goal configuration, as long as it

src/prpy/planning/vectorfield.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,5 +360,12 @@ def fn_callback(t, q):
360360
output_path.Insert(output_path.GetNumWaypoints(),
361361
path.Sample(t_cache), cspec)
362362

363+
# Flag this trajectory as constrained.
364+
util.SetTrajectoryTags(
365+
output_path, {
366+
Tags.CONSTRAINED: 'true',
367+
Tags.SMOOTH: 'true'
368+
}, append=True
369+
)
363370
return output_path
364371

src/prpy/planning/workspace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def PlanWorkspacePath(self, robot, traj, timelimit=5.0,
162162

163163
# Create a new trajectory starting at current robot location.
164164
qtraj = openravepy.RaveCreateTrajectory(self.env, '')
165-
qtraj.Init(manip.GetArmConfigurationSpecification())
165+
qtraj.Init(manip.GetArmConfigurationSpecification('linear'))
166166
qtraj.Insert(0, robot.GetActiveDOFValues())
167167

168168
# Initial search for workspace path timing: one huge step.

0 commit comments

Comments
 (0)