shape optimization of a curved beam hopping...

77
Prof. Dr. Fumiya Iida Master-Thesis Supervised by: Author: Nandan Maheshwari Dominik Naef Xiaoxiang Yu Murat Reis Shape Optimization of a Curved Beam Hopping Robot Autumn Term 2012

Upload: nguyendieu

Post on 02-Mar-2018

232 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Prof. Dr. Fumiya Iida

Master-Thesis

Supervised by: Author:Nandan Maheshwari Dominik NaefXiaoxiang YuMurat Reis

Shape Optimization of aCurved Beam Hopping

Robot

Autumn Term 2012

Page 2: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam
Page 3: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Acknowledgments

I would like to express the deepest appreciation to Prof. Fumiya Iida who enabledme to work independently and to suggest and fullfil my own ideas. He always foundtime for a constructive discussion and was an important motivater.

I would also like to thank my suppervisers Nandan Maheshwari, Xiaoxiang Yuand Murat Reis for their patient, inspirational and proficient support throughoutmy entire work.

This thesis is dedicated to my parents Regula and Thomas Naf for their endlesslove, support and encouragment.

i

Page 4: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Contents

Abstract v

Symbols vii

1 Introduction 1

2 The Curved Beam Hopping Robot 32.1 The main idea of a Curved Beam Hopping Robot . . . . . . . . . . . 3

2.1.1 Free vibration modes of a curved beam . . . . . . . . . . . . 32.1.2 Hopping principle . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2 The design of the robot . . . . . . . . . . . . . . . . . . . . . . . . . 62.2.1 Curved Beam . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2.2 Foot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2.3 Additional weight . . . . . . . . . . . . . . . . . . . . . . . . 82.2.4 Actuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3 The Simulation 93.1 SimMechanics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2 Existing Simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.3 The model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.3.1 General design . . . . . . . . . . . . . . . . . . . . . . . . . . 113.3.2 The foot and the Ground Contact Model . . . . . . . . . . . 113.3.3 The curved beam . . . . . . . . . . . . . . . . . . . . . . . . . 153.3.4 Actuation and control . . . . . . . . . . . . . . . . . . . . . . 173.3.5 Visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.3.6 Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.3.7 Outputs of the simulation . . . . . . . . . . . . . . . . . . . . 203.3.8 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.4 Problems during the implementation of the simulation . . . . . . . . 21

4 System Identification 224.1 The choice of a criterion to fit . . . . . . . . . . . . . . . . . . . . . . 224.2 Data observation in the real world . . . . . . . . . . . . . . . . . . . 234.3 The selection of a suitable model . . . . . . . . . . . . . . . . . . . . 234.4 The parameter estimation . . . . . . . . . . . . . . . . . . . . . . . . 234.5 The model validation . . . . . . . . . . . . . . . . . . . . . . . . . . . 254.6 Summary of the system identification . . . . . . . . . . . . . . . . . . 26

5 The Optimization 285.1 The optimization problem . . . . . . . . . . . . . . . . . . . . . . . . 285.2 The Genetic algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . 29

5.2.1 Introduction to the Genetic Algorithm . . . . . . . . . . . . . 295.2.2 Implementation in MATLAB . . . . . . . . . . . . . . . . . . 30

ii

Page 5: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

5.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325.3.1 Methodology to show the increase of the performance . . . . 335.3.2 Methodology to show the repeatability of the results . . . . . 335.3.3 Methodology to validate the optimization results . . . . . . . 33

5.4 Problems during the implementation of the optimization . . . . . . . 335.4.1 Simulation problems . . . . . . . . . . . . . . . . . . . . . . . 335.4.2 Real world problems . . . . . . . . . . . . . . . . . . . . . . . 34

6 Results 366.1 Increase of the performance in the simulation . . . . . . . . . . . . . 366.2 Repeatability of the optimization results . . . . . . . . . . . . . . . . 386.3 Validation of the optimization in the real world . . . . . . . . . . . . 39

7 Analysis of the results 417.1 Analysis of the increase of the performance in the simulation . . . . 417.2 Analysis of the results of the repeatability . . . . . . . . . . . . . . . 427.3 Analysis of the optimization results in the real world . . . . . . . . . 42

8 Conclusion 43

9 Future Work 44

A The SimMechanics Simulation 45A.1 The model hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . 45A.2 Model overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46A.3 Actuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47A.4 Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48A.5 Curved Beam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49A.6 Ground Contact model . . . . . . . . . . . . . . . . . . . . . . . . . . 51A.7 DC-motor model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

B The parameter-file 55

C OptiTrack data Handling 57

D Parameter estimation with a fmincon algorithm 61

E The optimization function 63

Bibliography 67

iii

Page 6: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

iv

Page 7: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Abstract

A curved beam hopping robot makes use of elastic and energy conserving materialsby stimulating the different free vibration modes of a curved beam. This stimulationcan result in different deflection patterns and therefore in different walking andrunning gaits. Since these dynamic robots are not trivial to understand and design,this work offers an approach on how to obtain an optimal shape of a curved beamhopping robot. In order to do so, a model of the robot and its environment wascreated in MATLAB SimMechanics. The simulation was validated by showing thatthe same resonance frequencies can be found in the simulation, as well as in thereal world experiments, and the hopping behavior looked very much alike. In anext step, the shape of the robot was optimized in the simulation with a geneticalgorithm. It could be shown in the real world that the performance of the robot wasincreased significantly and that this design approach offers a promising alternativeto existing approaches.

v

Page 8: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

vi

Page 9: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Symbols

Symbols

ζL Longitudinal resonance frequency

ζT Torsional resonance frequency

ω Actuation speed

MB The weight of the foot

LB The length of the foot

BB The width of the foot

IB Inertial of the foot calculated from the mass and the dimensions

LLegN Length of an increment of the curved beam

LOrig Origin of the curved beam relative to the CG of the foot in x-direction

α0...15 Angels between the increments of the curved beam, depending on the shape

mLegN Mass of an increment

ILegN Inertia of an increment

kLegN Spring stiffness between the increments

dLegN Damping rate between the increments

kT Spring stiffness between the foot and the beam

dT Damping rate between the foot and the beam

MT Mass of the increment at point T

IT Inertia of the increment at point T

MR Rotating mass

LR Radius of the rotating mass

MRArm Mass of the arm of the rotating mass

µslide Sliding friction coefficient

µstick Static friction coefficient

vth Velocity threshold for the JSA

kz Spring constant for ground reaction force

dz Damping rate for ground reaction force

ky Spring constant for ground reaction force

dy Damping rate for ground reaction force

g Gravity vector

Acronyms and Abbreviations

ETH Eidgenossische Technische Hochschule

vii

Page 10: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

CBHR Curved Beam Hopping robot

VRML Virtual Reality Modeling Language

CG Center of Gravity

CS Coordinate system

GCM Ground contact model

JSA Joint-Stiction-Actuator

FFT Fast Fourier Transformation

GA Genetic Algorithm

viii

Page 11: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 1

Introduction

In recent years, energy efficiency played a bigger and bigger role in the context ofrobotic walking and hopping locomotion. In nature it can be seen, that high en-ergy efficiency can only be achieved by the exploitation of elastic components, suchas tendons in animals. In the world of mechanics this can be achieved by usingmechanical springs or other elastic forms such as rubber bands or curved beams.The latter is used in a new approach which is studied mainly at the Bio-InspiredRobotics Lab. A Curved Beam Hopping Robot (CBHR) consists of an aluminum(or other elastic material) beam, which is actuated by an electric DC-motor witha rotating mass (see figure 2.1a). When actuated at the right frequency, the freevibration modes of the curved beam can induce a stable forward locomotion.

The advantages of this type of robots are various. First, due to the capabilityto recuperate the energy at impact, the low damping rate of the curved beam andthe low degree of actuation, these robots are very energy efficient. In [1] it is shownthat a specific resistance of down to 0.2 can be achieved using the right settings,which is very good for a hopping robot. Other great advantages are its low materialcosts and their small technical requirements in the construction. A CBHR can bebuilt within one day and at very low costs.

On the other hand there’re also some drawbacks: Since the hopping behaviorsof these robots depend on a wide range of different parameters (such as shape ofthe curved beam, size of the foot, mass of the foot, mass of the curved beam, rotat-ing mass, rotating speed, et cetera), they are still not fully understood. A betterknowledge is crucial mainly for increasing the controllability of these robots and forcreating a more straightforward design strategy. The shape of the curved beam -as a major factor influencing the performance of the robot - cannot be determinedin an analytical way.

This work focuses on the introduction of a new approach to design the shape ofthe curved beam in an optimal way; for a discussion of the other design parametersplease revere to [1], [2] and [3]. The design approach presented in this thesis isbased on a SimMechanics simulation of the hopping robot, which is optimized by aGenetic Algorithm. Previous studies ([1]) described the shape of the curved beamwith the two Parameters dh and L0 and the curvature ratio e = dH/L0, as shown infigure 2.1b. This simplification allows us to make basic predictions of the hoppingbehavior of variably shaped curved beams. It enables us also to build a simplesimulation of the hopping robot. However, it does not provide enough informationto make a profound statement about the behavior of the robot or even to build thecurved beam based on this prediction. For a more detailed description of the shape

1

Page 12: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 1. Introduction 2

a more sophisticated model is needed. A possible approach is shown in this workin chapter 3. The model used in the simulation is optimized at a certain actuationspeed by using a Genetic Algorithm.

This work is structured as follows: In Chapter 2, a brief description of the CBHR isprovided and its basic features are mentioned. In Chapter 3 the model of our robot- as used in the simulation - and its key parameters are introduced. The approachand the results for the system identification are provided in Chapter 4. In Chapter5 the optimization approach is presented and different factors that influence theshape of the curved beam are offered. In Chapter 6, the results are presented. Thework is summed up with a brief discussion and a conclusion in the Chapters 7 and8.

Page 13: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 2

The Curved Beam HoppingRobot

2.1 The main idea of a Curved Beam HoppingRobot

To be able to optimize the shape of the curved beam of a Curved Beam Hoppingrobot, first, the robot itself had to be examined and understood. For that matter arobot was built in the real world.

The main idea of creating a CBHR (as shown in 2.1a) is to build a very energyefficient hopping robot. This goal is reached by using the free vibration modes of acurved beam in a way that they amplify a motion induced by a rotating mass aroundthe top point T of the beam (see figure 2.1b). Ideally, the actuation stimulates thecurved beam in a way that induces an Up-And-Down motion of the top point T.The Up-And-Down motion is created with the help of the centripetal forces of arotating mass. To make sure that these centripetal forces induce a Up-And-Downmotion it is crucial to understand the importance of the free vibration modes of thecurved beam.

2.1.1 Free vibration modes of a curved beam

The two most important vibration modes are the torsional oscillation mode andthe longitudinal oscillation mode. For investigating these two oscillation modes,the real world robot was fixed to the ground and actuated at different rotationalspeeds. The torsional oscillation mode occurred at a motor speed of approximately7 rad/s and shows a back and forth rocking of the point T. The second, longitudinaloscillation mode occurred at around 19 rad/s and shows a Up-And-Down motion ofthe point T. The motion of the point T at the two resonance frequencies is shownin figure 2.2. It can be seen that the motion of the point T is strongly dependenton the actuation speed.Even though these frequencies can be found easily in the real world experiments,the analytical determination is very difficult since the correlation of the parametersis very high. In [1] it is shown, that the main parameters influencing the resonancefrequencies include the mass at the top MT , the length L0 and the stiffness of thebeam. The latter two are strongly affected by the shape of the beam.

To achieve a stable forward hopping - in our case - mainly the second oscillationmode is used.

3

Page 14: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 2. The Curved Beam Hopping Robot 4

(a) Photograph of the Curved BeamHopping Robot used.

(b) Abstracted Robot with key pa-rameters denoted.

Figure 2.1: Two representations of the robot used in this work.

Figure 2.2: Torsional and longitudinal oscillation of point T at resonance frequenciesone and two.

Page 15: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

5 2.1. The main idea of a Curved Beam Hopping Robot

Figure 2.3: The different phases of a Curved Beam Hopping Robot when hopping.

2.1.2 Hopping principle

When the Up-And-Down motion is strong enough, the robots foot is able to liftoff from the ground so that the locomotion can be divided in a flight and a stancephase. To get the robot airborne, the centripetal force in vertical direction andthe force exerted by the energy stored in the curved beam added together must begreater than the weight force of the whole robot:

Fcent. + FBeam > GM

where Fcent. is the centripetal force, FBeam is the force exerted by the beam andGM is the gravity force of the whole robot. The centripetal force is calculated as

Fcent. = MR ∗ LR ∗ ω2

with MR as the rotating mass, LR the radius of the rotating mass and ω as therotational speed. The force FBeam can be approximated by a spring force, to getan idea of the amplitudes:

FBeam = kBeam ∗ ∆L

where kBeam is the approximated spring stiffness and ∆L is the deflection from theoriginal spring length. This approximation is only used here to get a basic under-standing of the phenomena appearing. For further discussion please refer to [1].

Since in the creation of our robot the rotational mass is kept as low as possible,the robot can only hop when the rotational speed of the rotating mass and thelongitudinal free vibration mode coincide, as shown in figure 2.3. In the figure, thesolid line shows the curved beam in action and the dashed line shows the curvedbeam in its initial position. The green arrows represent the forces acting upon thepoint T and the red arrows show the velocities of the point T and the point B. Therotating mass rotates clockwise.

1. In the first phase, the centripetal force is pointing downwards, which causesthe point T to move downwards and therefore to tension the curved beam.The energy that would have been lost without an elastic element is stored aspotential energy in the beam.

Page 16: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 2. The Curved Beam Hopping Robot 6

2. After point T has reached its lowest position, it starts to move upwards again.At the same time the centripetal force starts to point up and the energy storedin the beam is released by inducing an ascending force on point T as well.

3. In the third phase, the robot gets airborne. The centripetal force and theenergy stored in the curved beam accelerated the point T and the curvedbeam in an extend, that allows the robot to lift off. Even though the forcecoming from the beam gets negative, the still acting centripetal force and theinertia of the bodies in motion are enough to cause this phenomena to happen.

4. In the fourth phase, the robot has reached its apex height and starts to descendagain until it reaches the ground. Thanks to the elastic structure of the curvedbeam, the kinetic energy is not lost at touch down. Instead it is to a greatpart converted back to potential energy.

2.2 The design of the robot

In figure 2.1a the robot used in this work is presented. As can be seen, it is a verysimple design consisting only of 4 major parts: The foot, the curved beam, theDC-motor and some additional weight at the top. The design is based on previousstudies which can be found in [1] and [3]. For reasons of reusability and to facilitatethe assembly of the robot, the individual parts were held together with hot meltadhesive (HMA). More details on the design of the individual parts can be foundin the following subsections.

2.2.1 Curved Beam

The most difficult part of the design is the curved beam. Since the behavior of thecurved beam and the exact influence of its design parameters is not fully under-stood, no reliable design strategy is existing so far. That’s why a new approach ispresented in this work. Nevertheless, some basic statements on its design can bemade.

Since a great part of the mass of the robot is located at point T, it is importantto make sure that this point lays above the foot stance of the robot in its initialcondition. Otherwise the system flips over immediately. Since the curved beam ishighly elastic, it is important that this point can’t move to far out of this comfortzone, because the stability of the robot in dynamic conditions is still very limited.As well as the horizontal position, the vertical position of point T is important.On one hand, the higher this point lays the less stable the robot is. On the otherhand, a higher position of this point benefits higher hopping heights. Already verysmall changes of this position can lead to big differences in the hopping behaviorconcerning the hopping speed, hopping height but also the hopping stability.

The shape of the curved beam itself should be chosen in a way that the first vibra-tion modes are clearly distinguishable. Depending on how the shape is chosen, thefrequencies where the free vibration modes lay can be influenced strongly. This willbe shown in Chapter 6.

The curved beam was made of aluminum, had a total length of 0.615 m and aweight of 0.055 kg.

To be able to design the beam and to quantify the shape in a reliable way, first,

Page 17: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

7 2.2. The design of the robot

Figure 2.4: The shape of a Curved Beam Hopping robot represented with 5 incre-ments and 5 angles.

a meaningful representation of the shape is needed. In earlier studies, the simpli-fication with the parameter e = dH/L0 was used, consisting of the parameters dhand L0 as mentioned in Chapter 1. For our purpose a more sophisticated depictionwas needed, since even curved beams with same values for e, dh and L0 can havetheir free vibration modes at completely different frequencies. Here fore, the curvedbeam was divided in several increments of given length Linc. The angles betweeneach pair of increments are used to describe the shape. The length of the incrementsare chosen in a way that all the increments added up are equal to the length of thecurved beam.

Linc = LBeam/Ninc

In figure 2.4 a two dimensional example with four increments and the accordingangles α0 to α4 is shown. In our work, only two dimensional representation is used.With this representation we were able to describe the shape of the curved beam inas much detail as needed. By only using two dimensional shapes, it was possible toobtain the shape from a photograph with relatively small effort. The more incre-ments that are chosen, the more detailed is the depiction, yet the more additionalexpenditure was needed to get the angles.

2.2.2 Foot

The design of the foot was very straightforward. The goal was to get the foot stanceas wide as possible but at the same time keep the weight as low as possible. Thiswas achieved by a combination of wood and aluminum. The final dimensions werea foot stance of 0.275 m times 0.248 m at a total weight of 0.058 kg.

Page 18: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 2. The Curved Beam Hopping Robot 8

2.2.3 Additional weight

Besides the curved beam itself, the weight of the point T on top of the curved beamwas the most important factor influencing the resonance frequencies of the curvedbeam. Previous work ([1]) showed that the heavier the mass at the top, the lowerthe resonance frequencies. A lower resonance frequency is more advantageous for ahigher hopping height and therefore a faster hopping speed, while at the same timecauses a more stable locomotion of the robot. On the other hand it adds additionalweight to the robot, so again a compromise had to be found. In our robot we choseto put the additional weight of one battery at the top of the robot, also to showthat the robot could function without an external power source. The total weightof the gearbox, the DC-motor and the additional weight added up to 0.088 kg.

2.2.4 Actuation

For the actuation of our model a simple FA130-RA DC-motor was used in com-bination with a Tamiya gearbox with a gear ratio of 115:1. The gear ratio waschosen that high to get the rotational speed of the rotating mass as constant aspossible. Another possibility to achieve this would be to take a superior DC-motorlink with an encoder. Even though this option was considered, it would have beentoo complicated and too expensive for our purpose.

The DC-motor was linked to an external voltage source with no further controllers.For adjusting the rotational speed, the voltage was regulated manually, based on aspeed-voltage curve which showed the relationship between these two values.

Page 19: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 3

The Simulation

To be able to optimize the shape of the curved beam, a realistic simulation of thehopping robot is needed. This simulation has to fulfill some basic requirements:

• First of all, it has to represent the real world robot - especially the curvedbeam - in enough detail to be able to design the real world robot based onthe results of the optimization.

• Secondly, the representation should be accurate. Since already in the realworld, very small changes in the design can lead to big differences in thehopping behavior, these effects should be reproducible in the simulation aswell.

• The third, very important aspect is the computational effort. In the case ofan optimization, the simulation will be run many times. Therefore, a highcomputational time is disadvantage.

• Since this model is intended to be used beyond the studies of this thesis, thesimulation should be structured in an understandable way.

To be able to achieve the criteria mentioned above, we choose to use MATLABSimMechanics as our simulation environment. With MATLAB SimMechanics weare able to build the model in as much detail as needed and it is easily under-standable. Furthermore, the computational effort is within a reasonable frame andthe possibility to use MATLAB as an environment for the optimization is a greatadvantage.

3.1 SimMechanics

MATLAB SimMechanics is a Toolbox within the MATLAB Simulink environment.Whereas Simulink is built mainly to model, simulate and analyze multi domaindynamic systems in general, SimMechanics is explicitly developed to simulate me-chanical systems. These mechanical systems consist of rigid bodies connected byjoints, with the standard Newtonian dynamics of forces and torques. Whereas inSimulink the individual blocks represent mathematical operations or operate on sig-nals, a SimMechanic block represents a physical component or relationship directly.Like that we can build complex mechanical systems, without the need of formingthe equations of motion first.

To combine Simulink and SimMechanics models, special blocks are needed to feedthe signal from one domain to the other. These blocks are either actuation blocks

9

Page 20: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 3. The Simulation 10

Figure 3.1: The previous simulation and its visualizations.

(from Simulink to SimMechanics) or sensor blocks (from SimMechanics to Simulink).When sticking to this simple restriction, any Simulink block (including embeddedMATLAB functions) can be used in combination with SimMechanics. Exactly asin Simulink, it is possible to model systems with hierarchical subsystems, defineparameters externally and visualize the simulation with the help of the Virtual Re-ality Modeling Language (VRML) (see subsection 3.3.5).

In the SimMechanics toolbox, simple blocks for bodies, joints, sensors and actu-ators, constraints and drivers and force elements are included. Besides these simpleblocks there are also blocks with advanced functionality available, such as the ’Joint-Stiction-Actuator’ which will be discussed in more detail in subsection 3.3.2. TheSimMechanics toolbox is only one part of the physical modeling toolbox called Sim-Scape, but in this work we will be focusing solely on the mechanical modeling so itwill be the only one used here. An exception forms the modeling of the DC-motorwhich is discussed briefly in the subsection 3.3.4.

For additional information about MATLAB, Simlink and the SimMechanics toolboxplease consult [4] and [5].

3.2 Existing Simulations

Since these hopping robots have already been studied intensively at the Bio-InspiredRobotics Lab, there were already some simulations existing. The model used in thiswork is based on a previous simulation implemented by M. Reis. This model wasalso build in MATLAB SimMechanics and simplified the curved beam as a combi-nation of a torsion and a linear spring (see [1]). It was actuated with a rotatingmass rotating at a constant speed and was modeled 2 dimensional. In figure 3.1you can see the visualization of the robot in SimMechanics and in a separate handbuild visualization.

Page 21: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

11 3.3. The model

Even though this simulation delivered good results - once the right parameters werefound - there were several reasons why the implementation of a new simulation wasinevitable:

• The curved beam was simplified by a linear and a torsion spring. To make anexpressive prediction on the shape of the curved beam, this simplification isnot suitable.

• The model is simulated in 2 dimensions only.

• The ground contact model is not modeled in great detail. It allows the footto penetrate the ground too extensively.

• The inertias of the rigid bodies used is not realistic, since the rigid bodiesdon’t have similar shapes as the structures in the real world.

• The visualization could be done more attractively.

3.3 The model

3.3.1 General design

To model the Curved Beam Hopping robot in SimMechanics a 3 dimensional ap-proach was chosen. The real world robot should be represented as good as possible,that’s why for every major element of the real world robot, at least one rigid bodyblock was implemented with the same dimension, mass and inertia. The modelconsisted mainly of six parts. The foot and the ground contact model, the curvedbeam, the actuation, the animation, the visualization and an external parametersfile. The blocks for defining the output of the model and the blocks for the simu-lation environment and the solver options were implemented as well. An overviewof the model can be seen in figure 3.2. More detailed descriptions of the individualparts follow in the next subsections.

3.3.2 The foot and the Ground Contact Model

The first part described here is the foot of the robot and its ground contact model(GCM). Unlike in the real world, in the model the foot is represented as one rigidbody. The foot can be assumed as a rigid body since it doesn’t contribute to thehopping of the overall robot. It has the same dimensions as the foot in the realworld, the same mass and the same inertia.

Body Block: In figure 3.2 the foot is modeled by the red body called ’Foot’.By doubleklicking on this block a graphical interface appears where all the optionsconcerning this body can be defined (see figure 3.3). A brief description of theseoptions follows, representative for all the following body blocks:As can be seen there are first the entries for the mass and the inertia of the bodywhich are trivial. The next entries describe the ports that connect the foot to itsenvironment:

• CG: The block with the name CG describes the location of the Center ofGravity of this body block. You can see that the CG is not displaced relativeto the world, that means that the robots initial condition is at the origin of theworld coordinate system. As you can see in figure 3.2 this port is connectedto the ’ground’ and the ’machine environment’. The ’ground’ block is neces-sary to connect the model of the robot to its environment. In the ’machine

Page 22: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 3. The Simulation 12

Figure 3.2: An overview of the SimMechanics simulation.

Page 23: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

13 3.3. The model

Figure 3.3: Body block options shown at the example of the robots foot.

environment’ block the settings of the environment and the constraints areset (see subsection 3.3.6).

• CS5 to CS12: The coordinate systems 5 to 12 denote the 4 corners of therobots foot. The positions are described relative to the CG of the foot, whichlays in the middle of the foot. These 8 ports are connected to the groundcontact model (GCM) where the ground reaction forces are calculated andexerted on the body.

• CS13: The coordinate system 13 is linked to the curved beam. The displace-ment relative to the CG shows that the curved beam is not mounted in thecenter of the foot, but with a relative displacement of LOrig.

• CS14: The coordinate system 14 is again placed in the CG and is used tomeasure the position of the foot relative to the world coordinate system inorder to visualize the robot (see subsection 3.3.5).

The options concerning the orientation are discussed in the subsection 3.3.3.

Ground contact model: For calculating the ground contact forces the two greensubsystems called ’Ground Interaction Model’ were created. To minimize the com-putational effort the ground contact forces were calculated in each of the threedimensions in different ways.

In z-direction - which is the vertical direction - a soft contact model was chosenwith a linear spring damper system. The advantage of a compliant model against ahard contact model is that in a hard contact model a geometric constraint is used(i.e. the foot can’t penetrate the ground), which causes the system to lose a degreeof freedom. In the soft contact model on the other hand there is just an additionalforce acting upon the foot, but the equations of motion basically stay the same. Ontop of that a soft contact model as used in this work allows the body to bounce

Page 24: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 3. The Simulation 14

back from the ground, like in a certain degree is also happening in the real world.For a deeper discussion of the different types of GCM, please refer to [6], [7], [8],[9], [10] and [11].

The spring damper system used here was of the form

fz =

{−kzz − dz z if − kzz − dz z ≥ 0

0 else(3.1)

and was only applied for the case

z ≤ 0 . (3.2)

fz denotes the force in vertical direction, kz is the spring stiffness and dz the damp-ing rate. z represents the vertical position of the foot point and z the verticalvelocity. As can be seen, only forces acting in positive z-direction are allowed, sincewe want to avoid sticking forces which cause the model to stick to the ground. Theadvantage of this type of equation is its simplicity (only two additional parametershave to be defined) and its good representation of the reality. On the other handthe differential equation resulting from this method are very stiff and therefore verytime consuming to be calculated. On top of that, the forces acting upon the footin the moment of the touchdown are not continuous, which is not a good represen-tation of the reality.

The calculation of these forces were implemented by conventional MATLAB Simulinkblocks. To measure the position of the robots foot, a body sensor block from theSimMechanics library was used. To exert the force on the foot, an actuator blockwas taken. An overview of the implementation of the GCM can be found in theAppendix A.6.

In y-direction, a very similar, simple approach was chosen since this isn’t the mainlocomotion direction. Again a linear spring damper system of the form

fy = −kyy − dy y (3.3)

was implemented as can be seen in the Appendix A.6.

In x-direction a more elaborate approach has to be chosen since simpling and stic-tion is a fundamental part of the forward locomotion of the robot. To representthese two phenomena we have to be able to either apply a zero velocity constrainton the joint in case of stiction, or apply a friction force in case of slipping. Un-fortunately in MATLAB SimMechanics it is not possible to actuate one degree offreedom with a speed driven approach and with a force driven approach at the sametime, since redundant inputs would be the result. To solve this problem MATLABprovides a block with advanced functionality, the so called ’Joint-Stiction-Actuator’(JSA).

The JSA applies a friction force upon the joint primitive as long as the joint isunlocked. In the case of a locked joint, a zero velocity constraint is applied. Todistinguish between these two actions, the JSA has three discrete joint modes, ’un-locked’, ’locked’ and ’wait’.

• In the ’locked’ mode, the joint primitive gets restricted by a zero velocityconstraint and cannot move at all. This mode is activated as soon as thevelocity is smaller than a certain velocity threshold vth.

Page 25: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

15 3.3. The model

Figure 3.4: Joint stiction modes and transition condition from the MATLAB doc-umentation.

• In the ’unlocked’ mode the joint primitive moves with a kinetic friction ap-plied. To unlock a locked primitive first the ’wait’ mode must be activated.

• In the ’wait’ mode the joint primitive is still locked, but static computed forcein the joint exceeded the static friction threshold Fs. To make the transitionfrom the ’wait’ mode to ’unlock’ mode, a virtual velocity is calculated topredict the movement in case of an unlocked joint. If this velocity lays abovea certain threshold vth the joint translates to ’unlock’ mode.

A schematic visualization of these state transitions can be seen in figure 3.4. Theimplementation of the GCM in MATLAB SimMechanics can be found in the Ap-pendix A.6.

3.3.3 The curved beam

The representation of the curved beam in the simulation was a fundamental partof this work, since this was the component we wanted to optimize. The approachchosen was to divide the curved beam into a number of rigid bodies connected withtorsion spring damper systems. The beam was split into 16 rigid bodies, as is il-lustrated in figure 3.5. Between each pair of rigid bodies a torsion spring dampersystem was implemented with a rest position that corresponded to the angle betweenthe two increments in the initial shape. The angles were defined as the rotation ofone rigid body relative to its predecessor, as pictured in figure 2.4.

In figure 3.6 you can see two subsequent increments of the beam. As can be seenone increment consists of three standard blocks from the SimMechanics library. Inthe revolute block it was specified which degree of freedom is activated. Here onlythe rotation along the y-axis is possible, since we want the curved beam to be elasticalong this axis. In the ’joint spring and damper’ block only the spring constant klegand the damping coefficient dleg must be defined. In the body block the mass andthe inertia of the body were defined. On top of that, the location of the revolute

Page 26: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 3. The Simulation 16

Figure 3.5: Abstraction of the curved beam.

Figure 3.6: Two subsequent elements of the curved beam.

joints must be specified by introducing additional coordinate systems. By doing so,the dimensions of the increments and the initial angle between the two bodies weredefined as well. The relative rotation between the coordinate systems was definedby the rotation vector and the angle αn along this vector. We used the Euler X-Y-Z convention, all though we only used one rotational direction. The graphicalinterface to do so is pictured in figure 3.7.

The angles between the increments were named α1 to α15. The angle between thefoot and the first increment of the curved beam was named α0. The spring constantkleg and the damping rate dleg was set the same for all the spring damper systemsin the curved beam. The spring constant and the damping rate between the footand the first element of the curved beam were named kT and dT and were allowed

Figure 3.7: Body block options shown at the example of a beam increment.

Page 27: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

17 3.3. The model

to have a different value than the rest of the curved beam to increase the flexibilityin the System Identification. All the increments had the same length, mass andinertia for the sake of simplicity and due to the fact that the beam has a uniformstiffness. The number of 16 beam elements was chosen as a compromise betweenmodel accuracy and computational effort.

3.3.4 Actuation and control

For the actuation of the rotating mass three different options were existing: Aconstant speed control, a torque control and the control via a modeled DC-motor. Inthe following the three options were introduced and their pros and cons mentioned.

• Speed control. With this approach the rotating mass is always actuated witha constant angular velocity. This approach has various advantages: It is verysimple to implement and it is easy to measure and control. It is relativelyaccurate since in the real world the motor almost delivers a constant speedwhen connected to an ideal power source. Previous studies showed that theoscillation of the angular velocity in the real world is within a reasonableframe.

• Torque control. With this approach the rotating mass is actuated at an alwaysconstant torque. Again this method is very simple to implement, but it’s notas simple to control. On top of that it does not reflect the reality in a goodway, since a DC-motor does not deliver a constant torque at all.

• DC-motor model. With this approach the motor was modeled as a DC-motor(which was given in the MATLAB SimElectronics library) and some additionalblocks to convert the signal from a SimDriveline signal to a SimMechanics sig-nal. (The DC-motor model can be found in the Appendix A.7.) This approachwould have been the most realistic representation of the real world since allthe DC-motor specification and friction parameters could be defined. Butsince the DC-motors we used in the real world a very cheap, the specificationsheet of these engines was not very accurate. The internal parameters of theDC-motor would have needed to be found experimentally which would havegone beyond the scope of this thesis. On top of that the DC-motor modelturned out to be quite computationally expensive.

Due to the reasons mentioned above, we decided to actuate our model with aconstant speed control approach.

3.3.5 Visualization

The MATLAB SimMechanics environment offers three basic ways to visualize asimulation: A hand made animation based on the coordinates of the system (asused in the already existing simulation), the built in animation with only veryfew options and poor graphics and the integration of a Virtual Reality ModelingLanguage (VRML) world. Due to the better performance and the more elaboratepossibilities the approach via VRML toolbox was chosen.

VRML in MATLAB Simulink

VRML is a standard file format for the visualization of 3 dimensional vector graph-ics. Even though it was mainly designed for the world wide web it is also widelyused to visualize and verify dynamics systems in scientific projects. The animationis done by changing object properties such as position, rotation, shape and scale

Page 28: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 3. The Simulation 18

Figure 3.8: The model visualized in VRML.

during desktop or real-time simulation. The MATLAB Simulink 3D Animationtoolbox offers Simulink blocks to connect the virtual world with the model, a ’3DWorld Editor’ with a graphical interface to the VRML syntax, a video recordingfunction and a lot more.

With the ’3D World Editor’ VRML nodes can be assembled which are connectedto the Simulink environment. These nodes can specify aspects such as appear-ance, navigation, geometry, groups, interpolators, lights and sensors. For our use,mainly the geometry and the groups were interesting. In a ’Transform’ group allthe information about orientation, translation and scale could be handed over fromSimulink. With the geometry nodes the dimensions of the body parts visualizedcan be defined.

How was it used in the simulation

In the ’3D World Editor’ a virtual world was created consisting of geometry partsfor all the bodies defined in the SimMechanics model. These nodes were connectedwith the model using a ’VR Sink’ block. In this block all the nodes of the virtualworld created can be seen in the VRML Tree, and the nodes feeded with informa-tion from the model can be chosen. In our case the information handed over werethe dimensions of the bodies, the orientation and the translation. Furthermore asample time could be defined here, which was set to 0.01 s.

The dimensions of the bodies were calculated directly from the parameters fromthe parameter-file (see subsection 3.3.8). The information concerning the orienta-tion and translation were gained with the use of ’Body Sensor’ blocks and handedover with the help of ’Go To’ and ’From’ blocks.

A picture of the robot visualized in the VRML world can be seen in figure 3.8.

Page 29: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

19 3.3. The model

Figure 3.9: Solver hierarchy in a SimMechanics simulation from [4].

3.3.6 Solver

To run the simulation successfully the machine and the model-wide settings hadto be set. The model-wide settings were set by the definition of the settings ofthe Simulink Solver which controls the purely mathematical aspects of the sim-ulation. The SimMechanics software interprets the machine’s purely mechanicalaspects through machine assembly and a constraint solver. The two parts werecombined in a dynamic hierarchy, as can be seen in figure 3.9.

The machine settings are defined for each machine of the model individually andcontain the mechanical settings of the machine. They were implemented by the useof a ’Machine Environment’ block and are SimMechanics specific. Here the sim-ulation dynamics, machine dimensionality, gravity, tolerance, constraints, motionanalysis modes and visualization settings can be set. Following setting were chosen.

Page 30: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 3. The Simulation 20

Gravity vector [0 0 -9.81] Gravity acts in negative z-direction.

Machine dimensional-ity

3D Only

Analysis mode Forward dynamics We want to calculate the posi-tions and velocities of the bodiescontinuously based on the forcesacting upon them.

Linear assembly toler-ance

1e-3

Angular assembly tol-erance

1e-3

Constraint solver type Tolerancing Model stability is more impor-tant than accuracy.

Relative tolerance 1e-4Absolute tolerance 1e-4Redundant constrainttolerancing

Specify tolerance

Relative tolerance 1e-4State perturbationtype

Adaptive

Perturbation size 1e-5

The model-wide settings are defined in the Simulink Configuration Parameterdialog. The Solver options were set to:

Type Variable-step When the ground contact modelis active a much smaller Timestep is needed than in the flightphase.

Solver ODE45 (Dormand-Prince)

A relatively fast solver also forstiff differential equations.

Relative tolerance 1e-4Max step size autoMin step size 1e-4 Smaller step sizes can lead to a

very long simulation time.Absolute tolerance AutoInitial step size AutoShape preservation Disable all Enabling time preservation is

computationally expensive.

As can be seen, the settings were chosen in a way to get a fast and stable simulation.The model accuracy was not the major concern.

3.3.7 Outputs of the simulation

To be able to optimize the simulation with an external MATLAB function, wehad to specify which state variables were chosen as output. Since we were mainlyinterested in the hopping performance of the robot and not on its controllabilityor orientation, it was enough to hand over the position vectors of some points ofinterest. With the use of ’To File’ blocks we wrote out the positions of the CG ofthe foot, the position of the point T and the CG of the rotating mass every 1/120of a second in the world coordinate system. The data was stored in the files calledTrackable1, Trackable2 and Trackable3.mat.

Page 31: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

21 3.4. Problems during the implementation of the simulation

3.3.8 Parameters

To structure the model is understandable and modifiable as possible, all the pa-rameters used to define the body properties were specified in a separate m-file. Thevalues can be adjusted easily in this file and exported to the basic workspace, fromwhere the simulation could read them in. A full list of the parameters used can befound in the Appendix B. Their determination is discussed in the Chapter 4.

3.4 Problems during the implementation of thesimulation

During the implementation of the model several bigger problems occurred. Follow-ing a brief discussion of the main problems:

• The GCM was very tricky to implement to work stable. The loss of a degreeof freedom in the case of a locked joint causes the simulation to crash likely.The problem could be solved by choosing higher assembly tolerances and anODE45 solver. With other solvers, e.g. a ODE15s which would be betterfitted for solving stiff differential equations, the simulation does not work.

• The DC-motor simulation was very tricky to implement since different MAT-LAB toolboxes had to be combined. The right settings for the signal conver-sion were not at all trivial to find.

• In general it can be said that the smallest mistakes in the model can causethe simulation to crash or to deliver completely wrong results. A wrong de-termination of the inertia of the rotating mass for example caused a lot ofproblems, since it is really hard to spot the bug.

The most difficult part in the implementation was the determination of the param-eters used for the model. This determination will be discussed in the next chapter.

Page 32: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 4

System Identification

Once the model was created in MATLAB SimMechanics a system identificationapproach was needed to find the best fitted parameters for the model. Since therobot is build very similar compared to the real world, many parameters, such asthe dimensions or the masses of the individual bodies, could be determined experi-mentally, ergo no system identification was performed for these values. The systemidentification process mentioned below was necessary for the determination of thespring constants and the damping rates of the curved beam kLegN , dLegN , kT anddT .

In general, the system identification procedure is characterized by five basic steps:

• The choice of a criterion to fit.

• The data observation in the real world.

• The selection of a suitable model.

• The parameter estimation.

• The model validation.

The following sections will discuss the five steps mentioned adopted to our problem.

4.1 The choice of a criterion to fit

To determine the parameters mentioned above, we wanted to find the same behav-ior in the model as in the real world robot. Since the hopping behavior is stronglydepending on the occurrence of the free vibration modes, we implemented our sys-tem identification process based on this phenomena. The frequencies of the freevibration modes can be found easily in the real world robot. The goal was to showthat the same free vibration modes occur in the simulation and to define the pa-rameters in a way that they appear at the same frequencies as in the real world.Like that we are able to find the best suitable parameters for the stiffness of thecurved beam. To get reliable results, it was crucial to define the parameters for theshape of the curved beam first. To define the damping rates of the curved beam,we compared the amplitudes of the oscillation of point T. We did this comparisonat different frequencies, as can be seen in figure 4.4.

22

Page 33: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

23 4.2. Data observation in the real world

4.2 Data observation in the real world

As a second step, a reference data set from the real world had to be collected.We wanted to gain data reflecting the behavior of the curved beam actuated atresonance frequencies and also at other frequencies. To do so the real world robotwas fixed to the ground to facilitate experimental setup. We recorded data fromthe real world robot in motion with the help of a tracking system called OptiTrack.OptiTrack is an optical motion tracking system based on infrared cameras andpassive markers. Multiple markers are placed on rigid bodies which allows trackingall 6 degrees of freedom. In our case we located 4 markers at the foot, 2 markers atthe point T and 2 markers at the rotating mass. The tracked data is written every1/120 of a second and is stored in a .csv-file. The .csv-file was converted to an Excelfile which could be imported more easily to MATLAB. Once imported to MATLABthe data had to be structured and filtered, since the data included irregularities andglitches. The adaptation included following steps:

• First the data was restructured and the center of area of the rigid bodies wascalculated. An array resulted where the first entry denoted the time and theentries 2 to 10 the x-, y- and z-coordinates of the trackables.

• In a second step the coordinates of the trackables were translated to the origin.This was done by subtracting the median value of the first two seconds of therecording.

• In a third step the components with the value ’NaN’ (Not-a-Number) werereplaced by their forerunners.

• Next we got rid of unusually strange data. For that matter, each entry wascompared to its forerunner and the difference was calculated. When the dif-ference was above a certain threshold the entry was replaced by the value ofthe forerunner.

• In a last step a butterworth filter of order 10 was applied.

The data-handling algorithm can be found in the Appendix C. In figure 4.1 thebehavior of the point T when actuated at different frequencies is shown.

To be able to make a statement about the resonance frequencies, a Fast-Fourier-Transformation was performed on the data. The frequencies found for our robotwere at 1.3 Hz (8.2 rad/s motor speed) for the torsional oscillation and at 3.2 Hz(19.9 rad/s motor speed) for the longitudinal oscillation, as can be seen in figure4.2.

4.3 The selection of a suitable model

The model selected is described in full detail in Chapter 3. For the system identifi-cation, the model was fixed to the ground.

4.4 The parameter estimation

The parameter estimation turned out to be the most time consuming part of thesystem identification. Two different approaches were tried out to get the bestsuitable parameters.

Page 34: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 4. System Identification 24

−0.05 0 0.05 0.1 0.15 0.20

0.5Trajectory of point T at 8.2 rad/s

x [m]

z [m

]

0 2 4 6 8 100

0.5Vertical position of point T over time at 8.2 rad/s

time [s]

z [m

]

−0.05 0 0.05 0.1 0.15 0.20

0.5Trajectory of Point T at 19.9 rad/s

x [m]

z [m

]

0 2 4 6 8 100

0.5Vertical position of point T over time at 19.9 rad/s

time [s]

z [m

]

−0.05 0 0.05 0.1 0.15 0.20

0.5Trajectory of Point T at 10.4 rad/s

x [m]

z [m

]

0 2 4 6 8 100

0.5Vertical position of point T over time at 10.4 rad/s

time [s]

z [m

]

−0.05 0 0.05 0.1 0.15 0.20

0.5Trajectory of Point T at 12.5 rad/s

x [m]

z [m

]

0 2 4 6 8 100

0.5Vertical position of point T over time at 12.5 rad/s

time [s]

z [m

]

Figure 4.1: The oscillation of point T actuated at 8.2, 19.9, 10.4 and 12.5 rad/s.

0 2 4 6 8 10 12 14 16 18 200

5

10

15

20

25FFT at Torsional Resonance Frequency

Frequency [/s]

Am

plitu

de

0 2 4 6 8 10 12 14 16 18 200

5

10

15

20

25

30FFT at Longitudinal Resonance Frequency

Frequency [/s]

Am

plitu

de

Figure 4.2: The results of the FFT performed at the torsional and longitudinalresonance frequency.

Page 35: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

25 4.5. The model validation

7.58.5

9.510.5

11.5

10

11

12

13

142.6

2.8

3

3.2

3.4

3.6

kLegN [Nm/rad]

k_{LegN}: 9.5k_{T}: 12Frequency: 3.066

Frequencies of free vibration modes vs. spring stiffnesses

kT [Nm/rad]

Fre

q. [H

z]

Figure 4.3: Correlation between the parameters kLegN and kT and the longitudinalfree vibration mode.

• After a first brief estimation of the magnitude of the parameters, a mini-mization problem was created. Different approaches were tried with a non-linear least-squares algorithm (’lsqnonlin’), unconstraint nonlinear optimiza-tion (’fminsearch’) and a constraint nonlinear optimization (’fmincon’). Eventhough slight enhancements could be noted - most of all with the ’fmincon’algorithm - satisfying results could not be found. The main problems for thatwere the definition of the target functions and the high computational effortof the problem. An example where the ’fmincon’ algorithm was used can beseen in Appendix D.

• The parameters optimization by hand tuning turned out to be more straightforward and more efficient than the automated one. The resonance frequenciesfound in the real world were achieved by adjusting the values for kLegN and kT .This task was simplified by the fact that the parameter kT mainly influencesthe torsional resonance frequency and the parameter kLegN mainly influencesthe longitudinal resonance frequency. In figure 4.3 the correlations betweenthe parameters kLegN and kT and the longitudinal resonance frequency areillustrated. Due to the limited amount of data points stored, the resolution ofthe FFT is relatively poor. Nevertheless, it can be seen that the face is a lotsteeper along the kLegN -axis. The best suitable values found were kLegN = 9.5and kT = 12 Nm/rad.To find the values of the parameters dLegN and dT , the amplitude of theoscillation of the point T was observed at different frequencies. In figure 4.4the amplitudes at different motor speeds are shown. As can be seen, theamplitudes match pretty well, except when actuated close to the resonancefrequencies. This might be due to the non-linearity of the elasticity of thebeam in the real world. The best parameters found were dLegN = 0.003 andkT = 0.03 Nm/rads.

4.5 The model validation

The parameters found were validated by looking at the hopping model. The robotwas simulated with the parameters found and the trajectories of the points of in-terest were compared with the real world robot. In figure 4.5 you can see the

Page 36: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 4. System Identification 26

0 2 4 6 8 100.2

0.3

0.4Oscillation of point T actuated at 11.3 rad/s in real world

time [s]

z [m

]0 2 4 6 8 10

0.2

0.3

0.4Oscillation of point T actuated at 11.3 rad/s in simulation

time [s]

z [m

]

0 2 4 6 8 100.2

0.3

0.4Oscillation of point T actuated at 13.2 rad/s

time [s]

z [m

]

0 2 4 6 8 100.2

0.3

0.4Oscillation of point T actuated at 13.2 rad/s in simulation

time [s]

z [m

]

0 2 4 6 8 100.2

0.3

0.4Oscillation of point T actuated at 16.0 rad/s

time [s]

z [m

]

0 2 4 6 8 100.2

0.3

0.4Oscillation of point T actuated at 16.0 rad/s in simulation

time [s]

z [m

]

0 2 4 6 8 10

0.2

0.3

0.4

Oscillation of point T actuated at 18.8 rad/s

time [s]

z [m

]

0 2 4 6 8 10

0.2

0.3

0.4

Oscillation of point T actuated at 18.8 rad/s in simulation

time [s]

z [m

]

Figure 4.4: The oscillation in vertical direction of point T vs. time. On the left sidethe data from the real world robot, on the right side the results from the simulation.

comparison of the two. On the top you can see the trajectory of the hopping robotin the real world and on the bottom you can see the trajectory obtained from thesimulation.

By comparing the two hopping behaviors, the ground contact parameters couldbe adjusted to complete the model.

4.6 Summary of the system identification

From the results shown above you can see that the model created in this workcorrelates nicely with the real world robot. The behavior and the motion of thecurved beam - especially of the point T - match very well. The hopping speed andthe hopping height are similar, albeit not exactly the same. The differences canhave multiple causes. One possible reason are inaccuracies in the ground contactmodel. Another one is the non-linear behavior of the curved beam in the real worldrobot, which is modeled by linear spring damper system. That latter would explainwhy the differences are bigger the greater the amplitudes of the oscillations are.Nevertheless, qualitatively the model matches very well and is sufficient for ourpurpose.

Page 37: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

27 4.6. Summary of the system identification

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7−0.01

0

0.01

0.02

0.03

0.04

0.05Hopping robot actuated at 17 rad/s in real world

x [m]

z [m

]

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7−0.01

0

0.01

0.02

0.03

0.04

0.05Hopping robot actuated at 17 rad/s in the simulation

x [m]

z [m

]

Figure 4.5: On the top: The hopping behavior of the robot in the real world. Below:The hopping behavior in the simulation.

Page 38: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 5

The Optimization

As mentioned earlier, the hopping behavior of a curved beam hopping robot de-pends on a wide range of different factors. To simplify the problem, here only theoptimization of the shape of the curved beam is investigated, meanwhile all theother parameters were set constant. The shape of the curved beam was chosenbecause it is a major part of the robot, but at the same time not fully understoodyet.

5.1 The optimization problem

The goal of our optimization is to change the angles α0...15 between the incrementsin a way that the performance of the curved beam increases. We start of at a set ofpredefined initial angles which already induce some hopping behavior and we endup with a better final shape of the curved beam. The performance of the curvedbeam can be described in many different ways, such as energy efficiency, stability,hopping height or hopping distance. In this work only the latter one is examined.The goal is to hop as far as possible within 10 seconds without falling over. Theoptimization problem was defined as follows.

Objective function: Increase the hopping speed of the robot, i.e. hop as far aspossible within 10 seconds. To reformulate it as a minimization problem:

f(α) = a− x10s for i = 0...15 (5.1)

x10s is the position of the CG of the foot of the robot after 10 seconds of hopping.a is some value greater than 2 to ensure that no negative objective function occursand α stands for the angles α0...15 that define the shape of the curved beam.

Boundaries: The values for the parameters were restricted by the lower and theupper bounds which were defined as

LBαi =

−3 if i = 0

−0.1 if 0 < i < 4

0 else

(5.2)

and

28

Page 39: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

29 5.2. The Genetic algorithm

UBαi =

−1 if i = 0

0.5 if 0 < i < 4

0.6 else

(5.3)

.LB stands for the lower bound and UB stands for the upper bound.

Inequality constraints: To make sure that the shapes found in the optimizationare also feasible in the real world, an additional inequality constraint was defined:

g1(α) > −0.1 (5.4)

g2(α) < 1.2π (5.5)

with

g1 = g2 =∑

0<i<16

αi (5.6)

.

5.2 The Genetic algorithm

5.2.1 Introduction to the Genetic Algorithm

To solve the optimization problem a Genetic Algorithm is used. A Genetic Algo-rithm is a search heuristics, which imitates natural evolution by mutating a popula-tion of chromosomes over several different generations to match the fitness functionas good as possible (see [12]). In our case the chromosomes are the angles α0...15

of the curved beam and the population is a set angles that define the shape ofthe curved beam. The fitness function is defined by an objective function. Theprocedure is the following:

Figure 5.1: The process of a Genetic Algorithm.

Page 40: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 5. The Optimization 30

1. Initialization: To start the algorithm, first an initial population must beset. In our case these are the initial angles of the curved beam and a randomvariation of them. The number of different samples in the population is calledpopulation size and has a great impact on the calculation time and the qualityof the results. In our studies, a population size of 8 individual parameter setsturned out to be a good choice, since the calculation of the fitness functionwas very time consuming.

2. Evaluation: In the second step, all the shapes generated in the initial pop-ulation are evaluated regarding their fitness. The fitness function used wasf(α) = a− x10s where x10s is the position of the point B after 10 seconds ofsimulation relative to its initial position. If the robot fell over or the simula-tion crashed the fitness value was set to f(α) = a+ 2.

Repeat: The following steps 3 to 5 are repeated until either the fitness valuereaches a certain threshold, or the maximal number of generations is reached.Since our goal was to hop as far as possible, no threshold was set for thefitness, but the number of generations was restricted to 40.

3. Selection: In the next step, the best sets of parameters are chosen accordingto their fitness value. Since our population is relatively small, we set the elitecount variable to one, which means that only the best result is kept unalteredfor the next generation. The rest of the chromosomes were chosen accordingto the selection function for the reproduction of a new generation.

4. Breed: In this step, a new population is created, either through crossover,which means a combination of two existing chromosomes, or by mutation.The crossover fraction defines the fraction of sets created by crossover.

5. Evaluation: The population of this new generation was again evaluated bycalculating its fitness.

The process is illustrated in figure 5.1.

5.2.2 Implementation in MATLAB

We used the genetic algorithm function ’ga’ from the MATLAB Global OptimizationToolbox to implement the genetic algorithm for our purpose. The ’ga’ function callsthe function which has to be optimized and hands over the angles:

[parameters, Fval, exitflag, population] = ga(@tracked SO, 16, [], [], ...[], [], lb , ub , [], options)

The specified outputs were the final angles, the final value of the fitness function,the exit flag and the whole population of the last iteration. The inputs were thefunction ’tracked SO’, the number of variables to be optimized, the lower and theupper bound of the angles and the options for the algorithm. The inequality con-straints were defined in the function ’tracked SO’ itself.

In the function ’tracked SO’ the SimMechanics model was simulated with the pa-rameters given by the ’ga’ function. To do so, first all the parameters needed forthe simulation had to initialized, including the values for the angles:

function [F] = tracked SO(parameters)

...

Page 41: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

31 5.2. The Genetic algorithm

Alpha 0 = parameters(1);Alpha 1 = parameters(2);

...

Alpha 15 = parameters(16);

The names Alpha 0 to Alpha 15 are the ones recognized by the SimMechanicsmodel. The simulation time had to be specified and the simulation had to be run.The model was called within a Try-Catch statement. This allowed us to overridethe default error behavior for the case that the simulation crashes. Without thisstatement, every time the simulation crashes the optimization would be aborted.

trysim('model3D Final speed ctrl fine.mdl', 'SrcWorkspace', 'current', ...

'StopTime','SimTime');

% Load data from SimulationTrackable1 = load('Trackable1.mat');Trackable2 = load('Trackable2.mat');

% Inequality constraintsif −0.1 > sum(parameters(2:16)) | | sum(parameters(2:16)) > 1.2*pi()

% PunishmentF = a + 2;

elseF = a − Trackable1.ans(2,end)

endcatch

% PunishmentF = a + 2;

end

After simulating the model in the source workspace the results from the routineare loaded and the inequality constraints are checked. If they are not fulfilled thefitness function gets punished by setting it to f(α) = a + 2. If the constraints aresatisfied the fitness function is calculated based on the results from the simulation.For the case that the simulation crashes (’catch’ statement) the fitness function getspunished as well.The initial values and the options were defined in the variable ’option’ which wascreated with the ’gaoptimset’ command:

options = gaoptimset('InitialPopulation', init parameters, 'Display', ...'diagnose', 'Generations', 40, 'EliteCount', 1, 'PlotInterval', 1, ...'CrossoverFraction', 0.5, 'MutationFcn' , @mutationadaptfeasible, ...'SelectionFcn', @selectionroulette, 'UseParallel', 'always', ...'CrossoverFcn', @crossoverscattered, 'PopulationSize', 12, ...'FitnessScalingFcn', @fitscalingshiftlinear);

A brief discussion of the options defined above - based on the guidelines of [13] - isgiven below:

• InitialPopulation: The initial population is given by the vector init parametersand a default variation of this vector. By giving initial parameters we couldmake sure, that at least one population of the first generation delivers a result.Since in the beginning the deviation in the mutation is quite high, good initialparameters were crucial.

• Display: Since the optimization is a very time consuming process, the displayoptions were set to diagnose, which allowed us to get some insights after eachgeneration of the optimization.

Page 42: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 5. The Optimization 32

• Generations: The number of generation is a very important number, sinceit affects the quality of the results considerably. 40 generations is a trade offbetween computational effort and quality of the results.

• EliteCount: Since many shapes of the curved beam created by mutationdon’t work properly, it is important to stick to at least one functioning versionafter each generation. This is ensured by setting the EliteCount to 1. Anumber greater than one can lead to inbreeding and as a result of that to ahomogeneous generation.

• CrossoverFraction: The crossover fraction was set to 0.5, which meansthat half of the new population was created by crossover. On the one hand,populations created by crossover are more likely to succeed, on the otherhand if there’re only populations created by crossover, the development goesstrictly into one direction and it is likely that the global optimum is missed.The crossover fraction was set to 0.5 since this is a good compromise betweenthe two arguments.

• MutationFcn: The mutation function was chosen to be ’mutationadaptfea-sible’ since this is the only one that sticks strictly to the boundaries given.The mutation is executed based on a standard Gaussian distribution functionwith a standard deviation that decreases over the generations. That meansthat a random number taken from a Gaussian distribution with mean 0 wasadded to each entry of the parent vector. The standard deviation of this dis-tribution was decreased with every iteration, so that the design space quasinarrowed.

• SelectionFcn: Our selection function is set to ’selectionroulette’. The prob-ability of a chromosome to be chosen is inversely proportional to its fitnessvalue, that means the better the fitness, the higher the change to be chosenfor reproduction.

• CrossoverFcn: The crossover function defines how the generations producedthrough crossover are build. ’Crossoverscattered’ is the default function. Itcreates a random binary vector with the length of the population. If the entryis 1 the chromosome from the first predecessor vector is chosen, if the valueis zero, the value from the second one is chosen.

• PopulationSize: The population size defines how many individuals there arein one generation. Again, the lower the number the higher are the chancesto find only a local minimum. On the other hand the higher the number thehigher the computational effort. The size was set to 12.

• FitnessScalingFcn: With the ’fitscalingshiftlinear’ the raw fitness scores areconverted in a range that is suitable for the selection function.

The entire MATLAB function to optimize the model can be found in the AppendixE.

5.3 Experiments

To check whether the optimization delivers satisfying results a couple of experimentswere performed:

Page 43: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

33 5.4. Problems during the implementation of the optimization

5.3.1 Methodology to show the increase of the performance

As a first step the increase of the performance in the simulation was looked at. Todo so, three aspects were considered:

• As a first setting, the enhancement of the performance in the simulation waslooked at in general. To do so the model was simulated twice, once beforethe optimization once afterwards and the hopping distances were comparedto show that the optimization really works.

• The second part was set up to show that the optimization works for variousmotor speeds. The optimization was done with the same initial condition andthe same optimization settings, but at different actuation speeds.

• In a third step, the influence of the optimization on the shape of the curvedbeam was looked at. The results from the second experiment were used tocompare the shapes that resulted from different motor speeds to draw furtherconclusion on the design of the robot and the representation of the curvedbeam. Furthermore an analysis of the resonance frequencies of the differentshapes after the optimization was done.

5.3.2 Methodology to show the repeatability of the results

In the second experiment the repeatability of the optimization was investigated toshow that the results are reliable and reproducible. The optimization was performed7 times with the same initial conditions, same optimization options and the sameactuation speed.

5.3.3 Methodology to validate the optimization results

In the last and most important experiment, the optimization results were validatedwith the real world. To do so, first the performance of the initial robot was lookedat in the real world and in the simulation at two different rotational speeds. Thebehavior found was stored as basis for the improvement. Based on the initial shapetwo optimizations were performed - one with each rotational speed - resulting intwo different shapes. Each one of these shapes should be optimized exclusively forone actuation speed.

The shapes found were recreated in the real world and the performance was lookedat again. Both shapes were investigated with both actuation speeds to show thatthe optimization is depending on the rotational speed. The increase in performancewas compared with the one from the simulation to make a meaningful statementabout the optimization process developed in this work.

5.4 Problems during the implementation of theoptimization

During the implementation of this optimization process several problems occurredin the real world, as well as in the simulation.

5.4.1 Simulation problems

In the simulation four major problems occurred which are discussed very brieflybelow:

Page 44: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 5. The Optimization 34

Figure 5.2: Two examples for a weirdly shaped robot.

• During the optimization process very often completely weird shapes appeared.Even though the performance of these shapes was often good, they had tobe discarded due to the impossibility of a recreation in the real world. Anexample of such a shape is shown in figure 5.2. With the help of the inequalityconstraint this problem was reduced but not eliminated completely.

• A second problem was that the simulation crashed from time to time, whichcaused the whole optimization process to abort. Since the optimization pro-cess could take - depending on the settings - up to 1.5 days to complete thisbehavior was very annoying. To avoid this problem, the simulation was calledfrom within a Try-Catch statement as mentioned above.

• Another problem was the falling over of the robot in the simulation. Initiallyit was possible that the robot flipped upside down without the simulation toend. Under certain circumstances it was even possible that the robots perfor-mance when flipped upside down was that good, that the genetic algorithmencouraged this behavior. An additional constraint was implemented in themodel to stop immediately as soon as the vertical position of the point T laysunder a certain threshold.

• The last problem deals with the high computational effort of the optimization.Even though MATLAB allows parallel computing when solving optimizationproblems, in our scenario this was not possible. The calculation of the fitnessfunction is based on the results written out by the model. When the modelis run more than once at the same time, these output files get messed upand a calculation of the fitness function gets pointless. A solution to thisproblem could not be found, the optimization has to be run without parallelcomputing.

5.4.2 Real world problems

The implementation of the optimized shape in the real world posed some problemsas well. First of all the sculpturing of the beam was very difficult to make it matchthe optimization result. To make the shape as close as possible to the one calcu-lated, the results were printed out and adapted step by step by hand.

Page 45: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

35 5.4. Problems during the implementation of the optimization

1 1.5 2 2.5 3 3.5 4 4.5 50

2

4

6

8

10

12

14

16

18

20

Voltage [V]

omeg

a [r

ad/s

]

Speed−Voltage curve

Figure 5.3: Relation between the rotational speed and the voltage.

Another problem was to set the right actuation speed in the experiments. Since webuild our robot without an encoder for the DC-motor, we had to estimate the motorvelocity based on the voltage of the power supply. With the help of the trackingsystem, beforehand a speed-voltage curve was done, which defined the speed as:

ω = mU + b (5.7)

Here U denotes the voltage in volt and m and b are calculated based on the speed-voltage curve which can be seen in figure 5.3. m = 4.4 and b = −2.9.

Page 46: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 6

Results

The results presented in this chapter are structured according to the experimentsintroduced in section 5.3.

6.1 Increase of the performance in the simulation

For the first experiment, the model was optimized at a rotational speed of 17 rad/s.The model had initial angles so that already a hopping behavior could be observed.The model was optimized with the settings discussed in the previous chapter. Theresults are presented in figure 6.1.

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.01

0

0.01

0.02

0.03

0.04

0.05Hopping with initial shape

x [m]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.01

0

0.01

0.02

0.03

0.04

0.05Hopping with optimized shape

x [m]

Figure 6.1: On the top: The hopping behavior of the robot before optimization.Below: The hopping behavior after the optimization.

36

Page 47: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

37 6.1. Increase of the performance in the simulation

0 5 10 15 20 25 30 35 400

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8Optimizaion Loop versus max. hopping distance

Iteration

Hop

ping

dis

tanc

e [m

]

16 rad/s17 rad/s18 rad/s19 rad/s20 rad/s21 rad/s

0 5 10 15 20 25 30 35 40−2

−1.5

−1

−0.5

0

0.5

1

1.5

2Optimizaion Loop versus average hopping distance

Iteration

Hop

ping

dis

tanc

e [m

]

16 rad/s17 rad/s18 rad/s19 rad/s20 rad/s21 rad/s

Figure 6.2: On the top: The maximal hopping distance in each generation at dif-ferent actuation speeds. Below: The average hopping distance of each generationat different actuation speeds.

The next optimization was started at the same initial angles, but with differentactuation speeds. In figure 6.2 it can be seen that regardless of the rotational speeda great improvement of the hopping distance can be seen. On the upper graphthe maximal hopping distance in each generation is shown, in the lower graph theaverage hopping distance of the whole generation is shown.

The different shapes resulting from this optimization can be seen in figure 6.3. Ascan be seen the model looks very similar, but still slight differences can be spotted.

To quantify the differences between the different results, the shapes were analyzedaccording to their shape parameters L0, dh and e. Further the longitudinal res-

Figure 6.3: The different shapes of the curved beam after the optimizations. Fromleft to right optimized at 17, 18, 19, 20 and 21 rad/s.

Page 48: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 6. Results 38

onance frequency ζL of each shape was measured in the simulation, to show thatthe optimization also has an impact on the free vibration modes of the curved beam.

ω [rad/s] L0 [cm] dh [cm] e ζL [/s]17 18.87 21.27 1.13 2.8818 25.53 20.58 0.81 2.9919 19.33 20.75 1.07 3.0020 24.37 18.29 0.75 3.2021 25.03 19.71 0.79 3.21

6.2 Repeatability of the optimization results

An important aspect of this optimization approach is the repeatability. A reliableoptimization must deliver results that can be reproduced in a reasonable quality. Toinvestigate the repeatability, the model was optimized 7 times at the same rotationalspeed, the same settings and the same initial parameters. The results can be seenin figure 6.4.

0 5 10 15 20 25 30 35 400.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

2.2Optimizaion Loop versus max. hopping distance

Iteration

Hop

ping

dis

tanc

e [m

]

Figure 6.4: Maximal hopping distance in simulation actuated at 17 rad/s for variousoptimizations.

Page 49: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

39 6.3. Validation of the optimization in the real world

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Simulation of initial model at 17 rad/s

x [m]

z [m

]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Simulation of optimized model at 17 rad/s

x [m]

z [m

]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Simulation of optimized model at 19 rad/s

x [m]

z [m

]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Real world experiment of initial model at 17 rad/s

x [m]

z [m

]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Real world experiment of optimized model at 17 rad/s

x [m]

z [m

]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Real world experiment of optimized model at 19 rad/s

x [m]

z [m

]

Figure 6.5: Comparison of the simulation results and the results from the real worldat 17 rad/s.

6.3 Validation of the optimization in the real world

To validate the optimized results from the simulation in the real world, three dif-ferent experiments were performed in the real world and in the simulation:

1. The robot was simulated and tracked with a rotational speed of 17 rad/s.

2. The robot was optimized at a rotational speed of 17 rad/s. After that it wasagain simulated, respectively tracked at a rotational speed of 17 rad/s.

3. Finally the robot which was optimized at a rotational speed of 17 rad/s wasalso simulated/tracked at a rotational speed of 19 rad/s, to show that theoptimization is explicitly for one rotational speed.

The results can be seen in figure 6.5. On the left side the results from the simulationare shown, on the right side the results from the real world robot can be seen.The same experiment was performed a second time. The only difference was thatthe model was optimized at a rotational speed of 19 rad/s. The results can be seenin figure 6.6.

The results from the figures 6.5 and 6.6 are presented again in figure 6.7. In thisplot only the performance of the real world robot actuated at 17 and 19 rad/s areshown. The comparison is done for robot with the initial shape of the curved beam,the robot optimized at an actuation speed of 17 rad/s and the robot optimized at19 rad/s.

Page 50: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 6. Results 40

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Simulation of initial model at 19 rad/s

x [m]

z [m

]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Simulation of optimized model at 19 rad/s

x [m]

z [m

]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Simulation of optimized model at 19 rad/s

x [m]

z [m

]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Real world experiment of initial model at 19 rad/s

x [m]

z [m

]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Real world experiment of optimized model at 17 rad/s

x [m]

z [m

]

0 0.2 0.4 0.6 0.8 1 1.2 1.4−0.02

0

0.02

0.04

Real world experiment of optimized model at 19 rad/s

x [m]

z [m

]

Figure 6.6: Comparison of the simulation results and the results from the real worldat 19 rad/s.

Initial robot Robot optimized at 17 rad/s Robot optimized at 19 rad/s0

0.2

0.4

0.6

0.8

1

1.2

1.4

Hop

ping

dis

tanc

e [m

]

17 rad/s

19 rad/s

Figure 6.7: The performance of the real world hopping robot actuated at 17 and 19rad/s. From left to right the initial shape of the curved beam, the shape optimizedat 17 rad/s and the shape optimized at 19 rad/s are used.

Page 51: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 7

Analysis of the results

7.1 Analysis of the increase of the performance inthe simulation

As can be seen in figures 6.1 and 6.2, the performance was increased significantly.Depending on the actuation speed the hopping distance was increased by almost600 %. This great improvement could not have been ecspected and shows that theoptimization and also the representation of the robot in the simulation were chosenappropriate. It can be seen as well that the optimization process works at differentactuation speeds and with different initial models.

In the figures 6.2 and 6.3 it can also be observed that the performance improvesover the whole optimization process. Also in the last generations a slight change tothe better can be stated. This can be explained by the decreasing of the varianceof the mutation function: In the last generations the shapes only experience minorchanges. The fact that the the improvement is distributed over the whole optimiza-tion process is an indicator that the right parameters were chosen.

It can be seen that the performance of the robot is increased no matter how goodthe performance was initially. In figure 6.2 it can be seen that the initial hoppingdistance of the model actuated at 18 and 19 rad/s is already pretty descent. Nev-ertheless, the performance is increased even more.

The shape created by the optimization look pretty much like they were expectedbefore hand. It has to be said that, even though a slight tendency can be seen thata higher actuation speeds induces smaller value for e, no clear correlation betweenthe resonance frequencies and these parameters can be seen. A generalized formula,on how to design the curved beam to achieve which behavior, could not be found.This is a good reason why an automated approach for the design - as presented inthis work - is useful.

Further it can be seen from the results, that the longitudinal frequencies of theoptimized models were shifted towards the actuation speed. This confirms the the-sis that the models perform the best when the actuation speed and the resonancefrequency match.

41

Page 52: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 7. Analysis of the results 42

7.2 Analysis of the results of the repeatability

In figure 6.3 the repeatability of the optimization was investigated. The resultsshowed that every time the optimization was performed, at significant change tothe better could be stated. As can be seen, the performance was always increasedby at least 200 %. The maximum hopping distance lays between 0.97 and 1.48 m,only one optimization resulted in a hopping distance of 2.05 m which lays outsideof the standard deviation.

These results show us, that on the one hand, the optimization is reproducible upto a certain degree and that they are reliable to happen. On the other hand, thefact that one optimization delivered a notably better performance than all the oth-ers shows us, that the global maximum is not found with this optimization. Thisis not a surprising insight, since a genetic algorithm is never capable of doing so.Nevertheless, the average result could still lay closer to the maximum. There is stillroom for improvement.

7.3 Analysis of the optimization results in the realworld

As can be seen in the figures 6.5 and 6.6 the performance was improved significantlyin the real world. The absolute improvement was even stronger in the real worldthan in the simulation. It can be seen that the optimization worked properly in thereal world for both actuation speeds.

In figure 6.5 it can be seen, that the model which was optimized at an actuationspeed of 17 rad/s, performs a lot better when actuated at 17 rad/s. When actuatedat 19 rad/s, the improvement is less strongly. This confirms again the assumptionthat the optimization delivers different shapes depending on the actuation speed.The same behavior is also shown in figure 6.7, where the performance gained fromthe experiments conducted in the real world are summarized.

Page 53: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 8

Conclusion

The indisputable improvement of the performance of the real world robot statesclearly that the design based on a optimization approach works. Even thoughslight weaknesses can be spotted in the repeatability and the quantitative accuracyof the results, the fact that it is possible to design the beam based on this approachleads to a positive conclusion. Following points should be highlighted:

• The representation of the Curved Beam Hopping robot as a series of rigidbodies connected with spring damper elements works nicely. The results arequalitatively very good and the computational effort is acceptable. Quantita-tively the results from the simulation might be improved.

• The Ground Contact model as used in this simulation allows a realistic rep-resentation of the reality.

• The optimization process based on a genetic algorithm works nicely in thesimulation and delivers reliable results. The improvement of the performanceis solid, even though it is only repeatable to a certain degree.

• The design parameters found by the optimization worked perfectly in the realworld; a great improvement of the performance could be stated in the realworld experiments.

43

Page 54: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Chapter 9

Future Work

Even though the final statement of this work is positive, there are still several openquestions and challenges to tackle:

• The repeatability of the optimizations could still be improved, To do so dif-ferent strategies could be chosen, either by finding better parameters of thealready existing algorithm, or by implementing a new approach all together.

• The optimization of the robot was limited to the design of the curved beam.Future projects could also include additional factors into the optimization,such as rotating speed, rotating mass, etc. This could be done with reasonableeffort.

• The optimizations performed in this work were always focused on the increaseof the hopping speed. Nevertheless, other optimization goals - such as energyefficiency or maximum hopping height - might be interesting as well.

• The quantitative evidence of the model used in the simulation could still beimproved. This could be done by finding better parameters, adjusting themodel (e.g. by increasing the number of increments in the beam) or by acompletely new approach.

44

Page 55: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix A

The SimMechanicsSimulation

A.1 The model hierarchy

An overview of the model is presented in figure A.1. The model has the followinghierarchical structure:

• model3D Final speed ctrl fine

– Actuation

– Animation

– Curved Beam

∗ Increments 0 to 15

– Ground Interaction Model F and R

∗ X-Axis Stiction-Friction Model

45

Page 56: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix A. The SimMechanics Simulation 46

A.2 Model overview

An overview of the SimMechanics model is presented in figure A.1. The blue sub-system includes the actuator block, the pink subsystem the animation and the greensubsystem contains the GCM. In the red blocks the foot and the curved beam areillustrated. The subsystems are connected by the SimMechanics signal that theyshare.

In figure A.1 also the blocks that define the simulation environment - such as the’Ground’ and the ’Machine environment’ block - can be seen.

Figure A.1: Overview of the SimMechanics model.

Page 57: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

47 A.3. Actuation

A.3 Actuation

In figure A.2 the subsystem for the actuation of the model is shown. It can be seenthat the rotating mass is modeled with to connected rigid bodies (one for the radiusand another one for the rotating mass itself) that rotate around a revolute joint.This joint is actuated with the motor subsystem, where a simple feed-forward speedcontrol is implemented.

The ’GoTo’ blocks in the subsystem are used for the animation of the model.

Figure A.2: Speed control of the rotating mass.

Page 58: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix A. The SimMechanics Simulation 48

A.4 Animation

The main part of the animation is the ’VR-Sink’ block, that connects the Sim-Mechanics model with the VRML world. The world is defined in a separate file.The variables from the simulation are handed over to the animation subsystem via’GoTo’ respectively ’From’ blocks.

Figure A.3: Integration of the VR-Sink into the model.

Page 59: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

49 A.5. Curved Beam

A.5 Curved Beam

The curved beam is represented with a series of identical subsystems, as can be seenin figure A.4. The SimMechanics signal is passed from one subsystem to the other.

Figure A.4: The curved beam in the model.

Page 60: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix A. The SimMechanics Simulation 50

Each increment of the curved beam consists of a rigid body, a revolute joint anda spring damper system. In addition each increment includes a body sensor and a’GoTo’ block, to hand over the coordinates and the orientation of the incrementsto the animation subsystem.

Figure A.5: One increment of the curved beam.

Page 61: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

51 A.6. Ground Contact model

A.6 Ground Contact model

The subsystem for the GCM. The forces in y- and z-direction are calculated directly,the ground reaction forces in x-direction are calculated in the block ’subsystem 2’.The subsystems are only active if the condition for ’Stance’ is fulfilled. This is thecase when the vertical position of the foot point is below zero.

Figure A.6: GCM of the front right foot.

Page 62: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix A. The SimMechanics Simulation 52

The ground reaction forces in x-direction are shown in figure A.7. The ’JointStic-tionActuator’ blocks calculates the reaction forces in x-direction and switches be-tween friction force and stiction. The inputs of this block come from body sensorblocks and predefined constants.

Figure A.7: x-Axis Stiction-Friction model.

Page 63: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

53 A.7. DC-motor model

A.7 DC-motor model

The DC-motor model build as a combination of SimElectronics, SimDriveline andSimMechanics elements can be seen in figure A.8. In the ’Solver configuration’block the settings for the SimElectronics solver can be set. The need of an individ-ual solver for the SimElectronics environment is a major cause for the additionalcomputational effort of this representation.

Figure A.8: The DC-motor model.

Page 64: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix A. The SimMechanics Simulation 54

Page 65: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix B

The parameter-file

The parameters listed below must be initialized before starting the simulation.

% Parameters for the final Curved Beam Hopping robot model% by Dominik Naef, 25.10.12

clear allclcclose allwarning('off')

% The rotational speed:omega = 17;

%% −−−−− Design parameter of robot−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−% The mass, length, width and Inertia of the link below (foot)M B = 0.058+0.015;L B = 0.275;B B = 0.248;I B = 1/12 * M B * [B Bˆ2 0 0;0 L Bˆ2 0;0 0 (B Bˆ2 + L Bˆ2)];

% Leg incrementals:% number of leg incrementals = 8;N Leg n =16;% The length of the leg incrementals:L Leg n = 0.038438; % 0.077% The position of the origin of the curved beamL Orig = L B/2−0.08;% Initial angle of torsional springs between leg incrementals:Alpha 0 = −2.558;Alpha 1 = 0.01;Alpha 2 = 0.112;Alpha 3 = 0.042;Alpha 4 = 0.094;Alpha 5 = 0.147;Alpha 6 = 0.130;Alpha 7 = 0.217;Alpha 8 = 0.182;Alpha 9 = 0.339;Alpha 10 = 0.339;Alpha 11 = 0.347;Alpha 12 = 0.399;Alpha 13 = 0.234;Alpha 14 = 0.344;Alpha 15 = 0.175;

% Spring constant and damping rate between leg incrementals:

55

Page 66: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix B. The parameter-file 56

k Leg n = 9.5;d Leg n = 0.003;% Mass and inertia of leg incremental;m Leg n = 0.055/N Leg n;I Leg n = 1/12 * m Leg n * [0.000001 0 0;0 L Leg nˆ2 0;0 0 L Leg nˆ2];

% Constant, damper and offset of torsional springk T = 12.;d T = 0.03;

% Weight of one batteryM B82res = 0.032;% The mass of point on the top, without the batteries.M T = 0.056+ M B82res;I T = 1/12 * M T * [0.000001 0 0;0 L Leg nˆ2 0;0 0 L Leg nˆ2];

% The mass and length of the rotating linkM R arm = 0.008;M R = 0.0334;L R = 0.035;%% −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

%% −−−−− Ground Contact Model: −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−% Friction constants and velocity thresholdmu slide = 0.4; %0.2mu stick = 0.5; %0.4v th = 1e−2;

% ground reaction parameters (z−Axis)k Ground = 140;d Ground = 15; %22

% ground reaction parameters (y−Axis)k Ground y = 20;d Ground y = 8; %8

% Gravityg = 9.81;

% Sample Time for controllerControl SampleTime = 1/120;

Page 67: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix C

OptiTrack data Handling

The data handling script for the data gained by the OptiTrack system.

% Data Handling Script% by Dominik Naef, 25.10.2012

clear allclear variablesclose allclcwarning('off')

% −−−−− Get Data from example.xls−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−tracking = xlsread('..\exmaple.xls');

% Define number of trackables recordedNumber Trackables = 3;

% Create empty array Trackabless=(size(tracking,1)−7)/(Number Trackables+1);%+2Trackables = zeros(s, Number Trackables*3+1);

% Structure of the array Trackables: Trackables(:,1) = Time,% Trackables(:,2:4) = XYZ Coordinate of Trackable1,% Trackables(:,5:7) = XYZ Coordinate of Trackable2, etcfor i=1:s

Trackables(i,:) = [tracking(7+(i−1)*(Number Trackables+1), 2) ...mean([tracking(7+(i−1) * (Number Trackables+1), 7:9) ; ...tracking(7+(i−1) * (Number Trackables+1), 10:12) ; ...tracking(7+(i−1) * (Number Trackables+1), 13:15) ; ...tracking(7+(i−1) * (Number Trackables+1), 16:18)],1) ...mean([tracking(8+(i−1) * (Number Trackables+1), 7:9) ; ...tracking(8+(i−1) * (Number Trackables+1), 10:12)],1) ...mean([tracking(9+(i−1) * (Number Trackables+1), 7:9) ; ...tracking(9+(i−1) * (Number Trackables+1), 10:12)],1)];

end

% Get CG of the foot to origin:Base = [median(Trackables(1:240,2)) median(Trackables(1:240,3)) ...

median(Trackables(1:240,4))];for i=1:s

Trackables(i,2:4) = Trackables(i,2:4)−Base;Trackables(i,5:7) = Trackables(i,5:7)−Base;Trackables(i,8:10) = Trackables(i,8:10)−Base;

end% −−−−− End getting Data −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

57

Page 68: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix C. OptiTrack data Handling 58

% −−−−− Filtering the data:−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−Tol 1 = 0.09; % Tolerance between 2 consecutive step;f1Y=120; % sampling frequency of cameras/Tracking systemf1Y cutoff = 9; % cutoff frequency;% Get rid of NaNfor i=1:s

if i>1for n=1:(Number Trackables*3+1)

if isnan(Trackables(i,n))Trackables(i,n) = Trackables(i−1,n);

endend

endend

% Get rid of unreasonably strange datafor i=1:s

if i>2if norm(Trackables(i,2:4)−Trackables(i,5:7)) < 0.16 | | ...

norm(Trackables(i,2:4)−Trackables(i,5:7)) > 0.6Trackables(i,5:7) = Trackables(i−1,5:7);

endif norm(Trackables(i,5:7)−Trackables(i,8:10)) < 0.01 | | ...

norm(Trackables(i,5:7)−Trackables(i,8:10)) > 0.2Trackables(i,8:10) = Trackables(i−1,8:10);

end

endend

% normalized cut off frequencyf1Ynorm =f1Y cutoff/(f1Y/2);% Low pass Butterworth filter of order 10[b1Y,a1Y] = butter(10,f1Ynorm,'low');Trackables Filtered(:,2:(Number Trackables*3+1)) = ...

filtfilt(b1Y,a1Y,Trackables(:,2:(Number Trackables*3+1)));Trackables Filtered(:,1) = Trackables(:,1);% End of filtering. −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

% −−−−− Find Frequency of rotating mass −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−FFT Response = fft(Trackables Filtered(1:size(Trackables Filtered,1) ...

− 500,7) − Trackables Filtered(1:size(Trackables Filtered,1)−500,10));% FFT info:N = size(Trackables,1)−500; % Number of samplesSamplingRate = 1/f1Y; % Sample rateIndex = 1:N; % Index array% To get from Index numbers to frequenciesFrequencies = Index./(N * SamplingRate);% To get from frequencies to omegasomegas = Frequencies * 2 * pi();% Plot frequency responsefigure(209)plot(Frequencies, abs(FFT Response));% Find maximum of FFT[maxi max Index] = max(abs(FFT Response(1:N/2)));% Get Motor Speed from index number in [rad/s]Motor Speed = max Index/(N * SamplingRate) * 2 * pi();% −−−−− End finding frequencies of rotating mass −−−−−−−−−−−−−−−−−−−−−−−−−−

totalTime = size(Trackables Filtered,1)*SamplingRate;% Define timespan to plotTimespan = 10 / SamplingRate;

figure(238)subplot(2,1,1)plot(−Trackables Filtered(1:1+Timespan,4)+0.05,Trackables Filtered(1:1 ...

Page 69: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

59

+ Timespan,3)−Trackables Filtered(1:1+Timespan,4)*.015)title('Hopping robot actuated at 17 rad/s in real world')xlim([−0.01 0.7])ylim([−0.01 0.05])xlabel('x [m]')ylabel('z [m]')

end

Page 70: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix C. OptiTrack data Handling 60

Page 71: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix D

Parameter estimation with afmincon algorithm

A System identification approach with a fmincon algorithm.

% Trying to find parameters using a minimization method and a FFT.% The idea is to maximize the oscillation in z−Direction and at the% same time minimize the oscillation in x−Direction.%% Written by Dominik Naef, 23.05.2012

function [k Leg n, d Leg n, k T, d T] = fmincon app% RUNTRACKLSQ demonstrates using LSQNONLIN with Simulink.

clcclear allclose all

% Initialize Target functionFval = 10000;

% Initial values for the parameters k Leg n, d Leg n, k T and d Tinit parameters = [2.05 0.06 14.1 0.3];

% Define options for the minimizationoptions = optimset('Algorithm','trust−region−reflective',...

'Display','iter−detailed','TolX',0.01,'TolFun',0.00001);

% Start minimization. tracklsq is the function to be minimized.[parameters, Fval] = fmincon(@tracklsq, init parameters, [], [], [], [], ...

[2 0.001 2 0.001], [40 5 40 5], [], options)

% Display parameters foundk Leg n = parameters(1);d Leg n = parameters(2);k T = parameters(3);d T = parameters(4);

end

function [F] = tracklsq(parameters)%% Initialize design parameterrun('param')

% constant frequency controlomega = 20.5;

61

Page 72: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix D. Parameter estimation with a fmincon algorithm 62

% Replace the parameters for the spring stiffness and damping rate to the% values from the minimization.k Leg n = parameters(1);d Leg n = parameters(2);k T = parameters(3);d T = parameters(4);

% Set sim options and compute function valuesim('model3D Freq.mdl', 'SrcWorkspace', 'current');

% FFT info: N = 10000, sampling rate = 0.001 −−> Simulationtime = 20s.N = 20001; SamplingRate = 0.001;

% the goal is to bring my z oscillation as close as possible to an ideal% oscillation, solely at the frequency of omega/(2pi)Frequency = omega/(2*pi());Index = round(Frequency * N * SamplingRate);ideal = ones(N,2);ideal(:,1) = ideal(:,1)*5;ideal(Index, :) = [20 200];ideal(Index+1, :) = [10 100];ideal(Index−1, :) = [10 100];

load simout.mat

amplitudes = [abs(fft(ans.Data(:,1))) abs(fft(ans.Data(:,3)))];

% Calculate the function valueF = 10000 − max(abs(amplitudes(Index−20:Index+20,2))) + ...

0.5 * max(abs(amplitudes(Index−20:Index+20,1)));

% Plot the FFt responsesplot3((Index−30:Index+30).*(2*pi()/(N*SamplingRate)), ...

abs(amplitudes(Index−30:Index+30,1)), abs(amplitudes...(Index−30:Index+30,2)),(Index−30:Index+30).*(2*pi()/...(N*SamplingRate)), ideal(Index−30:Index+30,1), ideal...(Index−30:Index+30,2));

xlabel('Frequency [rad/s]')ylabel('x−Amplitude')zlabel('z−Amplitude')grid onend

Page 73: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix E

The optimization function

The optimization of the model was implemented in the following m-file.

% % To optimize the shape of the curved beam robot (SO)% % a Genetic Algorithm is used (GA).% % Created and edited by Dominik Naef, 16.08.2012, 29.10.2012.

function SO GA 17

clear allclear variablesclose allclcwarning('off')global ii=1;

% −−−−− Optimization −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−% Define the initial shape:init parameters = [−2.558 0.01 0.112 0.042 0.084 0.126 0.130 0.217 ...

0.182 0.339 0.339 0.347 0.399 0.234 0.344 0.175];parameters = init parameters;

% create gaoptimset for GA−Optimization options:options = gaoptimset('Display', 'diagnose', 'Generations', 40, ...

'EliteCount', 1, 'CrossoverFraction', 0.5, 'InitialPopulation', ...init parameters, 'MutationFcn' , @mutationgaussian, 'SelectionFcn', ...@selectionroulette, 'CrossoverFcn', @crossoverscattered, ...'UseParallel', 'always', 'PlotInterval', 1, 'FitnessScalingFcn', ...@fitscalingshiftlinear, 'PopulationSize', 12);

% Define lower and upper bounds:lb = [−3, −0.1, −0.1, −0., −0., −0., −0., −0., −0., −0., −0., −0., ...

−0., −0., −0., −0.];ub = [−1, 0.5, 0.5, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, ...

0.6, 0.6, 0.6, 0.6];

% Call Genetic Algorithm function:[parameters, Fval, exitflag, output, population] = ga(@tracked SO, 16, ...

[], [], [], [], ...lb , ub , [], options)

% Save final results:save('Parameters SO', 'parameters', 'Fval', 'exitflag', 'output', ...

'population')end

function [F] = tracked SO(parameters)% function to run the simulation and compute the minimization function.

63

Page 74: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix E. The optimization function 64

persistent Data i;global i;warning('off')

% −−−−− Initialize parameters for simulation −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−for q=1:1

% Define Actuation speed at which the model is optimized:omega = 17;

%% −−−−− Design parameter of robot−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−% The mass, length, width and Inertia of the link below (foot)M B = 0.058+0.015;L B = 0.275;B B = 0.248;I B = 1/12 * M B * [B Bˆ2 0 0;0 L Bˆ2 0;0 0 (B Bˆ2 + L Bˆ2)];

% Leg incrementals:% number of leg incrementals = 8;N Leg n =16;% The length of the leg incrementals:L Leg n = 0.038438; % 0.077% The position of the origin of the curved beamL Orig = L B/2−0.08;% Initial angle of torsional springs between leg incrementals:Alpha 0 = −2.558;Alpha 1 = 0.01;Alpha 2 = 0.112;Alpha 3 = 0.042;Alpha 4 = 0.094;Alpha 5 = 0.147;Alpha 6 = 0.130;Alpha 7 = 0.217;Alpha 8 = 0.182;Alpha 9 = 0.339;Alpha 10 = 0.339;Alpha 11 = 0.347;Alpha 12 = 0.399;Alpha 13 = 0.234;Alpha 14 = 0.344;Alpha 15 = 0.175;

% Spring constant and damping rate between leg incrementals:k Leg n = 9.5;d Leg n = 0.003;% Mass and inertia of leg incremental;m Leg n = 0.055/N Leg n;I Leg n = 1/12 * m Leg n * [0.000001 0 0;0 L Leg nˆ2 0;0 0 L Leg nˆ2];

% Constant, damper and offset of torsional springk T = 12.;d T = 0.03;

% Weight of one batteryM B82res = 0.032;% The mass of point on the top, without the batteries.M T = 0.056+ M B82res;I T = 1/12 * M T * [0.000001 0 0;0 L Leg nˆ2 0;0 0 L Leg nˆ2];

% The mass and length of the rotating linkM R arm = 0.008;M R = 0.0334;L R = 0.035;%% −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Page 75: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

65

%% −−−−− Ground Contact Model: −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−% Friction constants and velocity thresholdmu slide = 0.4; %0.2mu stick = 0.5; %0.4v th = 1e−2;

% ground reaction parameters (z−Axis)k Ground = 140;d Ground = 15; %22

% ground reaction parameters (y−Axis)k Ground y = 20;d Ground y = 8; %8

% Gravityg = 9.81;

% Sample Time for controllerControl SampleTime = 1/120;

end

% Take angles defined by the optimization:Alpha 0 = parameters(1);Alpha 1 = parameters(2);Alpha 2 = parameters(3);Alpha 3 = parameters(4);Alpha 4 = parameters(5);Alpha 5 = parameters(6);Alpha 6 = parameters(7);Alpha 7 = parameters(8);Alpha 8 = parameters(9);Alpha 9 = parameters(10);Alpha 10 = parameters(11);Alpha 11 = parameters(12);Alpha 12 = parameters(13);Alpha 13 = parameters(14);Alpha 14 = parameters(15);Alpha 15 = parameters(16);

% Define simulation time:SimTime = 10;

try% Run simulation:sim('model3D Final speed ctrl fine.mdl', 'SrcWorkspace', 'current', ...

'StopTime','SimTime');

% Get Data from Simulation:Trackable1 = load('Trackable1.mat');Trackable2 = load('Trackable2.mat');

% Check inequality constraints:if −0.1 > sum(parameters(2:16)) | | sum(parameters(2:16)) > 1.2*pi()

disp('Weird shape... :(')parameters;F = 102;

% Check whether robot flipped upside down:elseif min(Trackable2.ans(4,:))<0.05

disp('Robot flipped upside down... :)')parameters;F = 102;

% If everything worked: Calculate fitness function:else

disp(':) −−− It worked... −−− :)')parameters

Page 76: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Appendix E. The optimization function 66

F = 100 − Trackable1.ans(2,end)end

catch% If the simulation crashed:disp('Error occured in simulation... :(')parameters;F = 102;

end

% Store the results after each simulation:Data i(i,:)=[F parameters];i=i+1;save('Data Iter', 'Data i');end

Page 77: Shape Optimization of a Curved Beam Hopping Robotdivf.eng.cam.ac.uk/birl/pub/Main/Publications/DominikNaef2012.pdf · Shape Optimization of a Curved Beam Hopping ... A curved beam

Bibliography

[1] M. Reis, F. Iida: An Energy Efficient Hopping Robot Based on Free Vi-bration of a Curved Beam, Advanced Intelligent Mechatronics (AIM), 2011IEEE/ASME, P. 892 - 897.

[2] M. Reis, X. Yu, N. Maheshwari, F. Iida: Morphological computation ofmulti-gaited robot locomotion based on free vibration, Artificial Life, accepted

[3] S. Hauser, M. Reis, K. Gunure: Resonance Frequency of Hopping Robots,Bachelor-Thesis, BIRL, ETH Zurich, 2011.

[4] MathWorks Official Homepage: http://www.mathworks.com/

[5] M. Schlotter: Multibody System Simulation with SimMechanics, 2003 .

[6] D. Naef, M. Hutter, D. Remy: Quadruped walking/running simulation,Term Paper, ASL, ETH Zurich, 2011 .

[7] P. Omlin, C. D. Remy, M. Hutter: Implementation of Optimal ControlStrategies for a Hopping Leg, Term Paper, ASL, ETH Zurich, 2010.

[8] M. Silva, J. A. Tenreiro Machado, I. S. Jesus: Modeling and simulationof walking robots with 3 DOF legs, Modelling, Identification and Control, 2006,P. 271 - 276.

[9] M. Silva, J. A. Tenreiro Machado, A. Lopes: Modelling and simulationof artificial locomotion systems, Robotica, 2005, P. 595 - 606.

[10] D. W. Marhefka, D. E. Orin: Simulation of Contact Using a NonlinearDamping Model, International Conference on Robotics and Automation, 1996,P. 1662 - 1668.

[11] M. Sobotka: Hybrid Dynamical System Methods for Legged Robot Locomotionwith Variable Ground Contact, Dissertation, Lehrstuhl fur Steuerungs- undRegelungstechnik Technische Universitat Munchen, 2007.

[12] Y. Zhou: Study on Genetic Algorithm improvement and application, Master’sThesis, Worcester Polytechnic Institute, 2006

[13] MathWorks Official Homepage: http://www.mathworks.com/help/gads/genetic-algorithm-options.html

67