Step 4: Control of the fingertip position

You can download the file associated with this step at:
http://sofamacbuilder.lille.inria.fr/defrost/scenes/Tutorial/step4-EnablingDirectManipulationOfTheFingertipPosition/Finger.py

In the previous steps, we showed how to model and simulate a soft robot with the example of the soft finger, made of a deformable material (silicone). We also explained how to add a cable to this model to actuate it and how to add an interactive script to simulate pulling of this cable. The same kind of method could be used to simulate pneumatic actuation (see the examples). This approach simulates a control in the actuator space. To change the fingertip position, one needs to pull the cable as a puppeteer.

In this step, we will see how to add a control of the effector. This is made possible through our approach published in [Duriez 2013] and [Largillière et al. 2015] by inverting the simulated model using an optimisation. With this approach, from the fingertip position, the inverse formulation computes how much the cable should be pulled to satisfy the target position.

 

 

To activate the inverse solver, you first need to replace the line:
 

 rootNode.createObject('GenericConstraintSolver', tolerance="1e-5", maxIterations="100")
 

with this one:
 

 rootNode.createObject('QPInverseProblemSolver')
 

To be able to manipulate the fingertip, you need to add two elements: one is the goal to be reached by the fingertip while the other is the element of the robot that should reach this target. Locate the end of the createScene() function. You can add a yellow sphere materializing the goal to reach by adding the following code:
 

     goal = rootNode.createChild('goal')

     goal.createObject('EulerImplicit', firstOrder='1')

     goal.createObject('CGLinearSolver', iterations='100', tolerance="1e-5",  threshold="1e-5")

     goal.createObject('MechanicalObject', name='goalMO',  position='-120  7.36479  7.14143')

     goal.createObject('Sphere', radius='5', group='3')

     goal.createObject('UncoupledConstraintCorrection')

Now, you can add an effector constraint that will connect the goal position to the mechanical model.

     effector = finger.createChild('effector')
     effector.createObject('MechanicalObject', name="effectorPoint", position=("-103.071  7.36479  7.14143"))                 

     effector.createObject('PositionEffector', template='Vec3d', indices="0", effectorGoal="@../../goal/goalMO.position")
     effector.createObject('BarycentricMapping', mapForces="false"mapMasses="false")