Skip to content

Commit 1291a7c

Browse files
author
Michael Koval
committed
Deprecate default max_distance in MoveUntilTouch.
1 parent 9f13277 commit 1291a7c

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/prpy/base/wam.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@
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
34+
import warnings
3335
from manipulator import Manipulator
3436
from prpy.clone import Clone
3537
from .. import util
3638
from .. import exceptions
3739

40+
logger = logging.getLogger('wam')
41+
3842
class WAM(Manipulator):
3943
def __init__(self, sim, owd_namespace,
4044
iktype=openravepy.IkParameterization.Type.Transform6D):
@@ -242,19 +246,14 @@ def ClearTrajectoryStatus(manipulator):
242246
if not manipulator.simulated:
243247
manipulator.controller.SendCommand('ClearStatus')
244248

245-
def MoveUntilTouch(manipulator, direction, distance, max_distance=2.,
249+
def MoveUntilTouch(manipulator, direction, distance, max_distance=None,
246250
max_force=5.0, max_torque=None, ignore_collisions=None, **kw_args):
247251
"""Execute a straight move-until-touch action.
248252
This action stops when a sufficient force is is felt or the manipulator
249253
moves the maximum distance. The motion is considered successful if the
250254
end-effector moves at least distance. In simulation, a move-until-touch
251255
action proceeds until the end-effector collids with the environment.
252256
253-
The maximum distance defaults to a value that is higher than the size
254-
of the reachable workspace of the WAM, which is roughly a sphere with a
255-
radius of one meter. This means that, by default, the arm will move as
256-
far as possible while obeying the straight-line constraint.
257-
258257
@param direction unit vector for the direction of motion in the world frame
259258
@param distance minimum distance in meters
260259
@param max_distance maximum distance in meters
@@ -265,6 +264,13 @@ def MoveUntilTouch(manipulator, direction, distance, max_distance=2.,
265264
@return felt_force flag indicating whether we felt a force.
266265
"""
267266

267+
if max_distance is None:
268+
max_distance = 1.
269+
warnings.warn(
270+
'MoveUntilTouch now requires the "max_distance" argument.'
271+
' This will be an error in the future.',
272+
DeprecationWarning)
273+
268274
# TODO: Is ignore_collisions a list of names or KinBody pointers?
269275
if max_torque is None:
270276
max_torque = numpy.array([100.0, 100.0, 100.0 ])

0 commit comments

Comments
 (0)