Skip to content

Commit 8b69fe2

Browse files
author
Michael Koval
committed
Merge remote-tracking branch 'origin/master' into bugfix/172
2 parents 3c35736 + 40ac3d5 commit 8b69fe2

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/prpy/base/wam.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2929
# POSSIBILITY OF SUCH DAMAGE.
3030

31+
import logging
3132
import numpy
3233
import openravepy
3334
import warnings
@@ -36,6 +37,8 @@
3637
from .. import util
3738
from .. import exceptions
3839

40+
logger = logging.getLogger('wam')
41+
3942
class WAM(Manipulator):
4043
def __init__(self, sim, owd_namespace,
4144
iktype=openravepy.IkParameterization.Type.Transform6D):
@@ -219,13 +222,14 @@ def ClearTrajectoryStatus(manipulator):
219222
if not manipulator.simulated:
220223
manipulator.controller.SendCommand('ClearStatus')
221224

222-
def MoveUntilTouch(manipulator, direction, distance, max_distance=float('+inf'),
225+
def MoveUntilTouch(manipulator, direction, distance, max_distance=None,
223226
max_force=5.0, max_torque=None, ignore_collisions=None, **kw_args):
224227
"""Execute a straight move-until-touch action.
225228
This action stops when a sufficient force is is felt or the manipulator
226229
moves the maximum distance. The motion is considered successful if the
227230
end-effector moves at least distance. In simulation, a move-until-touch
228231
action proceeds until the end-effector collids with the environment.
232+
229233
@param direction unit vector for the direction of motion in the world frame
230234
@param distance minimum distance in meters
231235
@param max_distance maximum distance in meters
@@ -235,6 +239,14 @@ def MoveUntilTouch(manipulator, direction, distance, max_distance=float('+inf'),
235239
@param **kw_args planner parameters
236240
@return felt_force flag indicating whether we felt a force.
237241
"""
242+
243+
if max_distance is None:
244+
max_distance = 1.
245+
warnings.warn(
246+
'MoveUntilTouch now requires the "max_distance" argument.'
247+
' This will be an error in the future.',
248+
DeprecationWarning)
249+
238250
# TODO: Is ignore_collisions a list of names or KinBody pointers?
239251
if max_torque is None:
240252
max_torque = numpy.array([100.0, 100.0, 100.0 ])

src/prpy/logger.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2929
# POSSIBILITY OF SUCH DAMAGE.
3030

31-
import collections, logging, sys
31+
import collections, logging, sys, warnings
3232

3333
class ColoredFormatter(logging.Formatter):
3434
def __init__(self, default):
@@ -80,6 +80,9 @@ def initialize_logging():
8080
spammy_logger = logging.getLogger(spammy_logger_name)
8181
spammy_logger.setLevel(logging.WARNING)
8282

83+
# Enable deprecation warnings, which are off by default in Python 2.7.
84+
warnings.simplefilter('default')
85+
8386
return base_logger
8487

8588
def remove_ros_logger():

src/prpy/planning/workspace.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ def PlanToEndEffectorOffset(self, robot, direction, distance,
105105
raise ValueError('Direction must be non-zero')
106106
elif max_distance is not None and max_distance < distance:
107107
raise ValueError('Max distance is less than minimum distance.')
108+
elif max_distance is not None and not numpy.isfinite(max_distance):
109+
raise ValueError('Max distance must be finite.')
108110

109111
# Normalize the direction vector.
110112
direction = numpy.array(direction, dtype='float')
@@ -224,7 +226,7 @@ def PlanWorkspacePath(self, robot, traj, timelimit=5.0,
224226
# Otherwise we'll gracefully terminate.
225227
else:
226228
logger.warning('Terminated early at time %f < %f: %s',
227-
t, traj.GetDuration(), e.message)
229+
t, traj.GetDuration(), str(e))
228230

229231
# Return as much of the trajectory as we have solved.
230232
SetTrajectoryTags(qtraj, {Tags.CONSTRAINED: True}, append=True)

0 commit comments

Comments
 (0)