HandController
The Hand Controller module contains logic for controlling hands during
simulation. Since Klamp’t does is not natively able to simulate tendon-based
finger movement, the Hand Controller simulates tendons by using multiple
revolute joints. The controller calculates how much torque should be applied at
each joint using a tendon-based model.
-
class HandController.HandController(hand, controllerType='underActuated')
The HandController class takes the Design.Hand instance,
computes the output torque based on the setting of the hand control DOF
parameters, and stores the dependency between DOFs and corresponding
transmission radius and stiffness.
All joints have 0-90deg joint range, with hardstop stiffness of o.2Nm/deg by
default. For rotary/tilted finger, don’t forget to set the base joints to
have the right joint position limits.
Parameters: |
- hand (Design.Hand) – The Design.Hand to control.
- controllerType (str) – The type of finger actuation. Currently only
supports 'underActuated'.
|
-
setHand(hand)
-
-
setControllerType(controllerType)
Parameters: | controllerType (str) – The type of finger actuation. Currently only
supports 'underActuated'. |
-
defineActiveDof(activeDofIndexPair, slaveDofIndexPairList)
Set the DOFs for a finger. The active DOF is the main DOF that controls
the slaves.
An index pair for the input should be in the format (fingerIndex,
jointIndex). Indices are zero-based, and an index of -1 represents the
rotary base joint of a finger. All of the DOF data will be stored in a
dictionary as (activeDofIndexPair: passiveDofIndexPairList).
Parameters: |
- activeDofIndexPair (list[int]) – The index pair of the controllable
DOF. The index pair can be used to query DOF index with
Design.Hand.getControllableDofIndex().
- slaveDofIndexList (list[list[int]]) – The list of passive DOF index pairs.
|
-
setDofTranRadius(dofIndexPair, tranRadius)
Parameters: |
- dofIndexPair (list[int]) – The index pair of the DOF to set the
transmission radius of.
- tranRadius (float) – The transmission radius in meters.
|
-
getDofTranRadius(dofIndexPair)
Parameters: | dofIndexPair (list[int]) – The index pair of the DOF to get the
transmission radius of. |
Returns: | The transmission radius of the DOF. |
Return type: | float |
-
setDofStiffness(dofIndexPair, stiffness)
Parameters: |
- dofIndexPair (list[int]) – The index pair of the DOF to set the
stiffness of.
- stiffness (int) – The stiffness of the DOF in Nm/deg.
|
-
setDofPreloadTorque(dofIndexPair, preloadTorque)
Set the preload torque of a DOF. Note that positive values will have a
direction opposing the positive torque direction.
Parameters: |
- dofIndexPair (list[int]) – The index pair of the DOF to set the
preload torque of.
- preloadTorque (float) – The torque of the preload spring in Nm.
|
-
setDofNeutralPos(dofIndexPair, neutralPos)
Parameters: |
- dofIndexPair (list[int]) – The index pair of the DOF to set the
neutral position of.
- neutralPos (int) – The neutral position of the spring in degrees.
|
-
setDofPosLimit(dofIndexPair, lowerLimit, upperLimit, hardStopStiffness)
Set the hard stop limit and stiffness of given DOF.
Parameters: |
- dofIndexPair (list[int]) – The index pair of the DOF to set the
position limit of.
- lowerLimit (int) – The minimum position in degrees.
- upperLimit (int) – The maximum position in degrees.
- hardStopStiffness (int) – The stiffness at the positional limits in
Nm/deg.
|
-
definePassiveDof(passiveDofIndexPair)
Define a passive DOF that is excluded from all actuation chain.
Parameters: | passiveDofIndexPair (list[int]) – Index pair for the passive DOF. |
-
updatePosSensorData(posSensorData)
Updates the known positions of the DOFs with the measured positions
from the Klamp’t simulation.
Parameters: | posSensorData (list[float]) – A list of all of the positions of the
DOFs in radians. |
-
updateVelSensorData(velSensorData)
Updates the known velocities of the DOFs with the measured velocities
from the Klamp’t simulation.
Parameters: | velSensorData (list[float]) – A list of the velocities of the DOFs
in radians/second. |
-
setDofTorque(indexPair, torque)
Set the torque of a specific DOF.
Parameters: |
- indexPair (list[int]) – The index pair of the DOF to set the
torque of.
- torque (int) – The torque of the DOF in radians/second2.
|
-
getTendonPos(activeDofIndexPair)
Query the tendon length position along an actuation chain with respect
to the active DOF. The positive direction is same as the direction of
the finger joint (it increases when finger closes).
Parameters: | activeDofIndexPair (list[int]) – The index pair of the active DOF to
get the tendon position of. |
Returns: | The tendon position in meters. |
Return type: | float |
-
getDofPos(dofIndexPair)
Parameters: | dofIndexPair (list[int]) – The index pair of the DOF to get the
position of. |
Returns: | The position of the given DOF in degrees. |
Return type: | int |
-
computeTorque()
Computes the torque for each DOF based on the current tendon position.
Returns: | A list of torques for all controllable DOFs (in Nm). Use with the
Klamp’t torque command to control the hand. |
Return type: | list[float] |