design optimization of robotic body extension with...

70
Prof. Dr. Fumiya Iida Bachelor-Thesis Supervised by: Author: Prof. Dr. Fumiya Iida Giovanni Cavolina Liyu Wang Design Optimization of Robotic Body Extension with Passive Grippers Spring Term 2013

Upload: trinhphuc

Post on 02-Feb-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Prof. Dr. Fumiya Iida

Bachelor-Thesis

Supervised by: Author:Prof. Dr. Fumiya Iida Giovanni CavolinaLiyu Wang

Design Optimization ofRobotic Body Extensionwith Passive Grippers

Spring Term 2013

Page 2: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic
Page 3: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Contents

Abstract iii

Symbols v

1 Introduction 1

2 2D Model of a Compliant Gripper 32.1 Previous Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Generalization of the Model . . . . . . . . . . . . . . . . . . . . . . . 42.3 Object Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.3.1 Force Calculation . . . . . . . . . . . . . . . . . . . . . . . . . 52.3.2 Force Closure Analysis . . . . . . . . . . . . . . . . . . . . . . 62.3.3 The Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 Design Optimization 113.1 Optimization Problem . . . . . . . . . . . . . . . . . . . . . . . . . . 113.2 The Genetic Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.2.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.2.2 Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.2.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3 Selection of Genetic Algorithm . . . . . . . . . . . . . . . . . . . . . 193.3.1 With non-realistic Value of Parameters . . . . . . . . . . . . 193.3.2 With realistic Value of Parameters . . . . . . . . . . . . . . . 19

4 Experiment and Results 234.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.2 Model Compensation . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.3 Optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

4.3.1 Cylindrical Case . . . . . . . . . . . . . . . . . . . . . . . . . 284.3.2 Triangular Prism Case . . . . . . . . . . . . . . . . . . . . . . 284.3.3 Box Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304.3.4 Optimization Abstract . . . . . . . . . . . . . . . . . . . . . . 31

4.4 Building Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.4.1 Cylindrical Case . . . . . . . . . . . . . . . . . . . . . . . . . 334.4.2 Triangular Prism Case . . . . . . . . . . . . . . . . . . . . . . 34

4.5 Pick Up Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344.5.1 Cylindrical Case . . . . . . . . . . . . . . . . . . . . . . . . . 344.5.2 Triangular Prism Case . . . . . . . . . . . . . . . . . . . . . . 34

5 Conclusion and Future Work 37

Bibliography 39

i

Page 4: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

A MATLAB Code 40A.1 Genetic Algorithm Global Optimization Toolbox . . . . . . . . . . . 40

A.1.1 Cylindrical Case . . . . . . . . . . . . . . . . . . . . . . . . . 40A.1.2 Triangular Case . . . . . . . . . . . . . . . . . . . . . . . . . . 41A.1.3 Box Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

A.2 Real Coded Genetic Algorithm . . . . . . . . . . . . . . . . . . . . . 43A.3 Fitness Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

A.3.1 Cylindrical Case . . . . . . . . . . . . . . . . . . . . . . . . . 47A.3.2 Triangular Case . . . . . . . . . . . . . . . . . . . . . . . . . . 51A.3.3 Box Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54A.3.4 Implementation of a Timer . . . . . . . . . . . . . . . . . . . 58

ii

Page 5: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Abstract

The main purpose of this thesis is the design optimization of passive grippers inrobotic body extension, which then are formed on-the-fly and are able to lift a de-tected object at first attempt. The object shapes are restricted to a box, triangularprism and a sphere and can vary in their dimension. The grippers are made ofHot Melt Adhesive (HMA) and are formed by a multi degree of freedom robot armconsisting of a fully automated glue supply mechanism.Design Optimization is realized using evolutionary algorithm in MATLAB. For realworld simulation a lumped-parameter, 2D model in MATLAB SimMechanics is uti-lized.The application of such a model in MATLAB works but carries with it high com-puting effort.

iii

Page 6: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

iv

Page 7: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Symbols

Symbols

Indices

x x axis

y y axis

Acronyms and Abbreviations

ETH Eidgenoessische Technische Hochschule

GBE generalized beam element

CS coordinate system

GA genetic algorithm

RBE robotic body extension

HMA hot melt adhesive

v

Page 8: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

vi

Page 9: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 1

Introduction

There are big differences in the capabilities of biological systems and robots. Oneof the principle challenges resides in the animals’ adaptability and intelligence. An-imals estimate the situation and act choosing the adequate behaviour. Most of therobots existing so far don’t possess such a body extension ability. They are config-ured for one task which they repeat.

The capability of extending body structures is one of the most significant chal-lenges in the robotics research [1]. In this project the RBE is applied on a pick upprocess. In industry there are numerous robots that automate the pick and placeprocess using effective gripper mechanism. Their consistency, quality and repeata-bility is unmatched [2]. But only for specific objects to lift.

The robot in this thesis is supposed to face objects previously unknown in dimen-sion, geometry and weight. For a robot facing unanticipated objects new grippersneed to be formed and only passive grippers can be formed. Employing HMAs inthis field represents a novel approach to RBE. Because of its thermo-plastic andthermo-adhesive characteristics, this material can be used for additive fabricationbased on a simple robotic manipulator while the established structures can be inte-grated into the robot’s own body to accomplish a task which could not have beenachieved otherwise [1].

To determine the optimal gripper shape for a certain object design optimizationis used. The robot autonomously changes its shape building and attaching to itselfa gripper for any new object. Each gripper represents a solution to the optimizationproblem. Hence, the pick up task is solved by building.

1

Page 10: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 1. Introduction 2

Page 11: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 2

2D Model of a CompliantGripper

In this chapter the model of the HMA gripper and its generalization are presented.

2.1 Previous Model

In the beginning of my thesis, a model of the gripper already existed. Remo Bernetbuilt it in a previous project [3]. In Figure 2.1 the dimensions of the modelledgripper are represented. The gripper is symmetrical and divided into five parts:there is a horizontal beam on the top, two vertical beams and two tips.

Figure 2.1: Dimensions of the previous gripper model.

The mechanical model is based on the lumped-parameter method, i.e. the gripper’sflexible body is approximated as a set of rigid bodies coupled with springs anddampers.

3

Page 12: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 2. 2D Model of a Compliant Gripper 4

Figure 2.2: Left: visualization in SimMechanics. Right: equivalent mechanicalmodel.

As shown in the left image of Figure 2.2 the gripper consists of totally 63 generalizedbeam elements (GBEs). Each GBE is cuboid-shaped and determined by its massm and its lengths l, w and h. The top beam is discretized in 11 identical GBEs ofmass m1, length l1 and moment of inertia J1, which is calculated by the formulafor a cuboid-shaped object. The GBE in the middle of the top beam is connectedto the environment - in my case to the robot that picks up the object. For thediscretization of the two vertical beams 25 identical GBEs with mass m2, length l2and moment of inertia J2 are used. The tips are assumed as one rigid body of massmt and moment of inertia Jt. Their geometry can be seen in Figure 2.2.

2.2 Generalization of the Model

The model presented above exists only in one shape and is not parameterized. Thegoal of this thesis is to optimize, i.e. to vary the gripper’s dimensions until anadequate shape to lift an object is found. In this section the generalization of thegripper model is illustrated.

The geometrical composition of the gripper remains the same. There is a topbeam, two symmetrical vertical beams and two symmetrical tips. Having two rigidtips which in the SimMechanics model are represented only by one body element,predetermines the gripper’s geometry. I want the optimization to have as manydegrees of freedom as possible. The rigid tip is replaced by a flexible one consistingof three bodies, which are coupled with springs and dampers (See Fig. 2.3). Eachof these tip GBEs is determined by its mass m3, length l3 and moment of inertia J3.

Page 13: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

5 2.3. Object Interaction

Figure 2.3: The generalized gripper

The number of elements in the top beam remains the same. In the vertical beamthe number of GBEs is reduced to 20 elements each. The generalized model consistsof 57 GBEs totally (Fig. 2.3).In order to achieve more different gripper shapes, two angles alpha and beta areinserted: alpha for the rotation of the two vertical beams about the z-axis and betafor the tip rotation, also about the z-axis. Finally there is a set of eight differentparameters l1, w1, l2, w2, l3, w3, alpha, beta that are used to change and optimizethe gripper’s geometry.

2.3 Object Interaction

Object interaction is an important part-whether it is for the model and the simula-tion of the pick up process or for the optimization task. In this section of the modelthe forces between the object to lift and the gripper are calculated.

2.3.1 Force Calculation

The calculation is based on a soft contact model where the normal force Fn ismodelled by a linear spring-damper system. The shape of the body to pick up isdetermined by an object contour function1. The contour of the gripper’s tips issampled into points, which are assigned to a coordinate system each(See Fig. 2.4).

The gripper’s flexible tips dispose of 32 force contact points. Each of their local co-ordinate system is tangential to the gripper’s contour in its y direction and normalto the surface in its x direction.

1This is only a 2D Model.

Page 14: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 2. 2D Model of a Compliant Gripper 6

Figure 2.4: Sampling Points

If one of these tip points penetrates the object’s area, the penetration depth iscalculated. Proportional to the latter the model determines the contact forces, i.e.the normal and tangential force. The greater the virtual penetration in the object tolift, the greater are the reaction forces. Using a body actuator, the appropriate forceand with it the correspondent displacement on the gripper’s element are applied.The normal force acts in x direction of the accordant coordinate system of thepenetrating point. The tangential, i.e. the frictional force acts collinearly to theaccordant y axis (See Fig. 2.5). This force interaction part described above wasalready implemented in Remo Bernet’s model [3].

2.3.2 Force Closure Analysis

Force interaction is crucial in this project. Depending on the applied forces to theobject, we can determine whether the gripper is able to lift the correspondent objector not. The previous model does not consider this part.

Figure 2.5: Force Closure

The gravitational acceleration is defined in negative y-direction of the World CS.Generally, the coordinate system of the penetrating contact point isn’t collinear tothe World CS. Between the two CSs there is a rotational angle gamma about thez-axis of the World CS. To decide whether the force closure is sufficient to lift the

Page 15: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

7 2.3. Object Interaction

object or not, projection of the interaction forces in the gravitational force directionis indispensible.Picking up is only possible if the sum of all the reaction forces’ projections inthe world y direction helping the lifting process are equal or greater than the ob-ject’s weight force. In order to project the reaction forces in x and y of the worldcoordinate system, a body sensor in SimMechanics is applied on each coordinate

system. Therewith the rotational matrix

(cos(gamma) sin(gamma)sin(gamma) cos(gamma)

)of each con-

tact point respective to the world coordinate is returned. After having calculatedthe orientation angle gamma out of it, every contact point’s reaction force pair canbe projected in the world y direction. Projections that help to lift the desired objecthave the opposite direction of the gravitation. This distinction becomes importantif we want to lift a cylinder. In Fig. 2.5 the interaction points are placed on theupper side of the cylinder. The normal forces’ projections in y have the same di-rection as the gravitation and counteract the lifting process. On the contrary ifthe gripper touches the cylinder in the nether position as in Fig. 2.6, the pick upprocess is supported by the normal forces.

Figure 2.6: Force Closure Cylindrical Case

2.3.3 The Simulation

To be able to optimize the gripper’s shape, we need to simulate and evaluate thereal case. In this section the simulation of the pick up process is presented. Everydeliverable as time and computing effort are based on the execution on a Windows7 computer disposing of quad core @ 2.66GhZ each.The simulation time is around T=5.

Figure 2.7: Simulation Process

The gripper was modelled in SimMechanics, it is also simulated in this environment.At this point is mentioned that there are three gripper models that I use in myproject: one for the case where the object to lift is a box, a sphere or a triangular

Page 16: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 2. 2D Model of a Compliant Gripper 8

prism. The gripper model is identical in each case. Only the object contours andwith them the force interaction change. If no specific model is mentioned, the dataand information delivered in this thesis are valid for the three model cases. Thegripper’s middle GBE of the top beam is actuated and with it the whole grippertranslates in negative world y direction for a distance C=y1-y0 (Fig. 2.7). Thisdistance is determined by v=C/T and can be varied changing the simulation timeT and the translation velocity v in the model parameters.Relating to Fig. 2.7 once the gripper encloses the object to pick up, the forceinteraction is initiated. After having reached the lowest vertical position (section din Fig. 2.7), the reaction forces between gripper and object need to be calculated.Only this final gripper position is needed to predict whether the lifting process ispossible or not. The simulation of the lifting process itself is not necessary.To be able to read and project the reaction forces in the world y direction, I outputeach force interaction of each contact point. This can be realized either by a ToWorkspace or by a To File block. In this project the To File blocks are used.Using the To Workspace block the latter one writes data, i.e. the interaction forces,in an internal buffer during the simulation. Not until the simulation is completedor paused the block writes the data to the MATLAB Workspace. If the simulationcrashes, i.e. does not stop properly all data are lost. The To File block is moreadvantageous. It writes and saves the data input incrementally to a MAT-file, withminimal memory overhead during simulation. In this manner if the simulation orMATLAB crashes, the data is still saved in the correspondent files.

Simulation Performance

As the reader will learn in chapter 3, the simulation is often used for evaluation in theoptimization task. Hence, the simulation’s computing effort should be minimized.At the same time the model should be as accurate and exact as possible. Real worldbehaviour shouldn’t be lost. The performance of the simulation depends on variousfactors. The most important are:

1. Number of GBEs

2. Number of sampling points

3. GBEs as point masses or with non-zero inertia

4. Friction

I started with a model consisting of 57 GBEs, 64 sampling points. With a realisticfriction coefficient of mu = 0.5 the simulation gets stuck. Probably it’s due tothe high computing effort caused by the high number of interaction blocks in themodel. In every time step of the simulation 64 force interactions and correspondentdeflections have to be calculated. With the friction switched off, the simulationruns without getting stuck. The end of the simulation could not be achieved afterhalf a day.

Reducing the sampling points to a number of 16 works for some gripper geome-tries, but for others gets stuck. This result isn’t reliable enough espacially if itshould be appliable for random geometries.

Reducing the number of GBEs changes little in the performance. An acceptableand still accurate minimum was found at totally 21; 5 elements form the upperbeam, 5 GBEs in each vertical beam and 3 elements for each tip. The simulationwall time can vary from minutes for low force interaction to hours or getting stuckfor unadequate geometries.

Page 17: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

9 2.3. Object Interaction

Setting each GBEs inertia to zero, i.e. treat each GBE as point mass affects thesimulation’s performance a lot. Previous simulation’s wall times could be reducedto a half.

The simulation still isn’t free from getting stuck. The only and last reasonablesolution without changing the whole model approach is to switch off the frictionduring the whole simulation process and calculate the friction forces from the nor-mal forces in the lowest position. Indeed, for the pick up prediciton we only needthe forces in this position. That way the simulation is reliable changing grippergeometries and object dimensions. Until now it has never happened that the simu-lation got stuck.The simulation wall time in general could be reduced to minutes. Depending onthe geometries a simulation can take from few seconds to half an hour. For thischanging two assumptions have to be done:

1. The gripper opens and is able to enclose the object.

2. The final vertical position of the gripper with and without friction stays thesame (See Figure 2.8).

Page 18: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 2. 2D Model of a Compliant Gripper 10

Figure 2.8: Left: Simulation Process without friction, Right: Simulation Processwith friction

Box Case: If the enclosure process is executed in the box case, the simulationgets always stuck. This happens independently of the changes listed above andindependently of the box dimension. The simulation gets stuck as soon as thegripper’s tips reach the rounded edges (Fig. 2.9).

Figure 2.9: Simulation gets stuck in Box Case

Page 19: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 3

Design Optimization

The shape of the gripper, and hence the pick up behaviour depends on eight param-eters. In this chapter the geometry is optimized using an evolutionary algorithm.The optimization task represents the focus of this thesis.

3.1 Optimization Problem

The objective of the optimization is to find a set of parameters l1,w1,l2,w2,l3,w3,alpha and beta that enables the gripper to lift a desired object at first attempt. Theoptimization should desirably start with parameters that lead to a gripper whichalready interacts with the body we want to lift. Therefore initial parameters de-pending on the object dimensions are set. The optimization problem is describedas follows.

Objective function: The task of the objective function is to map how far agripper solution is from the goal of picking up an object at first attempt. For thispurpose the following function was chosen:

f(l1, w1, l2, w2, l3, w3, alpha, beta) = Fweight/Freactiony

Fweight describes the gravity force of the object we want to lift. Freactiony isthe resultant force of the interaction forces between gripper and object - projectedin y direction and supporting the lifting process, i.e. opposite to the gravitation.Referring to section 2.3 not every interaction point’s force on the gripper contouris projected in the y direction and included in the calculation of Freactiony.

Boundaries: The values for the eight parameters were restricted by lower andupper boundaries. The latter ones change from object to object. In the followingonly the case where the object to lift is a cylinder is described. The box and trian-gular prism boundaries can be found in the code in Appendix A.1.

11

Page 20: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 3. Design Optimization 12

Lower Bounds Upper Boundsl1 0.4 ∗Rcyl/nupper 3.3 ∗Rcyl/nupper

w1 2 5l2 (posground − C −Rcyl)/nvert (posground − C)/nvert

w2 2 5l3 3 15w3 2 5alpha 0 0beta 45 70

Every bound’s unit is mm. As can be depicted from Fig. 3.1 Rcyl is the radius ofthe cylinder, nupper describes the number of GBEs in the horizontal beam and isequal to 5. nvert is the number of GBEs in each vertical beam and also equal to5. C specifies the constant, vertical translational of the gripper in the simulationprocess (See Fig. 2.7). C = 30mm. posground = 90mm describes the distance ofthe initial vertical position of the point E (Fig. 3.1), i.e. the point in which thegripper is connected to the environment, to the ground. The goal of the boundsintrocuced a few lines ago is to bring the gripper’s shape near to the object thatchanges dimensions. Only grippers with a certain object interaction, i.e. a certaingeometrical composition that allows it, could be able to lift an object.

Figure 3.1: Gripper Environment Dimensions

Page 21: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

13 3.2. The Genetic Algorithm

3.2 The Genetic Algorithm

Genetic algorithms belong to the evolutionary algorithms and are often applied inthe field of artificial intelligence. The GA is a search heuristic that mimics thenatural evolution process.

3.2.1 Motivation

Genetic algorithms belong to the evolutionary algorithms and are often applied inthe field of artificial intelligence. The GA is a search heuristic that mimics thenatural evolution process. As organisms - which are excellent problem solvers -GAs are based on techniques such as selection, crossover and mutation and can beused as effective function optimizers.

3.2.2 Encoding

Beneath the choice of an adequate fitness function, the way in which candidatesolutions are encoded is a central factor in the success of the genetic algorithm.Binary, real-valued and tree encodings are common strategies. Binary encodings,i.e. bit strings are the most prevalent. Most of the existing GA theory is based onthem. The binary code uses the bit strings consisting of the two digits 0 and 1 torepresent numbers, i.e. genes of an individual. In recent years the application ofreal-coded GAs has increasingly replaced the binary systems. Real-coded GAs needreal values to build chromosomes. Several empirical comparisons between binaryand real-valued encodings have shown better performance for the latter [6]. Hence,the GAs used in this project will be based on a real-valued system.

3.2.3 Implementation

In the beginning a random initial population is created. A population consists ofseveral individuals. The latter ones - also called chromosomes - are a set of eightparameters which determine the gripper’s shape. Based on the fitness evaluationof each element, i.e. individual of the population, selection starts. Each of theseindividuals consists of genes. I use real-valued encoding: one gene corresponds toone geometrical parameter, e.g. the length l1 (See Fig. 3.2). The population sizevaries from 5 to 20 in this project.The algorithm then makes use of mutation and crossover over several different gen-erations until a minimum of the fitness function is reached.As the model and the simulation of the gripper, the genetic algorithm was imple-mented in MATLAB.

Page 22: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 3. Design Optimization 14

Figure 3.2: Population

To choose the best GA I made some quantitative assessments. I compared theperformance of a real-valued GA I implemented based on a template found on theInternet with the GA of the Global Optimization Toolbox. In the follwing only theimplementation of the Toolbox GA is presented. In section 3.3 the results of theassessments can be reviewed. The implementation of the GA found on the Internetis in the Appendix A.2.

Global Optimization Toolbox

Finally I have chosen the function ’ga’ from the MATLAB Optimization Toolbox:

[parameters, Fval, exitflag, output, population]=ga(@fitness cylrw pos, ...NumberOfVariables, [], [], [],[], lb, ub , [], options);

The main input of the function are the fitness function fitness cylrw pos, thenumber of parameters NumberOfV ariables = 8 and the lower and upper boundsdescribed in 3.1. The specified outputs are the final geometrical parameters, thefinal and minimum fitness value, the exitflag and the whole population of the lastgeneration, i.e. iteration.The options and initial values of the GA are set with ’options’ using the ’gaoptimset’function.

options = gaoptimset('Display', 'diagnose', 'PlotFcns', @gaplotbestf,...'PopInitRange',[0.2*R cyl cm/n upper, 2, ...1000*0.9*(pos ground−C−R cyl)/n vert, ...2, 3, 2, 0, 0; 3.2*R cyl cm/n upper, 5, ...1000*1*(pos ground−C)/n vert, 5, 15, ...5, 45, 70 ] ,'Generations',200,'EliteCount', 1,...'CrossoverFraction', 0.5, 'FitnessLimit', 0.7,...'PopulationSize', 10);

A brief discussion of the options defined in the ’ga’ function [5]:

• Display: The optimization is a time consuming process. The option ’Display’is set to ’diagnose’ to have more information after each generation.

• PlotFcns: With this option the functions that plot data computed by thealgorithm are handled. @gaplotbestf plots the best fitness over several gener-ations.

Page 23: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

15 3.2. The Genetic Algorithm

• PopInitRange: Here the range of the intitial, randomly generated popula-tion is set using the upper and lower bounds defined in the previous section.

• Generations: The maximum number of generations, i.e. iterations executedis equal to 200. Then, the algorithm halts.

• EliteCount: ’EliteCount’ is a positive integer specifying how many individu-als in the current generation are guaranteed to survive to the next generation.

• CrossoverFraction: This option defines the fraction of the population at thenext generation, not including elite children, that is created by the crossoverfunction.

• FitnessLimit: If this fitness value is reached, the optimization stops. Tohave a certain cushion, a value of 0.7 is chosen.

• PopulationSize: It has to be a positive integer which defines the size of thepopulation. In this optimization task the number is between 5 and 20.

Fitness Function

The defintion of an adequate fitness function is essential for a successful GA. Itis defined by the ratio between the weight force of the object we want to lift andthe sum of the reaction forces supporting the lifting process (See 3.1). If the fitnessvalue reaches a value lower than one the gripper is able to lift the object. Theoptimization is supposed to minimize the fitness function.

Optimization Process: The whole optimization process works like this: an initialpopulation in a defined range is generated. In the initial range I want to make surethe gripper is near enough to the object’s dimension. Otherwise there would betoo many grippers that won’t even touch or enclose the object to lift. Each set ofparameters is given to the simulation. At the lowest position the forces and withit the fitness value of the gripper is calculated. The genetic algorithm then createsnew generations consisting of better individuals using crossover and mutation. Thisloop is repeated until a minimum fitness value is reached.

Figure 3.3: Optimization Process

The fitness function imports a parameter set from the population generated by the’ga’. In the fitness function the enclosure process of a specfic gripper is simulated.

Page 24: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 3. Design Optimization 16

The parameters needed therefor have to be initialized. Each input parameter isallocated to a geometrical one.

function [fitness] = fitness cylrw(parameters)...l 1=parameters(1);w 1=parameters(2);l 2=parameters(3);w 2=parameters(4);l 3=parameters(5);w 3=parameters(6);alpha=parameters(7);beta=parameters(8);

Before the specific gripper is simulated the fitness function checks whether thegeometry is builable or not. A gripper that crosses its tips is not buildable (See Fig.3.4).

Figure 3.4: Gripper crossing tips

The parameters in the following tip crossing lines can be depicted from Figure 3.5.

%tip crossing testing mechanisma a=sin(alpha*pi/180)*n vert*l 2;c c=cos((beta−alpha)*pi/180)*n tip*l 3;b b=c c−a a;

if b b>=(n upper*l 1)/2disp('tip crossing')parameters;fitness=370;break

end

Page 25: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

17 3.2. The Genetic Algorithm

Figure 3.5: Gripper crossing tips

If tip crossing is diagnosed, the simulation doesn’t even start. The gripper is pun-ished by high fitness value of 370.The model is simulated using ’sim’. Then all the reaction forces of the 16 samplingpoints, their orientation relative to the World CS (angles) and their final positionare loaded. From all of this data only the information in the end, i.e. in the lowestvertical gripper position is used and needed for the pick up prediction.

%run simulation to get data needed to calculate fitness functionsim('Gripper cyl 2012a sat pos.mdl', 'SrcWorkspace', 'current');%current changes workspace to the current on of the function we are in

%%calculate forces in y−direction

%Get Data from simulationforce l1 = load('force l1.mat');force l2 = load('force l2.mat');...force r7 = load('force r7.mat');force r8 = load('force r8.mat');angle r1 = load('angle r1.mat');...angle l7 = load('angle l7.mat');angle l8 = load('angle l8.mat');pos r1 = load('pos r1.mat');pos r2 = load('pos r2.mat');...pos l8 = load('pos l8.mat');

pos last vertbeam r = load('pos last vertbeam r.mat');pos last vertbeam l = load('pos last vertbeam l.mat');pos tip l = load('pos tip l.mat');

Page 26: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 3. Design Optimization 18

pos tip r = load('pos tip r.mat');

On the basis of the position of each sampling point’s CS the force closure is deter-mined. If a sampling point lays in the nether half of the cylinder the normal forces(normal l1, .̇.) are included in the fitness calculation. Otherwise they remain asinitialized, i.e. equal to zero. Finally the fitness value is calculated.

normal r1=0;...normal l7=0;normal l8=0;

if pos r1.ans(3,end)<−abs(pos ground−R cyl)normal r1=abs(angle r1.ans(2,end)*force r1.ans(2,end));

end...if pos l8.ans(3,end)<−abs(pos ground−R cyl)

normal l8=abs(angle l8.ans(2,end)*force l8.ans(2,end));end

%Calculation fitness valueF reaction y=normal l1+abs(angle l1.ans(3,end)*mu*force l1.ans(2,end))+...

normal l2+abs(angle l2.ans(3,end)*mu*force l2.ans(2,end))+...normal l3+abs(angle l3.ans(3,end)*mu*force l3.ans(2,end))+...normal l4+abs(angle l4.ans(3,end)*mu*force l4.ans(2,end))+...normal l5+abs(angle l5.ans(3,end)*mu*force l5.ans(2,end))+...normal l6+abs(angle l6.ans(3,end)*mu*force l6.ans(2,end))+...normal l7+abs(angle l7.ans(3,end)*mu*force l7.ans(2,end))+...normal l8+abs(angle l8.ans(3,end)*mu*force l8.ans(2,end))+...normal r1+abs(angle r1.ans(3,end)*mu*force r1.ans(2,end))+...normal r2+abs(angle r2.ans(3,end)*mu*force r2.ans(2,end))+...normal r3+abs(angle r3.ans(3,end)*mu*force r3.ans(2,end))+...normal r4+abs(angle r4.ans(3,end)*mu*force r4.ans(2,end))+...normal r5+abs(angle r5.ans(3,end)*mu*force r5.ans(2,end))+...normal r6+abs(angle r6.ans(3,end)*mu*force r6.ans(2,end))+...normal r7+abs(angle r7.ans(3,end)*mu*force r7.ans(2,end))+...normal r8+abs(angle r8.ans(3,end)*mu*force r8.ans(2,end));

F weight=m cyl*9.81;fitness=abs(F weight/F reaction y);

In case that the gripper does not touch the object the fitness value would be infinite.This is a too high punishment. Punishing this case with a value of 40 yielded togood results.

if fitness==Infdisp('Gripper does not touch object!!')fitness=40;

end

Implementation of a Timer:

For the case that the fitness function shall punish also bad simulation performance,I implemented a timer.The fitness function isn’t very effective for the optimization task: A simulation thattakes long often yields to a high fitness value. Punishing these cases can discardgood solutions. The only advantage is that the optimization process cannot getstuck, even if a single simulation would. The code can is listed in Appendix A.3.4.

Page 27: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

19 3.3. Selection of Genetic Algorithm

3.3 Selection of Genetic Algorithm

3.3.1 With non-realistic Value of Parameters

In the beginning, optimizations in a non realistic scenario were executed. With a100 times lower weight and friction each simulation runs faster. It can be shownthat the optimization works.

Figure 3.6: Non Real Wolrd Optimization with a Cylindrical Object

This optimization in the cylindrical case was executed with a population size of 6.Figure 3.6 shows that the GA starts with a best fitness value of 12. In this case thegripper is not yet able to lift the correspondent object. After 14 generations theoptimization reaches a minimum fitness value of 0.457. The gripper would be ableto lift the object.

3.3.2 With realistic Value of Parameters

To decide which GA is the most adequate for this optimization task two real-valuedGAs based on a real world environment are compared to each other. In the following,a realistic friction of mu = 0.7 and a light mass of 3grams were used.

Self-Implemented GA

This GA is built-on Javad Ivakpour’s implementation [4]. It was modified changingthe lower, upper bounds, the crossover and mutation parameters. The code canbe found in Appendix A.2. Compared to every other GA in this project, this one

Page 28: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 3. Design Optimization 20

uses the inverted fitness function. To lift an object the optimization has to reachand exceed a value of one. Instead of minimizing, this GA maximizes the fitnessfunction.

Figure 3.7: Real World Optimization Cylindrical Case

The real-coded GA uses a population size of 10 and needs 19 generations to reacha fitness maximum of 0.076. The correspondent gripper would not be able to liftthe object.

Page 29: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

21 3.3. Selection of Genetic Algorithm

Global Optimization Toolbox

This optimization uses ten individuals per population and reaches a minimum fitnessvalue of 7.19 after 58 generations. In this example the gripper has a fitness valuehigher than one and hence is not able to lift the object.

Figure 3.8: Real World Optimization Cylindrical Case Using Toolbox

The ’ga’ of the Global Optimization Toolbox performs better than the self-implementedone. Both optimizations have an ellipsed time of few hours.In the following, the ’ga’ function from the toolbox is used for each optimizationtask.

Page 30: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 3. Design Optimization 22

Page 31: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 4

Experiment and Results

In this chapter theoretical as well as practical results are presented. Beneath theoptimization also the building and pick up process in real world are analysed.In addition, the integration in real world of the whole optimization task includingthe model and the lifting process are explained.

4.1 Experimental Setup

The experimental setup consists of a five axis robot arm with a glue supply mecha-nism (see Figure 4.1). The objects to be lifted should weigh from a minimum of onegram to a maximum of 10 grams. The friction coefficient is determined experimen-tally using the tilted plane method: A block of HMA is placed on the tilted plane.The angle of tilt is increased as long as the block begins to slide. The tangent ofthe tilting angle represents the friction coefficient.

Figure 4.1: Robot Arm

Box:

23

Page 32: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 4. Experiment and Results 24

A quadratic box of six grams with a friction coefficient of 0.68 is chosen. Theedge length is 2.8 cm.

Figure 4.2: Box

Cylinder:

Here a splicing tape roll with a diameter of 4.6 cm and a friction coefficient of0.73 is used. The roll weighs ten grams.

Figure 4.3: Box

Triangular Prism:

The object to lift is a self-made triangular prism made of carton. It weighs 5grams and is equal-sided with an angle of 45 degrees. The height corresponds to alength of 3.1 cm.

Page 33: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

25 4.1. Experimental Setup

Figure 4.4: Box

The triangular prism is covered by the same tape as the cylindrical object. Thatway a friction coefficient of 0.73 is guaranteed.

Page 34: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 4. Experiment and Results 26

4.2 Model Compensation

As the reader will learn in the next section, executing real world optimizationsrarely led to a minimum fitness value lower than ten. Even trying to minimize thefitness function manually, i.e. finding the best possible gripper shape intuitivelyand then building it by hand using a glue gun, led to no gripper that could lift thecertain object.On one hand this shows that the optimization task works well compared to thehuman one executed by me. On the other hand this means there is somethingwrong with the model used. The model uses a 2D gripper which consists of pointmasses. I’ve built a similar gripper in real world (Figure 4.5). How should such athin gripper consisting of one layer in the third dimension be able to lift an objectof 10 grams? After some attempts it became clear that this isn’t possible and thathence the fact that a fitness value lower than one couldn’t be reached realistic.

Figure 4.5: 2D Gripper Approximation in Real World

A relation between the 2D, point mass gripper of the simulation and a realistic,built 3D gripper had to be found.Adding layers in the third dimension as well as increasing the grippers thicknesshave impact on the gripper’s fitness function. Which gripper in the simulation withwhich fitness value is able to lift a certain object after being built in the real world?I started with a gripper shape with a fitness value of 20 and tried to push it toa fitness value lower than one in real world (Figure 4.6). Increasing the gripper’sthickness, varying building speed and temperature were some of the tools achievingit. The model and simulation in the cylindrical case were used to calculate thementioned values.

Page 35: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

27 4.2. Model Compensation

Figure 4.6: Minimizing Fitness Value in Building Process

In the end with an increased thickness and number of layers the gripper with theoriginal fitness value of 20 is not able to lift the correspondent object. After choosinggripper shapes with lower original fitness value and then again decreasing it usingreal world tools, I found that the shape of a 2D gripper with a fitness value of 16(Figure 4.6) is able to lift the correspondent object when built in real wolrd usingthe following parameters:

1. Building movement speed of robot = 0.5 mm/s

2. 10 layers in the third dimension

3. Building Temperature = 145 ◦C

The optimization remains the same. The 2D gripper model and simulation are usedas usual. Using the 3D model compensation described above the genetic algorithmhas to minimize the fitness value only until a value 16.

Why isn’t directly used a 3D model approach for the simulation?First, using this empirically determined compensation belongs to the modelling ofthe system but still avoids an elevated computing and time effort the detailed 3Dimplementaiton would cause.The second reason is that only a 2D model exsisted. The implementation of a 3Dmodel would go beyond the scope of this thesis.

Page 36: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 4. Experiment and Results 28

4.3 Optimizations

I executed a lot of optimizations in real world changing GA parameters as populationsize, crossover and mutation fraction. In this section only the latest, best real worldoptimizations are presented.

4.3.1 Cylindrical Case

In this optimization an ideal of a population size of 14, a crossover fraction of 0.4 andan elite count of one was found. In Figure 4.7 the optimization is visualized. Bluepoints represent the mean fitness value of all individuals in the certain generation.Black points show the gripper with the lowest, i.e. best fitness value.In the beginning the best individual has a fitness value of around 25. After 21generations the GA finds the minimum fitness of 15.37. Until generation number51 the GA minimizes the average of the whole generation consisting of 14 grippersto a value of 15.5. As no better fitness value was found, the GA is needed only untilgeneration 21. The ellapsed time to this generation is 15 hours.

Figure 4.7: Real World Optimization Cylinder

4.3.2 Triangular Prism Case

In comparison to the cylindrical case, the dimensions of a triangle impact more onthe geometry. While the circle has only its radius as degree of freedom the trianglecan change height and angles to achieve various geometries. The latter influence theforce interaction and hence the optimization. In this part optimizations of differenttriangular prism geometries - even if not fulfilling the pick up goal - are presented.Although there is only one prism in real world, I studied two others - with a 15 anda 30 degrees angle - only in the simulation.

Page 37: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

29 4.3. Optimizations

Triangluar Prism with 15 degree angle:

Figure 4.8: Real World Optimization Triangular Prism 15 degrees

The genetic algorithm uses a population of 16 individuals. After having randomlygenerated the initial population in a certain range a best fitness value of 90 is found.The GA’s elite number is set to two, the crossover fraction to 0.7.After 38 generations a minimum fitness value of 45.94 is reached. The gripper isnot able to lift the prism. The optimization wall time is 2 hours.

Triangular Prism with 30 degree angle:

Figure 4.9: Real World Optimization Triangular Prism 30 degrees

Page 38: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 4. Experiment and Results 30

This optimization uses the same settings as the last one. In the beginning genera-tion the best individual has a fitness of 53. After 34 generations the GA reaches theminimum fitness value of 33.9. The optimization took around two hours. Again,the gripper in the end is not able to pick up the triangular prism.

Triangular Prism with 45 degree angle:

Figure 4.10: Real World Optimization Triangular Prism 45 degrees

Now the object to lift is a triangular prism with a 45 degree angle. Increasing thewidth of the object influences the gripper object interaction with more deflection andhence more reaction forces. In addition, the triangular prism’s height is elevatedfrom 0.3 cm to 0.6 cm. Instead of building a bigger object that would raise theweight limit of 10 grams and hence also the fitness value, it’s better to decreasethe position where the robot and gripper start the vertical enclosure displacement.posground is reduced from 0.09m to 0.06m using still the lighter, smaller prism.That way, the optimization reaches better values. It starts with a best fitness of 8and minimizes to a value of 5.13 after 50 generations and a wall time of 2.3 hours.

4.3.3 Box Case

The simulation in this case is not possible (section 2.3.3). Therefore, no optimizationexecution with satisfying results is possible.

Page 39: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

31 4.3. Optimizations

4.3.4 Optimization Abstract

For more clarity the real world optimization results of the previous sections areembraced in a table:

Cylindrical Case Triangular Case 15 DegreesPopulation Size 14 16Elite Number 1 2Crossover Fraction 0.4 0.7Generations Needed 21 38Best Fitness Value 15.37 45.94Ellipsed Time in h 15 2

Triangular Case 30 Degrees Triangular Case 45 DegreesPopulation Size 16 16Elite Number 2 2Crossover Fraction 0.7 0.7Generations Needed 34 50Best Fitness Value 33.9 5.13Ellipsed Time in h 2 2.3

Page 40: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 4. Experiment and Results 32

4.4 Building Process

As briefly mentioned in section 4.2, the building process executed by the robot armdepends mainly on the building speed, building temperature and the number oflayers.The robot arm gets the results from the optimization, i.e. the final, best param-eters that describe the gripper geometry. Using the function ’gripper dimensions’I implemented the new parameters a, b, c, d, e (Figure 4.11) are calculated usingl1, l2, l3, alpha, beta. w1, w2, w3 could be controlled varying the building speed andtemperature. Changing the thickness of the gripper would violate the model com-pensation assumption of a constant thickness. Hence, the thickness of the real worldgripper is around 7 mm.

Figure 4.11: Gripper Dimensions Robot

The robot arm then starts to calibrate (I) and moves to the heating up position(II). When the glue gun reaches the desired building temperature, the robot armstarts building the gripper (III and IV). The whole process can be depicted fromfigure 4.12.

Page 41: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

33 4.4. Building Process

Figure 4.12: Building Process

The robot arm is not able to rebuild the exact gripper we get from the optimization.Having compared the parameters of the optimization with them in real world afterbuilding, there are following deviations:

Building Deviation in mm/degrees Building Deviation in %l1 0.5 10w1 5 43l2 1 12w2 2 25l3 0.5 9.5w3 4 40alpha 0.3 2beta 0.4 1

4.4.1 Cylindrical Case

From 4.3.1 we get a gripper result. The building process of this gripper takes 50minutes and the result is in figure 4.13.

Figure 4.13: Built Gripper Cylindrical Case

Page 42: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 4. Experiment and Results 34

4.4.2 Triangular Prism Case

The gripper with a fitness value of 5.13 is the only one which should be able to liftthe prism. This gripper is built by the robot in almost one hour.

Figure 4.14: Built Gripper Triangular Prism Case

4.5 Pick Up Process

The pick up behaviour of the built grippers (see 4.4) is presented in this part ofthe thesis. To be consistent with the assumption that the gripper opens during theobject enclosure, I open the gripper and enclose the object manually.

4.5.1 Cylindrical Case

As can be seen in figure 4.15 the gripper is able to lift the object.

Figure 4.15: Pick Up Process Cylindrical Case

If the robot tries to lift the object, the gripper detaches itself from the peltierelement - a metal plate where the gripper is fixed in one point using HMA.

4.5.2 Triangular Prism Case

Enclosing and lifting the triangular prism manually works (Fig. 4.16). The robotarm again fails. Tough the gripper doesn’t detach, the robot arm isn’t able to openthe gripper and reach the final position.

Page 43: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

35 4.5. Pick Up Process

Figure 4.16: Pick Up Process Triangular Case

Page 44: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 4. Experiment and Results 36

Page 45: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 5

Conclusion and Future Work

The results of this thesis are satisfying. Of course there are points which could havebe done better or more efficiently. One of these points is the simulation. It is tooslow and unreliable for general grippers. Such an erratic simulation is inappropriatefor an optimization task. In the future the gripper model could be approached dif-ferently. It should be possible to consider the friction interaction during the wholeenclosure and pick up process.

The optimization works well in a certain gripper dimension range and dependson various factors. Generally I can say that the shorter the vertical gripper beams,the higher the simulation’s real world accuracy and the better the optimization re-sults.A gripper with short vertical beams implies a big object dimension or a low verticalrobot position from where the vertical translation starts. Thus, the gripper deflec-tion and with it the lifting interaction forces are bigger.

Best fitness results were achieved with a maximum vertical gripper length of 4cm. The vertical beam length depends on the translation start position posground

and the object dimension. While the latter shouldn’t be controlled - the goal of theproject is to face unanticipated objects - the posground could. In the future it couldbe useful to include this parameter in the optimization task.

Anyway, the optimization using a genetic algorithm proved as efficient method.In the end it’s possible to find the adequate gripper shape that is able to lift acertain object at first attempt. Even compared to the human intuitive optimizationthe genetic algorithm leads to good results.

37

Page 46: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Chapter 5. Conclusion and Future Work 38

Page 47: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Bibliography

[1] L. Brodbeck, L. Wang, F. Iida: Robotic body extension based on Hot MeltAdhesives, Robotics and Automation (ICRA), 2012 IEEE International Con-ference on, pp. 4322-4327, May 2012.

[2] RobotWorx Homepage: http://www.robots.com/applications/pick-and-place.

[3] R. Bernet: 2D Modeling of a Passive Compliant Gripper, Semester-Thesis,BIRL, ETH Zurich, Spring Term 2013.

[4] Matlab Official File Exchange: http://www.mathworks.com/ mat-labcentral/fileexchange/ 11317-genetic-algorithm-performance/ content/Ge-netic%20Algorithm/GA.m.

[5] Matlab Official Homepage: http://www.mathworks.ch/ch/help/gads/gaoptimset.html.

[6] M. Mitchell: An Introduction to Genetic Algorithms, A Bradford Book TheMIT Press, London, England, p.118, 1999

39

Page 48: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A

MATLAB Code

A.1 Genetic Algorithm Global Optimization Tool-box

A.1.1 Cylindrical Case

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Definitive Gripper Model %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Genetic Algorithm Cylindrical Case %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clear allclear variablesclose allclcwarning('off') %turns off all warningsi=1;j=[];

tic%% Optimization% To optimize the gripper's shape a genetic algorithm is used

%% Translation of the robotv=0.008; %[m/s]C=0.03; %[m] distance of robot's translation of the GBET=C/v; %[s]

%% Cylinderm cyl=10;%gr %[kg]

R cyl=0.5*0.0472; %[m] radiusR cyl cm=1000*R cyl; %[mm]pos ground=0.09;%*2; %[m] distance between point where vertical translation

%starts and the groundd cyl=pos ground−R cyl;

n upper=5;n vert=5;n tip=3;%% Optimization settings/process

% create the gaoptimset for the ga matlab functionoptions = gaoptimset('Display', 'diagnose', 'PlotFcns', @gaplotbestf,...'PopInitRange',[0.2*R cyl cm/n upper, 2, ...

40

Page 49: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

41 A.1. Genetic Algorithm Global Optimization Toolbox

1000*0.9*(pos ground−C−R cyl)/n vert, 2, 3, 2, 0, 0; ...3.2*R cyl cm/n upper, 5, 1000*1*(pos ground−C)/n vert, 5, 15, 5, 45, 70],...'Generations',200,'EliteCount', 1, 'CrossoverFraction', 0.4, ...'FitnessLimit', 0.7,'PopulationSize', 10, 'UseParallel', 'never' );

% Upper and lower bounds

lb=[0.2*R cyl cm/n upper, 2, 1000*1*(pos ground−C−R cyl)/n vert, 2, 3, ...2, 0, 0];

ub=[ 2*R cyl cm/n upper, 5, 1000*1*(pos ground−C)/n vert, 5, 6, 5, 45, 70];

% ga funtion of matlab's optimization toolbox

NumberOfVariables=8;

[parameters, Fval, exitflag, output, population]=ga(@fitness cylrw pos,...NumberOfVariables, ...[], [], [],[], lb, ...ub , [], options);

fprintf('The best function value found was : %g\n', Fval);

% Save final results of the optimizationsave('Parameters cyl', 'parameters', 'Fval', 'exitflag', 'output',...

'population')

toc

A.1.2 Triangular Case

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Definitive Gripper Model %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Genetic Algorithm Prism Case %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clear allclear variablesclose allclcwarning('off') %turns off all warningsi=1;j=[];

tic%% Optimization% To optimize the gripper's shape a genetic algorithm is used

%% Translation of the robotv=0.008; %[m/s]C=0.03; %[m] distance of robot's translation of the GBET=C/v; %[s]

%% Cylinderm cyl=10;%gr %[kg]

R cyl=0.5*0.0472; %[m] radiusR cyl cm=1000*R cyl; %[mm]%% Prismgamma=45; %[degree]m prism=5; %[g]d prism=0.09−0.03; %[m]height=pos ground−d prism; %[m]% J prism

Page 50: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 42

base=2*height*tan(gamma*pi/180); %[m]pos ground=0.09; %[m]n upper=5;n vert=5;n tip=3;%% Optimization settings/process

% create the gaoptimset for the ga matlab functionoptions = gaoptimset('Display', 'diagnose', 'PlotFcns', @gaplotbestf,...'PopInitRange',[0.4*base/n upper, 2, ...1000*0.9*(pos ground−C−0.4*heigt)/n vert, 2, 3, 2, 0, 0; ...0.6*base/n upper, 5, 1000*1.3*(pos ground−C)/n vert, 5, 15, 5, 35, 60],...'Generations',200,'EliteCount', 2, 'CrossoverFraction', 0.7, ...'FitnessLimit', 0.7,'PopulationSize', 16, 'Vectorized', 'off',...'UseParallel', 'never' );

lb=[0.4*base/n upper, 2, 1000*1*(pos ground−C−0.3*height)/n vert, 2,...3, 2, 0, 0];

ub=[ 0.6*base/n upper, 5, 1000*1.3*(pos ground−C)/n vert, 5, 15, 5,...30, 60];

% ga funtion of matlab's optimization toolboxNumberOfVariables=8;

[parameters, Fval, exitflag, output, population]= ga(@fitness prismrw, ...NumberOfVariables, ...[], [], [],[], lb,...ub , [], options);

fprintf('The best function value found was : %g\n', Fval);

% Save final results of the optimizationsave('Parameters prism', 'parameters', 'Fval', 'exitflag', 'output',...

'population')

toc

A.1.3 Box Case

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Definitive Gripper Model %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Genetic Algorithm Box Case %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clear allclear variablesclose allclcwarning('off') %turns off all warningsi=1;j=[];

%% Optimization% To optimize the gripper's shape a genetic algorithm is used

%% Translation of the robotv=0.008; %[m/s]C=0.03; %[m] distance of robot's translation of the GBET=C/v; %[s]

%% Boxl box=0.028; %[m]w box=0.028; %[m]d box=0.062; %[m]

Page 51: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

43 A.2. Real Coded Genetic Algorithm

m box=6; %[g] should move from 1 to 10 gr

pos ground=0.09; %[m] distance from point from where translation starts%to the ground

r box=0.003; %[m]

n upper=5;n vert=5;n tip=3;%% Optimization settings/process

% create the gaoptimset for the ga matlab functionoptions = gaoptimset('Display', 'diagnose', 'PlotFcns', @gaplotbestf, ...'PopInitRange',[0.4*1000*l box/n upper, 2, ...1000*1*(pos ground−C−(w box/2))/n vert, 2, 3, 2, 0, 0; ...3.2*1000*l box/n upper, 5, 1000*0.9*(pos ground−C)/n vert, 5, 15, ...5, 45, 80 ] ,'Generations',200,'EliteCount', 2,'CrossoverFraction', 0.6,...'FitnessLimit', 0.8,'PopulationSize', 10, 'UseParallel', 'never');

% Upper and lower boundslb=[0.4*1000*l box/n upper, 2, 1000*1*(pos ground−C−(w box/2))/n vert, ...

2, 3, 2, 0, 0];ub=[3.2*1000*l box/n upper, 5, 1000*0.9*(pos ground−C)/n vert, 5, 15, ...

5, 45, 80 ];

% ga funtion of matlab's optimization toolboxNumberOfVariables=8;

tic

[parameters, Fval, exitflag, output, population]= ga(@fitness box realw,...NumberOfVariables, ...[], [], [], [], lb,...ub , [], options);

fprintf('The best function value found was : %g\n', Fval);

% Save final results of the optimizationsave('Parameters box', 'parameters', 'Fval', 'exitflag', 'output',...

'population')

toc

A.2 Real Coded Genetic Algorithm

function GA% Genetic Algorithm(real coding)% Implemented By: Javad Ivakpour% Modified By: Giovanni Cavolina% Goal: find maximum of function that introduced in fun00.m file in current% directory and can be plotted in plot00

ticclcfigure(1)clfclear allformat long

%−−−−−−−−−−−−−−−−−−−−−−−− parameters −−−−−−−−−−−−−−−−−−−−−−−−% befor using this function you must specified your function in fun00.m

Page 52: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 44

% file in current directory and then set the parametersvar=8; % Number of variables (this item must be equal to the

% number of variables that is used in the function in% fun00.m file)

n=10;%100 % Number of population

m0=5;%20 % Number of generations that max value remains constant% (use for termination criteria)

nmutationG=2;%=20; %number of mutation children(Gaussian)nmutationR=2;%=20; %number of mutation children(random)nelit=2; %number of elitism children

%% Translation of the robotv=0.008; %[m/s]C=0.03; %[m] distance of robot's translation of the GBET=C/v; %[s]

% Cylinderm cyl=10;%gr %[kg]R cyl=0.5*0.0472; %[m] radiusR cyl cm=1000*R cyl; %[mm]−>ist eig wie alles momentan in mmpos ground=0.09;%*2; %[m] Position des Groundblocks der Box von world ausd cyl=pos ground−R cyl;

%Grippern upper=5;n vert=5;n tip=3;

lb=[0.4*R cyl cm/n upper, 2, 1000*1*(pos ground−C−R cyl)/n vert, 2, 3,...2, 0, 0];

ub=[3.3*R cyl cm/n upper, 5, 1000*1*(pos ground−C)/n vert, 5, 15, 5,...45, 70];

%

valuemin=lb;%=ones(1,var)*−5*pi; % min possible value of variablesvaluemax=ub;%=ones(1,var)*5*pi; % max possible value of variables

%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−nmutation=nmutationG+nmutationR;sigma=(valuemax−valuemin)/10; %Parameter that related to Gaussian

% function and used in mutation stepmax1=zeros(nelit,var);parent=zeros(n,var);cu=[valuemin(1) valuemax(1) valuemin(2) valuemax(2)];for l=1:var

p(:,l)=valuemin(l)+rand(n,1).*(valuemax(l)−valuemin(l));endinitial=p;m=m0;maxvalue=ones(m,1)*−1e10;maxvalue(m)=−1e5;g=0;meanvalue(m)=0;%−−−−−−−−−−−−− **** termination criteria ****−−−−−−−−−−−−−while abs(maxvalue(m)−maxvalue(m−(m0−1)))>0.001*maxvalue(m) &...

(abs(maxvalue(m))>1e−10 & abs(maxvalue(m−(m0−1)))>1e−10)...& m<10000 & abs(maxvalue(m)−meanvalue(m))>1e−5 | m<20

sigma=sigma./(1.05);% reducing the sigma value% −−−−−− **** % reducing the number of mutation()random **** −−−−g=g+1;if g>10 & nmutationR>0

g=0;nmutationR=nmutationR−1;nmutation=nmutationG+nmutationR;

end

Page 53: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

45 A.2. Real Coded Genetic Algorithm

%−−−−−−−−−−−−− **** function evaluation ****−−−−−−−−−−−−−for i=1:n

y(i)=fitness cylrwmax(p(i,:));ends=sort(y);maxvalue1(1:nelit)=s(n:−1:n−nelit+1);if nelit==0

maxvalue1(1)=s(n);for i=1:n

if y(i)==maxvalue1(1)max1(1,:)=p(i,:);

endend

endfor k=1:nelit

for i=1:nif y(i)==maxvalue1(k)

max1(k,:)=p(i,:);end

endendif var==2

figure(1)subplot(2,2,1)hold offplot00(cu)hold onplot3(p(:,1),p(:,2),y,'ro')plot3(max1(1,1),max1(1,2),maxvalue1(1),'bh')title({' Genetic Algorithm '...

,'Performance of GA ( o : each individual)'},'color','b')

endy=y−min(y)*1.02;sumd=y./sum(y);meanvalue=y./(sum(y)/n);

%−−−−−−−−−−−−− **** Selection: Roulette wheel ****−−−−−−−−−−−−−for l=1:n

sel=rand;sumds=0;j=1;while sumds<sel

sumds=sumds+sumd(j);j=j+1;

endparent(l,:)=p(j−1,:);

endp=zeros(n,var);

%−−−−−−−−−−−−− **** regeneration ****−−−−−−−−−−−−−for l=1:var

%−−−−−−−−−−−−− **** cross−over ****−−−−−−−−−−−−−for j=1:ceil((n−nmutation−nelit)/2)

t=rand*1.5−0.25;p(2*j−1,l)=t*parent(2*j−1,l)+(1−t)*parent(2*j,l);p(2*j,l)=t*parent(2*j,l)+(1−t)*parent(2*j−1,l);

end

%−−−−−−−−−−−−− **** elitism ****−−−−−−−−−−−−−for k=1:nelit

p((n−nmutation−k+1),l)=max1(k,l);

Page 54: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 46

end

%−−−−−−−−−−−−− **** mutation ****−−−−−−−−−−−−−for i=n−nmutation+1:n−nmutationR

phi=1−2*rand;z=erfinv(phi)*(2ˆ0.5);p(i,l)=z*sigma(l)+parent(i,l);

endfor i=n−nmutationR+1:n

p(i,1:var)=valuemin(1:var)+rand(1,var).*(valuemax(1:var)−...valuemin(1:var));

endfor i=1:n

for l=1:varif p(i,l)<valuemin(l)

p(i,l)=valuemin(l);elseif p(i,l)>valuemax(l)

p(i,l)=valuemax(l);end

endend

endp;m=m+1;max1;maxvalue(m)=maxvalue1(1);maxvalue00(m−m0)=maxvalue1(1);mean00(m−m0)=sum(s)/n;meanvalue(m)=mean00(m−m0);figure(1)if var==2

subplot(2,2,2)endhold offplot(maxvalue00,'b')hold onplot(mean00,'r')hold ontitle({'Performance of GA',...

'best value GA:blue, best value RS:black, mean value GA:red',''}...,'color','b')

xlabel('number of generations')ylabel('value')

%−−−−−−−−−−−−− **** Random search ****−−−−−−−−−−−−−%−−−−−−−−−−−−− **** for comparision ****−−−−−−−−−−−−−p00=zeros(n,var);for l=1:var

p00(:,l)=valuemin(l)+rand(n,1).*(valuemax(l)−valuemin(l));endfor i=1:n

y(i)=fun00(p00(i,:));ends=sort(y);maxvalueRAND(m−m0)=s(n);if m>(m0+1)

if maxvalueRAND(m−m0)<maxvalueRAND(m−(m0+1))maxvalueRAND(m−m0)=maxvalueRAND(m−(m0+1));

elsefor i=1:n

if y(i)==maxvalueRAND(m−m0)maxRand=p00(i,:);

endend

Page 55: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

47 A.3. Fitness Function

endelse

for i=1:nif y(i)==maxvalueRAND(m−m0)

maxRand=p00(i,:);end

endendplot(maxvalueRAND,'k')if var==2

figure(1)subplot(2,2,3)plot00(cu)hold onplot3(maxRand(1,1),maxRand(1,2),maxvalueRAND(m−m0),'k*')plot3(max1(1,1),max1(1,2),maxvalue00(m−m0),'bo')title({'Best solution found by GA(: o) & RS(:*)'...

'in each generation ',''},'color','b')endpause(0.001)

end

clc

disp('**************************************')num of fun evaluation=n*mmax point GA=max1(1,:)maxvalue GA=maxvalue00(m−m0)

if var==2figure(1)subplot(2,2,4)hold offplot3(max1(1,1),max1(1,2),maxvalue1,'o')hold onplot00(cu)hold onplot3(maxRand(1,1),maxRand(1,2),maxvalueRAND(m−m0),'*')title({'Best solution ';'GA: o & RS: *'},'color','b')

endfigure(2)title('Performance of GA(best value)','color','b')xlabel('number of generations')ylabel('max value of best solution')hold onplot(maxvalue00)hold ontoc

A.3 Fitness Function

A.3.1 Cylindrical Case

function [fitness] = fitness cylrw(parameters)

warning('off')

% −−−−−−−−−−−−−−−−− Initialize parameters for simulation−−−−−−−−−−−−−−−−−−for q=1:1%% General Paramatersrho = 0.98*1e−3; % [g/mmˆ3]h = 0.7; % [cm]E = 8.9e6; % [N/mˆ2] Young's modulus HMAb = 0.01; % damping coefficient

Page 56: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 48

alpha = 15; % [degree]beta = 60;angle beam=7;

%% Top% Upper Beaml 1 = (11/7)*1.21; % [mm]w 1 = 1.4; % [mm]m 1 = l 1*w 1*h*rho; % [g]I z1 = 1/12*0.01*h*(0.01*w 1)ˆ3; %[mˆ4]k 1 = E*I z1/(0.01*l 1); %spring [N*m/rad]k=k 1;J 1 = 1/12*m 1*diag([(w 1ˆ2+hˆ2), (l 1ˆ2+hˆ2), (l 1ˆ2 + w 1ˆ2)])*1e−2;

%% Left Beam = Right Beaml 2 = 2*2.172; % [mm]w 2 = 1.4; % [mm]m 2 = l 2*w 2*h*rho; % [g]I z2 = 1/12*0.01*h*(0.01*w 2)ˆ3; %[mˆ4]k 2 = E*I z2/(0.01*l 2); %spring [N*m/rad]J v = 1/12*m 2*diag([(l 2ˆ2+hˆ2), (w 2ˆ2+hˆ2), (l 2ˆ2 + w 2ˆ2)])*1e−2;

%% Tipl 3 = 3.172; % [mm]w 3 = 0.4; % [mm]m 3 = l 2*w 3*h*rho; % [g]I z3 = 1/12*0.01*h*(0.01*w 3)ˆ3; %[mˆ4]k 3 = E*I z2/(0.01*l 3); %spring [N*m/rad]J 3 = 1/12*m 3*diag([(w 3ˆ2+hˆ2), (l 3ˆ2+hˆ2), (l 3ˆ2 + w 3ˆ2)])*1e−2;

r = 0.06; % [mm] blend tip

%% Data of groundk Ground = 100000; % [N/m] 10000b Ground = 0; % [Ns/m] 50mu Ground = 0;%−0.72;mu=0.72;c = 1e−8; % [m/s]

%% Translation of the robotv=0.008; %[m/s]C=0.03; %[m] distance of robot's translation of the GBET=C/v; %[s]

%% Cylinderm cyl=10;%gr %[kg]R cyl=0.01425;%R cyl=0.5*0.0472; %[m] radiusR cyl cm=1000*R cyl; %[mm]% J cylpos ground=0.09;%*2; %[m]d cyl=pos ground−R cyl;n upper=5;n vert=5;n tip=3;

endfor n=1:1%% define which parameter of ga optimization is which

l 1=parameters(1);w 1=parameters(2);l 2=parameters(3);w 2=parameters(4);l 3=parameters(5);

Page 57: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

49 A.3. Fitness Function

w 3=parameters(6);alpha=parameters(7);beta=parameters(8);

%tip crossing and upper edge hitting testing mechanisma a=sin(alpha*pi/180)*n vert*l 2;c c=cos((beta−alpha)*pi/180)*n tip*l 3;b b=c c−a a;d d=(n upper*l 1)*0.5+a a;

%tip crossingif b b>=(n upper*l 1)/2

disp('tip crossing')parameters;fitness=370;

% breakend

%load('Gripper cyl 2012a sat')%run simulation to get data needed to calculate fitness functionsim('Gripper cyl 2012a sat pos.mdl', 'SrcWorkspace', 'current');%current changes workspace to the current on eof the function we are in%time check = load('time check.mat');

%calculate forces in y−direction

%Get Data from simulationforce l1 = load('force l1.mat');force l2 = load('force l2.mat');force l3 = load('force l3.mat');force l4 = load('force l4.mat');force l5 = load('force l5.mat');force l6 = load('force l6.mat');force l7 = load('force l7.mat');force l8 = load('force l8.mat');force r1 = load('force r1.mat');force r2 = load('force r2.mat');force r3 = load('force r3.mat');force r4 = load('force r4.mat');force r5 = load('force r5.mat');force r6 = load('force r6.mat');force r7 = load('force r7.mat');force r8 = load('force r8.mat');angle r1 = load('angle r1.mat');angle r2 = load('angle r2.mat');angle r3 = load('angle r3.mat');angle r4 = load('angle r4.mat');angle r5 = load('angle r5.mat');angle r6 = load('angle r6.mat');angle r7 = load('angle r7.mat');angle r8 = load('angle r8.mat');angle l1 = load('angle l1.mat');angle l2 = load('angle l2.mat');angle l3 = load('angle l3.mat');angle l4 = load('angle l4.mat');angle l5 = load('angle l5.mat');angle l6 = load('angle l6.mat');angle l7 = load('angle l7.mat');angle l8 = load('angle l8.mat');pos r1 = load('pos r1.mat');pos r2 = load('pos r2.mat');pos r3 = load('pos r3.mat');pos r4 = load('pos r4.mat');pos r5 = load('pos r5.mat');pos r6 = load('pos r6.mat');

Page 58: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 50

pos r7 = load('pos r7.mat');pos r8 = load('pos r8.mat');pos l1 = load('pos l1.mat');pos l2 = load('pos l2.mat');pos l3 = load('pos l3.mat');pos l4 = load('pos l4.mat');pos l5 = load('pos l5.mat');pos l6 = load('pos l6.mat');pos l7 = load('pos l7.mat');pos l8 = load('pos l8.mat');

pos last vertbeam r = load('pos last vertbeam r.mat');pos last vertbeam l = load('pos last vertbeam l.mat');pos tip l = load('pos tip l.mat');pos tip r = load('pos tip r.mat');

normal r1=0;normal r2=0;normal r3=0;normal r4=0;normal r5=0;normal r6=0;normal r7=0;normal r8=0;normal l1=0;normal l2=0;normal l3=0;normal l4=0;normal l5=0;normal l6=0;normal l7=0;normal l8=0;

if pos r1.ans(3,end)<−abs(pos ground−R cyl)normal r1=abs(angle r1.ans(2,end)*force r1.ans(2,end));

endif pos r2.ans(3,end)<−abs(pos ground−R cyl)

normal r2=abs(angle r2.ans(2,end)*force r2.ans(2,end));endif pos r3.ans(3,end)<−abs(pos ground−R cyl)

normal r3=abs(angle r3.ans(2,end)*force r3.ans(2,end));endif pos r4.ans(3,end)<−abs(pos ground−R cyl)

normal r4=abs(angle r4.ans(2,end)*force r4.ans(2,end));endif pos r5.ans(3,end)<−abs(pos ground−R cyl)

normal r5=abs(angle r5.ans(2,end)*force r5.ans(2,end));endif pos r6.ans(3,end)<−abs(pos ground−R cyl)

normal r6=abs(angle r6.ans(2,end)*force r6.ans(2,end));endif pos r7.ans(3,end)<−abs(pos ground−R cyl)

normal r7=abs(angle r7.ans(2,end)*force r7.ans(2,end));endif pos r8.ans(3,end)<−abs(pos ground−R cyl)

normal r8=abs(angle r8.ans(2,end)*force r8.ans(2,end));endif pos l1.ans(3,end)<−abs(pos ground−R cyl)

normal l1=abs(angle l1.ans(2,end)*force l1.ans(2,end));endif pos l2.ans(3,end)<−abs(pos ground−R cyl)

normal l2=abs(angle l2.ans(2,end)*force l2.ans(2,end));endif pos l3.ans(3,end)<−abs(pos ground−R cyl)

normal l3=abs(angle l3.ans(2,end)*force l3.ans(2,end));

Page 59: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

51 A.3. Fitness Function

endif pos l4.ans(3,end)<−abs(pos ground−R cyl)

normal l4=abs(angle l4.ans(2,end)*force l4.ans(2,end));endif pos l5.ans(3,end)<−abs(pos ground−R cyl)

normal l5=abs(angle l5.ans(2,end)*force l5.ans(2,end));endif pos l6.ans(3,end)<−abs(pos ground−R cyl)

normal l6=abs(angle l6.ans(2,end)*force l6.ans(2,end));endif pos l7.ans(3,end)<−abs(pos ground−R cyl)

normal l7=abs(angle l7.ans(2,end)*force l7.ans(2,end));endif pos l8.ans(3,end)<−abs(pos ground−R cyl)

normal l8=abs(angle l8.ans(2,end)*force l8.ans(2,end));end

F reaction y=normal l1+abs(angle l1.ans(3,end)*mu*force l1.ans(2,end))+...normal l2+abs(angle l2.ans(3,end)*mu*force l2.ans(2,end))+...normal l3+abs(angle l3.ans(3,end)*mu*force l3.ans(2,end))+...normal l4+abs(angle l4.ans(3,end)*mu*force l4.ans(2,end))+...normal l5+abs(angle l5.ans(3,end)*mu*force l5.ans(2,end))+...normal l6+abs(angle l6.ans(3,end)*mu*force l6.ans(2,end))+...normal l7+abs(angle l7.ans(3,end)*mu*force l7.ans(2,end))+...normal l8+abs(angle l8.ans(3,end)*mu*force l8.ans(2,end))+...normal r1+abs(angle r1.ans(3,end)*mu*force r1.ans(2,end))+...normal r2+abs(angle r2.ans(3,end)*mu*force r2.ans(2,end))+...normal r3+abs(angle r3.ans(3,end)*mu*force r3.ans(2,end))+...normal r4+abs(angle r4.ans(3,end)*mu*force r4.ans(2,end))+...normal r5+abs(angle r5.ans(3,end)*mu*force r5.ans(2,end))+...normal r6+abs(angle r6.ans(3,end)*mu*force r6.ans(2,end))+...normal r7+abs(angle r7.ans(3,end)*mu*force r7.ans(2,end))+...normal r8+abs(angle r8.ans(3,end)*mu*force r8.ans(2,end));

F weight=m cyl*9.81;fitness1=abs(F weight/F reaction y);

if (pos last vertbeam r.ans(2,1)<0 | | pos last vertbeam l.ans(2,1)>0)disp('Gripper crosses beam elements!')parameters;fitness=50;

elseif (pos tip r.ans(2,1)<pos tip l.ans(2,1))disp('Gripper crosses tip elements!')parameters;fitness=50;

elseif fitness1==Infdisp('Gripper does not touch object!!')fitness=40;

elseparameters;fitness=abs(F weight/F reaction y);

end

endend

A.3.2 Triangular Case

function [fitness] = fitness prismrw(parameters)

% −−−−−−−−−−−−−−−−− Initialize parameters for simulation−−−−−−−−−−−−−−−−−−

Page 60: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 52

for q=1:1%% General Paramatersrho = 0.98*1e−3; % [g/mmˆ3]h = 0.7; % [cm]E = 8.9e6; % [N/mˆ2] Young's modulus HMAb = 0.01; % damping coefficientalpha = 15; % [degree]beta = 60;angle beam=7;

%% Top% Upper Beaml 1 = 1.51; % [mm]w 1 = 1.4; % [mm]m 1 = l 1*w 1*h*rho; % [g]I z1 = 1/12*0.01*h*(0.01*w 1)ˆ3; %[mˆ4]k 1 = E*I z1/(0.01*l 1); %spring [N*m/rad]k=k 1;J 1 = 1/12*m 1*diag([(w 1ˆ2+hˆ2), (l 1ˆ2+hˆ2), (l 1ˆ2 + w 1ˆ2)])*1e−2;

%% Left Beam = Right Beaml 2 = 2.172; % [mm]w 2 = 1.4; % [mm]m 2 = l 2*w 2*h*rho; % [g]I z2 = 1/12*0.01*h*(0.01*w 2)ˆ3; %[mˆ4]k 2 = E*I z2/(0.01*l 2); %spring [N*m/rad]J v = 1/12*m 2*diag([(l 2ˆ2+hˆ2), (w 2ˆ2+hˆ2), (l 2ˆ2 + w 2ˆ2)])*1e−2;

%% Tipl 3 = 3.172; % [mm]w 3 = 0.4; % [mm]m 3 = l 2*w 3*h*rho; % [g]I z3 = 1/12*0.01*h*(0.01*w 3)ˆ3; %[mˆ4]k 3 = E*I z2/(0.01*l 3); %spring [N*m/rad]J 3 = 1/12*m 3*diag([(w 3ˆ2+hˆ2), (l 3ˆ2+hˆ2), (l 3ˆ2 + w 3ˆ2)])*1e−2;

r = 0.06; % [mm] blend tip

%% Data of groundk Ground = 10000; % [N/m] 10000b Ground = 0; % [Ns/m] 50mu Ground = 0;%−0.001;mu=0.73;c = 1e−8; % [m/s]

%% Translation of the robotv=0.008; %[m/s]C=0.03; %[m] distance of robot's translation of the GBET=C/v; %[s]

%% Prismgamma=60*pi/180; %[radian]m prism=5; %[kg]d prism=0.09−0.03; %[m]% J prismpos ground=0.09; %[m]n upper=5;n vert=5;n tip=3;

end

for n=1:1%% define which parameter of ga optimization is which

Page 61: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

53 A.3. Fitness Function

l 1=parameters(1);w 1=parameters(2);l 2=parameters(3);w 2=parameters(4);l 3=parameters(5);w 3=parameters(6);alpha=parameters(7);beta=parameters(8);

%tip crossing and upper edge hitting testing mechanisma a=sin(alpha*pi/180)*n vert*l 2;c c=cos((beta−alpha)*pi/180)*n tip*l 3;b b=c c−a a;d d=(n upper*l 1)*0.5+a a;

%tip crossingif b b>=(n upper*l 1)/2

disp('tip crossing')parameters;fitness=370;break

end

%run simulation to get data needed to calculate fitness functionsim('Gripper prism 2012a sat.mdl', 'SrcWorkspace', 'current');%current changes workspace to the current on eof the function we are in%calculate forces in y−direction

%Get Data from simulationforce l1 = load('force l1.mat');force l2 = load('force l2.mat');force l3 = load('force l3.mat');force l4 = load('force l4.mat');force l5 = load('force l5.mat');force l6 = load('force l6.mat');force l7 = load('force l7.mat');force l8 = load('force l8.mat');force r1 = load('force r1.mat');force r2 = load('force r2.mat');force r3 = load('force r3.mat');force r4 = load('force r4.mat');force r5 = load('force r5.mat');force r6 = load('force r6.mat');force r7 = load('force r7.mat');force r8 = load('force r8.mat');angle r1 = load('angle r1.mat');angle r2 = load('angle r2.mat');angle r3 = load('angle r3.mat');angle r4 = load('angle r4.mat');angle r5 = load('angle r5.mat');angle r6 = load('angle r6.mat');angle r7 = load('angle r7.mat');angle r8 = load('angle r8.mat');angle l1 = load('angle l1.mat');angle l2 = load('angle l2.mat');angle l3 = load('angle l3.mat');angle l4 = load('angle l4.mat');angle l5 = load('angle l5.mat');angle l6 = load('angle l6.mat');angle l7 = load('angle l7.mat');angle l8 = load('angle l8.mat');pos last vertbeam r = load('pos last vertbeam r.mat');pos last vertbeam l = load('pos last vertbeam l.mat');

Page 62: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 54

pos tip l=load('pos tip l.mat');pos tip r=load('pos tip r.mat');%Trackable2 = load('Trackable2.mat');

F reaction y= abs(angle l1.ans(3,end)*mu*force l1.ans(2,end))+...abs(angle l2.ans(3,end)*mu*force l2.ans(2,end))+...abs(angle l3.ans(3,end)*mu*force l3.ans(2,end))+...abs(angle l4.ans(3,end)*mu*force l4.ans(2,end))+...abs(angle l5.ans(3,end)*mu*force l5.ans(2,end))+...abs(angle l6.ans(3,end)*mu*force l6.ans(2,end))+...abs(angle l7.ans(3,end)*mu*force l7.ans(2,end))+...abs(angle l8.ans(3,end)*mu*force l8.ans(2,end))+...abs(angle r1.ans(3,end)*mu*force r1.ans(2,end))+...abs(angle r2.ans(3,end)*mu*force r2.ans(2,end))+...abs(angle r3.ans(3,end)*mu*force r3.ans(2,end))+...abs(angle r4.ans(3,end)*mu*force r4.ans(2,end))+...abs(angle r5.ans(3,end)*mu*force r5.ans(2,end))+...abs(angle r6.ans(3,end)*mu*force r6.ans(2,end))+...abs(angle r7.ans(3,end)*mu*force r7.ans(2,end))+...abs(angle r8.ans(3,end)*mu*force r8.ans(2,end));

F weight=m prism*9.81;fitness1=abs(F weight/F reaction y);

if (pos last vertbeam r.ans(2,1)<=0 | | pos last vertbeam l.ans(2,1)>=0)disp('Gripper crosses his beams!')parameters;fitness=380;

elseif (pos tip r.ans(2,1)<pos tip l.ans(2,1))disp('Gripper crosses tip elements!')parameters;fitness=370;

elseif fitness1==Infdisp('Gripper does not touch object!!')fitness=350;

elseparameters;fitness=abs(F weight/F reaction y);

end

endend

A.3.3 Box Case

function [fitness] = fitness boxrw(parameters)

warning('off')

% −−−−−−−−−−−−−−−−− Initialize parameters for simulation−−−−−−−−−−−−−−−−−−for q=1:1%% General Paramatersrho = 0.98*1e−3; % [g/mmˆ3]h = 0.7; % [cm]E = 8.9e6; % [N/mˆ2] Young's modulus HMAb = 0.01; % damping coefficientalpha = 15; % [degree]beta = 60;angle beam=7;

Page 63: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

55 A.3. Fitness Function

%% Top% Upper Beaml 1 = 1.51; % [mm]w 1 = 1.4; % [mm]m 1 = l 1*w 1*h*rho; % [g]I z1 = 1/12*0.01*h*(0.01*w 1)ˆ3; %[mˆ4]k 1 = E*I z1/(0.01*l 1); %spring [N*m/rad]k=k 1;J 1 = 1/12*m 1*diag([(w 1ˆ2+hˆ2), (l 1ˆ2+hˆ2), (l 1ˆ2 + w 1ˆ2)])*1e−2;

%% Left Beam = Right Beaml 2 = 2.172; % [mm]w 2 = 1.4; % [mm]m 2 = l 2*w 2*h*rho; % [g]I z2 = 1/12*0.01*h*(0.01*w 2)ˆ3; %[mˆ4]k 2 = E*I z2/(0.01*l 2); %spring [N*m/rad]J v = 1/12*m 2*diag([(l 2ˆ2+hˆ2), (w 2ˆ2+hˆ2), (l 2ˆ2 + w 2ˆ2)])*1e−2;

%% Tipl 3 = 3.172; % [mm]w 3 = 0.4; % [mm]m 3 = l 2*w 3*h*rho; % [g]I z3 = 1/12*0.01*h*(0.01*w 3)ˆ3; %[mˆ4]k 3 = E*I z2/(0.01*l 3); %spring [N*m/rad]J 3 = 1/12*m 3*diag([(w 3ˆ2+hˆ2), (l 3ˆ2+hˆ2), (l 3ˆ2 + w 3ˆ2)])*1e−2;

r = 0.06; % [mm] blend tip

%% Data of groundk Ground = 10000; % [N/m] 10000b Ground = 0; % [Ns/m] 50mu Ground = 0;%−0.68;mu=0.68;c = 1e−8; % [m/s]

%% Translation of the robotv=0.008; %[m/s]C=0.03; %[m] distance of robot's translation of the GBET=C/v; %[s]

%% Box

l box=0.028; %[m]w box=0.028; %[m]d box=0.062; %[m]m box=6; %[g] should move from 1 to 10 grpos ground=0.09; %[m]n upper=5;n vert=5;n tip=3;

end

for n=1:1%% define which parameter of ga optimization is which

l 1=parameters(1);w 1=parameters(2);l 2=parameters(3);w 2=parameters(4);l 3=parameters(5);w 3=parameters(6);

Page 64: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 56

alpha=parameters(7);beta=parameters(8);

%tip crossing and upper edge hitting testing mechanisma a=sin(alpha*pi/180)*n vert*l 2;c c=cos((beta−alpha)*pi/180)*n tip*l 3;b b=c c−a a;d d=(n upper*l 1)*0.5+a a;

%tip crossingif b b>=(n upper*l 1)/2

disp('tip crossing')parameters;fitness=70;break

elseif d d<=(l box*1000)/2disp('upper edge hitting')parameters;fitness=100;break

end

% Simulation time%SimTime=5;

%try%run simulation to get data needed to calculate fitness functionsim('Gripper box 2012a sat.mdl', 'SrcWorkspace', 'current');%current changes workspace to the current on eof the function we are in%calculate forces in y−direction%Get Data from simulationforce l1 = load('force l1.mat');force l2 = load('force l2.mat');force l3 = load('force l3.mat');force l4 = load('force l4.mat');force l5 = load('force l5.mat');force l6 = load('force l6.mat');force l7 = load('force l7.mat');force l8 = load('force l8.mat');force r1 = load('force r1.mat');force r2 = load('force r2.mat');force r3 = load('force r3.mat');force r4 = load('force r4.mat');force r5 = load('force r5.mat');force r6 = load('force r6.mat');force r7 = load('force r7.mat');force r8 = load('force r8.mat');angle r1 = load('angle r1.mat');angle r2 = load('angle r2.mat');angle r3 = load('angle r3.mat');angle r4 = load('angle r4.mat');angle r5 = load('angle r5.mat');angle r6 = load('angle r6.mat');angle r7 = load('angle r7.mat');angle r8 = load('angle r8.mat');angle l1 = load('angle l1.mat');angle l2 = load('angle l2.mat');angle l3 = load('angle l3.mat');angle l4 = load('angle l4.mat');angle l5 = load('angle l5.mat');angle l6 = load('angle l6.mat');angle l7 = load('angle l7.mat');angle l8 = load('angle l8.mat');

pos last vertbeam r = load('pos last vertbeam r.mat');pos last vertbeam l = load('pos last vertbeam l.mat');

Page 65: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

57 A.3. Fitness Function

pos tip l=load('pos tip l.mat');pos tip r=load('pos tip r.mat');pos tip l.ans(2,1);pos tip r.ans(2,1);%Trackable2 = load('Trackable2.mat');

F reaction y=abs(angle l1.ans(2,end)*force l1.ans(2,end))+...abs(angle l1.ans(3,end)*mu*force l1.ans(2,end))+...abs(angle l2.ans(2,end)*force l2.ans(2,end))+...abs(angle l2.ans(3,end)*mu*force l2.ans(2,end))+...abs(angle l3.ans(2,end)*force l3.ans(2,end))+...abs(angle l3.ans(3,end)*mu*force l3.ans(2,end))+...abs(angle l4.ans(2,end)*force l4.ans(2,end))+...abs(angle l4.ans(3,end)*mu*force l4.ans(2,end))+...abs(angle l5.ans(2,end)*force l5.ans(2,end))+...abs(angle l5.ans(3,end)*mu*force l5.ans(2,end))+...abs(angle l6.ans(2,end)*force l6.ans(2,end))+...abs(angle l6.ans(3,end)*mu*force l6.ans(2,end))+...abs(angle l7.ans(2,end)*force l7.ans(2,end))+...abs(angle l7.ans(3,end)*mu*force l7.ans(2,end))+...abs(angle l8.ans(2,end)*force l8.ans(2,end))+...abs(angle l8.ans(3,end)*mu*force l8.ans(2,end))+...abs(angle r1.ans(2,end)*force r1.ans(2,end))+...abs(angle r1.ans(3,end)*mu*force r1.ans(2,end))+...abs(angle r2.ans(2,end)*force r2.ans(2,end))+...abs(angle r2.ans(3,end)*mu*force r2.ans(2,end))+...abs(angle r3.ans(2,end)*force r3.ans(2,end))+...abs(angle r3.ans(3,end)*mu*force r3.ans(2,end))+...abs(angle r4.ans(2,end)*force r4.ans(2,end))+...abs(angle r4.ans(3,end)*mu*force r4.ans(2,end))+...abs(angle r5.ans(2,end)*force r5.ans(2,end))+...abs(angle r5.ans(3,end)*mu*force r5.ans(2,end))+...abs(angle r6.ans(2,end)*force r6.ans(2,end))+...abs(angle r6.ans(3,end)*mu*force r6.ans(2,end))+...abs(angle r7.ans(2,end)*force r7.ans(2,end))+...abs(angle r7.ans(3,end)*mu*force r7.ans(2,end))+...abs(angle r8.ans(2,end)*force r8.ans(2,end))+...abs(angle r8.ans(3,end)*mu*force r8.ans(2,end));

F weight=m box*9.81;fitness1=abs(F weight/F reaction y);

if (pos last vertbeam r.ans(2,1)<0.014 | | ...pos last vertbeam l.ans(2,1)>−0.014)

disp('Grippers beams hit upper edge!')parameters;fitness=100;

elseif (pos last vertbeam r.ans(2,1)<0 | | ...pos last vertbeam l.ans(2,1)>0)

disp('Gripper crosses beam elements!')parameters;fitness=50;

elseif (pos tip r.ans(2,1)<pos tip l.ans(2,1))disp('Gripper crosses tip elements!')parameters;fitness=70;

elseif (pos last vertbeam r.ans(3,end)>=−0.09+0.028−0.006 | | ...pos last vertbeam l.ans(3,end)>=−0.09+0.028−0.006)

disp('Gripper not low enough position to lift')parameters;fitness=70;

elseif fitness1==Infdisp('Gripper does not touch object!!')fitness=50;

Page 66: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 58

elseparameters;fitness=abs(F weight/F reaction y);

end

endend

A.3.4 Implementation of a Timer

I implemented a timer in the fitness function that punishes the gripper model evenif the simulation takes too long, i.e. the computing effort is too big. This fitnessfunction was used during the phase of increasing the simulation performance.The fitness function isn’t very effective for the optimization task: A simulation thattakes long often yields to a high fitness value. Punishing these cases can discardgood solutions. The only advantage is that the optimization process cannot getstuck, even if a single simulation would.

function [fitness] = fitness cylrw timer(parameters)

warning('off')

% −−−−−−−−−−−−−−−−− Initialize parameters for simulation−−−−−−−−−−−−−−−−−−for q=1:1%% General Paramaters that are needed for modelparameters=load('parameters');

evalin('base','rho = 0.98*1e−3'); % [g/mmˆ3]evalin('base','h = 0.7'); % [cm]evalin('base','E = 8.9e6'); % [N/mˆ2] Young's modulus HMAevalin('base','b = 0.01'); % damping coefficientevalin('base','alpha = 15'); % [degree]evalin('base','beta = 60');evalin('base','angle beam=7');

%% Top% Upper Beamevalin('base','l 1 = (11/7)*1.21'); % [mm]evalin('base','w 1 = 1.4'); % [mm]evalin('base','m 1 = l 1*w 1*h*rho'); % [g]evalin('base','I z1 = 1/12*0.01*h*(0.01*w 1)ˆ3'); %[mˆ4]evalin('base','k 1 = E*I z1/(0.01*l 1)'); %spring [N*m/rad]evalin('base','k=k 1');evalin('base','J 1 = 1');

%% Left Beam = Right Beamevalin('base','l 2 = 2*2.172'); % [mm]evalin('base','w 2 = 1.4'); % [mm]evalin('base','m 2 = l 2*w 2*h*rho'); % [g]evalin('base','I z2 = 1/12*0.01*h*(0.01*w 2)ˆ3'); %[mˆ4]evalin('base','k 2 = E*I z2/(0.01*l 2)'); %spring [N*m/rad]evalin('base','J v = 1');

%% Tipevalin('base','l 3 = 3.172'); % [mm]evalin('base','w 3 = 0.4'); % [mm]evalin('base','m 3 = l 2*w 3*h*rho'); % [g]evalin('base','I z3 = 1/12*0.01*h*(0.01*w 3)ˆ3'); %[mˆ4]

Page 67: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

59 A.3. Fitness Function

evalin('base','k 3 = E*I z2/(0.01*l 3)'); %spring [N*m/rad]evalin('base','J 3 = 1');

evalin('base','r = 0.06'); % [mm] blend tip

%% Data of groundevalin('base','k Ground = 100000'); % [N/m] 10000evalin('base','b Ground = 0'); % [Ns/m] 50evalin('base','mu Ground = −0.72');evalin('base','c = 1e−8'); % [m/s]

%% Translation of the robotevalin('base','v=0.008'); %[m/s]evalin('base','C=0.03'); %[m] distance of robot's translation of the GBEevalin('base','T=C/v'); %[s]

%% Cylinderevalin('base','m cyl=10');%gr %[kg]evalin('base','R cyl=0.5*0.0472'); %[m] radiusevalin('base','R cyl cm=1000*R cyl'); %[mm]evalin('base','pos ground=0.09'); %[m]evalin('base','d cyl=pos ground−R cyl');evalin('base','n upper=5');evalin('base','n vert=5');evalin('base','n tip=3');

end%% define which parameter of ga optimization is which

evalin('base','l 1=parameters(1)');evalin('base','w 1=parameters(2)');evalin('base','l 2=parameters(3)');evalin('base','w 2=parameters(4)');evalin('base','l 3=parameters(5)');evalin('base','w 3=parameters(6)');evalin('base','alpha=parameters(7)');evalin('base','beta=parameters(8)');

% Simulation time%SimTime=7;

load system('Gripper cyl 2012a withangles realw');%run simulation to get data needed to calculate fitness functiontime check=0;time limit1=300;time limit2=400; %total time limit is 700sstopped=char('stopped');running=char('running');set param('Gripper cyl 2012a withangles realw', 'SimulationCommand',...

'start')for i=1:1

pause(time limit1)status=get param('Gripper cyl 2012a withangles realw', ...

'SimulationStatus');if status==stopped

time check=0.5;break

endpause(time limit2)status=get param('Gripper cyl 2012a withangles realw', ...

'SimulationStatus');if status==running

set param('Gripper cyl 2012a withangles realw', ....'SimulationCommand', 'stop')

time check=1;fitness=40;

Page 68: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 60

disp('computing effort was too big!!')else time check=0.5;end

end

if time check==0.5

%Get Data from simulationforce l1 = load('force l1.mat');force l2 = load('force l2.mat');force l3 = load('force l3.mat');force l4 = load('force l4.mat');force l5 = load('force l5.mat');force l6 = load('force l6.mat');force l7 = load('force l7.mat');force l8 = load('force l8.mat');force r1 = load('force r1.mat');force r2 = load('force r2.mat');force r3 = load('force r3.mat');force r4 = load('force r4.mat');force r5 = load('force r5.mat');force r6 = load('force r6.mat');force r7 = load('force r7.mat');force r8 = load('force r8.mat');angle r1 = load('angle r1.mat');angle r2 = load('angle r2.mat');angle r3 = load('angle r3.mat');angle r4 = load('angle r4.mat');angle r5 = load('angle r5.mat');angle r6 = load('angle r6.mat');angle r7 = load('angle r7.mat');angle r8 = load('angle r8.mat');angle l1 = load('angle l1.mat');angle l2 = load('angle l2.mat');angle l3 = load('angle l3.mat');angle l4 = load('angle l4.mat');angle l5 = load('angle l5.mat');angle l6 = load('angle l6.mat');angle l7 = load('angle l7.mat');angle l8 = load('angle l8.mat');

pos last vertbeam r = load('pos last vertbeam r.mat');pos last vertbeam l = load('pos last vertbeam l.mat');pos tip l = load('pos tip l.mat');pos tip r = load('pos tip r.mat');

%Trackable2 = load('Trackable2.mat');

F reaction y=abs(angle l1.ans(2,end)*force l1.ans(2,end))+...abs(angle l1.ans(3,end)*force l1.ans(3,end))+...abs(angle l2.ans(2,end)*force l2.ans(2,end))+...abs(angle l2.ans(3,end)*force l2.ans(3,end))+...abs(angle l3.ans(2,end)*force l3.ans(2,end))+...abs(angle l3.ans(3,end)*force l3.ans(3,end))+...abs(angle l4.ans(2,end)*force l4.ans(2,end))+...abs(angle l4.ans(3,end)*force l4.ans(3,end))+...abs(angle l5.ans(2,end)*force l5.ans(2,end))+...abs(angle l5.ans(3,end)*force l5.ans(3,end))+...abs(angle l6.ans(2,end)*force l6.ans(2,end))+...abs(angle l6.ans(3,end)*force l6.ans(3,end))+...abs(angle l7.ans(2,end)*force l7.ans(2,end))+...abs(angle l7.ans(3,end)*force l7.ans(3,end))+...

Page 69: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

61 A.3. Fitness Function

abs(angle l8.ans(2,end)*force l8.ans(2,end))+...abs(angle l8.ans(3,end)*force l8.ans(3,end))+...abs(angle r1.ans(2,end)*force r1.ans(2,end))+...abs(angle r1.ans(3,end)*force r1.ans(3,end))+...abs(angle r2.ans(2,end)*force r2.ans(2,end))+...abs(angle r2.ans(3,end)*force r2.ans(3,end))+...abs(angle r3.ans(2,end)*force r3.ans(2,end))+...abs(angle r3.ans(3,end)*force r3.ans(3,end))+...abs(angle r4.ans(2,end)*force r4.ans(2,end))+...abs(angle r4.ans(3,end)*force r4.ans(3,end))+...abs(angle r5.ans(2,end)*force r5.ans(2,end))+...abs(angle r5.ans(3,end)*force r5.ans(3,end))+...abs(angle r6.ans(2,end)*force r6.ans(2,end))+...abs(angle r6.ans(3,end)*force r6.ans(3,end))+...abs(angle r7.ans(2,end)*force r7.ans(2,end))+...abs(angle r7.ans(3,end)*force r7.ans(3,end))+...abs(angle r8.ans(2,end)*force r8.ans(2,end))+...abs(angle r8.ans(3,end)*force r8.ans(3,end));

m cyl=10;F weight=m cyl*9.81;if (pos last vertbeam r.ans(2,1)<0 | | pos last vertbeam l.ans(2,1)>0)

disp('Gripper crosses beam elements!')parameters;fitness=50;

elseif (pos tip r.ans(2,1)<pos tip l.ans(2,1))disp('Gripper crosses tip elements!')parameters;fitness=50;

elseparameters;fitness=abs(F weight/F reaction y);

endend

if fitness==Infdisp('Gripper doesnt touch object')fitness=50;

end

end

Page 70: Design Optimization of Robotic Body Extension with …divf.eng.cam.ac.uk/birl/pub/Main/Publications/BT_CavolinaG2013.pdf · Design Optimization of Robotic Body Extension ... robotic

Appendix A. MATLAB Code 62