Skip to content

Commit 926ed08

Browse files
committed
fixed mistake in previous commit
1 parent 6fdae07 commit 926ed08

File tree

1 file changed

+0
-131
lines changed

1 file changed

+0
-131
lines changed

src/prpy/base/micohand.py

Lines changed: 0 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -34,131 +34,6 @@
3434
from ..exceptions import PrPyException
3535
from endeffector import EndEffector
3636

37-
class MicoHand(EndEffector):
38-
def __init__(self, sim, manipulator):
39-
EndEffector.__init__(self, manipulator)
40-
41-
robot = manipulator.GetRobot()
42-
env = robot.GetEnv()
43-
44-
self.simulated = sim
45-
46-
with env:
47-
accel_limits = robot.GetDOFAccelerationLimits()
48-
accel_limits[self.GetIndices()] = 1.
49-
robot.SetDOFAccelerationLimits(accel_limits)
50-
51-
if sim:
52-
robot = manipulator.GetRobot()
53-
self.controller = robot.AttachController(
54-
self.GetName(), '', self.GetIndices(), 0, True)
55-
56-
def CloneBindings(self, parent):
57-
super(MicoHand, self).CloneBindings(parent)
58-
59-
self.simulated = True
60-
61-
def MoveHand(self, f1, f2, timeout=None):
62-
"""
63-
Change the hand preshape. This function blocks until trajectory
64-
execution finishes. This can be changed by changing the timeout
65-
parameter to a maximum number of seconds. Pass zero to return
66-
instantantly.
67-
68-
@param f1 finger 1 angle
69-
@param f2 finger 2 angle
70-
@param timeout blocking execution timeout
71-
"""
72-
73-
from openravepy import PlannerStatus
74-
75-
robot = self.GetParent()
76-
77-
with robot.GetEnv():
78-
sp = openravepy.Robot.SaveParameters
79-
with robot.CreateRobotStateSaver(sp.ActiveDOF):
80-
robot.SetActiveDOFs(self.GetIndices())
81-
cspec = robot.GetActiveConfigurationSpecification('linear')
82-
current_preshape = robot.GetActiveDOFValues()
83-
84-
# Default any None's to the current DOF values.
85-
desired_preshape = current_preshape.copy()
86-
if f1 is not None: desired_preshape[0] = f1
87-
if f2 is not None: desired_preshape[1] = f2
88-
89-
# Create a two waypoint trajectory to the target configuration.
90-
traj = openravepy.RaveCreateTrajectory(robot.GetEnv(), '')
91-
traj.Init(cspec)
92-
traj.Insert(0, current_preshape)
93-
traj.Insert(1, desired_preshape)
94-
95-
# Time the trajectory so we can execute it.
96-
result = openravepy.planningutils.RetimeTrajectory(
97-
traj, False, 1., 1., 'LinearTrajectoryRetimer')
98-
99-
if result not in [ PlannerStatus.HasSolution,
100-
PlannerStatus.InterruptedWithSolution ]:
101-
raise PrPyException('Failed timing finger trajectory.')
102-
103-
# Execute the trajectory.
104-
return robot.ExecuteTrajectory(traj)
105-
106-
def OpenHand(self, value=0., timeout=None):
107-
"""
108-
Open the hand.
109-
@param timeout blocking execution timeout
110-
"""
111-
if self.simulated:
112-
robot = self.manipulator.GetRobot()
113-
p = openravepy.KinBody.SaveParameters
114-
115-
with robot.CreateRobotStateSaver(p.ActiveDOF | p.ActiveManipulator):
116-
self.manipulator.SetActive()
117-
robot.task_manipulation.ReleaseFingers()
118-
119-
if timeout:
120-
robot.WaitForController(timeout)
121-
122-
return None
123-
else:
124-
return self.MoveHand(f1=value, f2=value, timeout=timeout)
125-
126-
#!/usr/bin/env python
127-
128-
# Copyright (c) 2014, Carnegie Mellon University
129-
# All rights reserved.
130-
# Authors: Tekin Mericli <tekin@cmu.edu>
131-
#
132-
# Redistribution and use in source and binary forms, with or without
133-
# modification, are permitted provided that the following conditions are met:
134-
#
135-
# - Redistributions of source code must retain the above copyright notice, this
136-
# list of conditions and the following disclaimer.
137-
# - Redistributions in binary form must reproduce the above copyright notice,
138-
# this list of conditions and the following disclaimer in the documentation
139-
# and/or other materials provided with the distribution.
140-
# - Neither the name of Carnegie Mellon University nor the names of its
141-
# contributors may be used to endorse or promote products derived from this
142-
# software without specific prior written permission.
143-
#
144-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
145-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
146-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
147-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
148-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
149-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
150-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
151-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
152-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
153-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
154-
# POSSIBILITY OF SUCH DAMAGE.
155-
156-
import numpy
157-
import openravepy
158-
from .. import util
159-
from ..exceptions import PrPyException
160-
from endeffector import EndEffector
161-
16237
class MicoHand(EndEffector):
16338
def __init__(self, sim, manipulator):
16439
EndEffector.__init__(self, manipulator)
@@ -259,9 +134,3 @@ def CloseHandTight(self, value=1.2, timeout=None):
259134
@param timeout blocking execution timeout
260135
"""
261136
return self.CloseHand(value=value, timeout=timeout)
262-
263-
def CloseHandTight(self, value=1.2, timeout=None):
264-
""" Close the hand tightly.
265-
@param timeout blocking execution timeout
266-
"""
267-
return self.CloseHand(value=value, timeout=timeout)

0 commit comments

Comments
 (0)