113
Jens Desmet, Jarne Liagre Realtime Trajectory Control of a Snakeboard Robot Academic year 2015-2016 Faculty of Engineering and Architecture Chair: Prof. dr. ir. Jan Melkebeek Department of Electrical Energy, Systems and Automation Master of Science in Electromechanical Engineering Master's dissertation submitted in order to obtain the academic degree of Counsellors: Dr. ir. Cosmin Copot (Universiteit Antwerpen), Dr. Stijn Derammelaere Supervisor: Prof. dr. ir. Robain De Keyser

Trajectory control of a Snakeboard-robot

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Trajectory control of a Snakeboard-robot

Jens Desmet, Jarne Liagre

Realtime Trajectory Control of a Snakeboard Robot

Academic year 2015-2016Faculty of Engineering and ArchitectureChair: Prof. dr. ir. Jan MelkebeekDepartment of Electrical Energy, Systems and Automation

Master of Science in Electromechanical EngineeringMaster's dissertation submitted in order to obtain the academic degree of

Counsellors: Dr. ir. Cosmin Copot (Universiteit Antwerpen), Dr. Stijn DerammelaereSupervisor: Prof. dr. ir. Robain De Keyser

Page 2: Trajectory control of a Snakeboard-robot

PREFACE ii

Preface

The influence of autonomous robots on today’s world can not be underestimated.

With applications like self driving cars, automated drones for package delivery and

many more on the horizon, the importance of robotics will only increase in the

future. This master dissertation was chosen to get familiar with the problems of

designing autonomous systems, and to further expand our interests in this field.

This dissertation was especially interesting because no previous attempts have

been made to control a snakeboard robot in real time. It showed us that although

the equations behind a system can be highly nonlinear, it can still be controlled

with relatively simple and intuitive techniques. We hope that our approach will

inspire other researchers working on comparable systems.

We would also like to use this preface to express our gratitude to our counsellors:

Dr. ir. Cosmin Copot and Dr. Stijn Derammelaere. Also the entire department

DySC, under the supervision of Prof. dr. ir. Robain De Keyser, receives our

gratitude. Throughout the year, they organized multiple brainstorm sessions to

analyse our progress and to give the necessary feedback.

Jens Desmet, Jarne Liagre

June 2016

Page 3: Trajectory control of a Snakeboard-robot

PERMISSION FOR USAGE iii

Permission for usage

“The author gives permission to make this master dissertation available for con-

sultation and to copy parts of this master dissertation for personal use.

In the case of any other use, the limitations of the copyright have to be respected,

in particular with regard to the obligation to state expressly the source when

quoting results from this master dissertation”

Jens Desmet, Jarne Liagre

Ghent, June 2016

Page 4: Trajectory control of a Snakeboard-robot

Realtime Trajectory Control

of a Snakeboard Robotby

Jens Desmet, Jarne Liagre

Master’s dissertation submitted in order to obtain the academic degree of

Master of Science in Electromechanical Engineering

Academic Year 2015–2016

Supervisor: Prof. Dr. Ir. R. De Keyser

Counsellors: Dr. Ir. C. Copot, Dr. S. Derammelaere

Faculty of Engineering and Architecture

Universiteit Gent

Department of Electrical Energy, Systems and Automation

Chair: Prof. Dr. Ir. J. Melkebeek

Summary

The goal of this thesis is to deign and implement trajectory control of a snakeboardrobot. Based on a mathematical model, an intuitive control method is explained.To reduce the needed actuation, several measures are discussed. These include thechoice of a new controlled variable, and the optimization of the followed path.

Keywords

snakeboard, mathematical model, trajectory control, path optimization

Page 5: Trajectory control of a Snakeboard-robot

Realtime Trajectory Control of a Snakeboard RobotJens Desmet, Jarne Liagre

Supervisor: Prof. dr. ir. Robain De Keyser

Counsellors: Dr. ir. Cosmin Copot, Dr. Stijn Derammelaere

Abstract—The goal of this article is to design and implement trajectorycontrol on a snakeboard robot. Based on a mathematical model, an intuitivecontrol method is explained. To reduce the needed actuation, several mea-sures are discussed. These include the choice of a new controlled variableand the optimization of the followed path.

Keywords— snakeboard, mathematical model, trajectory control, pathoptimization

I. INTRODUCTION

THE control of a snakeboard is an interesting problem be-cause of its unique way of generating motion. As with most

robots, the travelling direction is chosen by controlling the an-gle of the wheels. The special thing about this robot is that themotion itself is generated by accelerating a rotor in alternatingdirections. Because of this, it is not possible to follow a straightline. Instead a snake-like path is followed, which explains thename of the robot.

An example of a path is shown in Figure 1. The base pathis shown in blue. Since this path is too straight for the robot tofollow in an efficient manner, a path needs to be planned aroundthis curve. An example of this modified path is shown in red.The goal of this article is to describe a control method that isable to follow the red trajectory. For the control aspect of thisarticle, we will assume that this trajectory is given in advance.We will also shortly look at a few possible adjustments that canbe made to improve this trajectory.

Fig. 1. Example trajectory for the snakeboard robot

In Section II some insight is given in how the motion is gen-erated by creating a mathematical model. A control method tofollow a predetermined trajectory is presented in Section III.Some methods to improve the path of the robot are discussedin Section IV. Finally, some results of this implemented controlmethod are shown in Section V.

II. MATHEMATICAL MODEL

A schematic representation of the robot is given in Figure 2.The rotor, with inertia Jr, has an angle δ with respect to theframe of the robot. The wheel platforms have an inertia Jp andare at angles φf and φb with respect to the frame. To simplify theproblem, the choice φf = −φb is made. The frame of the robothas an inertia of J and makes an angle θ with the x-axis. Thecenter of mass has as coordinates (x, y) and the total mass of theboard is noted as m. Finally, L represents the length from thecenter of mass to the center of rotation of the wheel platforms.

Fig. 2. Definition of the parameters of the snakeboard robot

The manipulated variables of the snakeboard are the wheelangle φ and the rotor acceleration δ. The angle of the wheelsdetermine an instantaneous center of rotation [1]. This is shownin Figure 3. Note that the speed of the center of mass, V, istangent to this circle. From this relationship, it follows that thepath that the robot follows is fully determined by the behaviourof the wheel angle over time. The influence of the rotor can beexplained with a torque balance around the center of rotation:

Jr δ = −mV

c− JT cV − JT cV (1)

The total inertia of the robot is noted as JT = J + Jr + 2Jp.The instantaneous speed of the robot is represented by V . Fi-nally, curvature is noted as c = 1/R. The left side of the equa-tion represents the torque generated by accelerating the rotor.The right hand side represents the torque needed to acceleratethe mass and rotate the inertia of the robot. This differentialequation forms the basis of controlling the speed of the robot. Itshows that the speed V of the robot can be manipulated by therotor acceleration δ.

III. CONTROL METHOD

The proposed control strategy consists of two parts. First, thewheel angle is controlled as a function of the travelled distance.This ensures that the desired path is followed, independent of thespeed of the robot. Second, the rotor acceleration is controlledsuch that the speed of the robot reaches its desired value.

Page 6: Trajectory control of a Snakeboard-robot

Fig. 3. The wheels of the snakeboard determine an instantaneous center ofrotation

A. Position control

A path can be represented by a distance coordinate d and thecurvature of the trajectory at this distance c(d). This idea isrepresented in Figure 4, where R(d) = 1

c(d) .

Fig. 4. Representation of a path as a radius R as a function of the distance d

From the geometry of the snakeboard, this can be translated toa wheel angle φ as a function of the distance travelled by usingequation (2). By applying this wheel angle, the correct path isfollowed.

tanφ(d) = c(d)L (2)

The travelled distance d of the center of mass can be recon-structed with the use of encoders on the wheels. Because ofdifferent reasons (slip, wheel alignment, ...) a small error in ab-solute position will accumulate over time. For short trajectoriesof several meters, this error is acceptable.

B. Speed control

If the curvature of the path changes, the speed will alsochange, even if there is no rotor acceleration. This is becausepart of the kinetic energy of the robot is in the rotation of therobot itself. Therefore, it is inefficient to control the robot to aconstant speed. To reduce the needed control effort, the speed iscompensated by a factor which takes this rotational energy intoaccount. The equivalent speed is defined from the followingequation, based on part of the kinetic energy:

1

2mV 2

eq =1

2mV 2 +

1

2JT θ

2 (3)

By using the relation θ(t) = V (t)c(t), the final result is asfollows:

Veq(t) =

√1 +

JT c(t)2

mV (t) (4)

From the torque balance of (1), we see that the speed of therobot can be controlled by accelerating the rotor. Therefore, a

PID-controller is applied to control the equivalent speed of therobot. The control strategy is represented in Figure 5. Becauseof the dependence of the torque balance on the sign of c(t), itis necessary to multiply the output of the PID-controller withsign(c(t)). The information of c(t) is known by measuring d(t),as explained in Section III-A.

Fig. 5. Block diagram of the full control scheme

Finally, some adjustments are made to make some small im-provements to the control. The problem with the current controlstrategy is that the rotor speed tends to drift towards its mini-mum or maximum. This happens because of asymmetry in thepath, or due to random variations of friction and floor gradient.When the rotor speed constraints are reached, no control of thespeed can be performed and thus a large error occurs. To com-pensate for this we make use of the fact that when the wheelsare almost straight, rotor acceleration has little influence on thespeed of the robot. Therefore, the path is split into three sectionsdepending on the wheel angle φ:• |φ| > φ1: Controlling the speed is the most efficient in thisinterval. Therefore the main control of the speed is performedhere.• φ1 > |φ| > φ0: Rotor acceleration has less effect on thespeed of the robot. To limit the total needed rotor speed range,no control is performed in this interval.• φ0 > |φ|: Rotor actuation has very little influence on thespeed of the robot. The rotor can now be accelerated towardsthe middle of its speed range without disturbing the speed of therobot too much.

IV. PATH IMPROVEMENTS

Compared to the sinusoidal path of Figure 1, some improve-ments can be made. One possibility is to optimize the path forefficiency. For this, use can be made of the fact that rotor actu-ation is more efficient at large wheel angles. The optimal pathspends as much time as possible at large wheel angles. Themaximum wheel angle is limited by two factors. First, the robotcan tip over more easily at large wheel angles. Second, for awheel angle of 90 degrees, the robot spins in place. No net for-ward movement will result. Taking this into account, the sinu-soidal variations around the path can be replaced by the shapeof Figure 6. This path consists of circular parts at a small radius,connected with a fast transition region. This transition region isnecessary to allow for a continuous change in wheel angle.

Both sinusoidal variations and the optimal variations pre-sented above have the property that very little time is spent at

Page 7: Trajectory control of a Snakeboard-robot

Fig. 6. The optimal variations path exist of circle arcs at a small radius, followedby fast transitions

almost straight wheel angles. Although this is good for con-trolling the robot in an efficient way, this sometimes does notallow for enough time to keep the rotor speed around the mid-dle of its speed range. If the rotor speed has drifted away toofar, one can add one period with the shape of Figure 7. Thethree control regions are shown in different colors. This is asinusoidal shape that is adjusted by adding straight sections toit. These sections are added at the points where the wheels arestraight when traversing a standard sinusoidal path. This keepsthe wheel angle continuous over the whole path.

Fig. 7. Path variations optimized to compensate rotor speed

This kind of variation should only be used if the rotor speedalmost reaches its extremes. Because of the long straight sec-tions, the robot speed cannot be controlled for a fairly long time.This results in larger errors in the speed control. The conclusionof this section is that path planning is very important for a robustcontrol of the snakeboard.

V. RESULTS

In this section, some results are presented that are gatheredfrom experiments on a real snakeboard robot. The followed pathconsists of a straight line, with the variations of Figure 6 aroundit. The results of this experiment are shown in Figure 8. Thefirst plot shows the actual speed of the robot. For clarity, thedifferent control regions (depending on the wheel angle φ) aredrawn in different colors. The resulting speed variations dueto change in rotational energy are visible as sharp peaks. Thesecond plot displays the equivalent speed, which is controlled to

a setpoint of 0.27m/s. Here the effect of the conversion factorbecomes very clear. Without this factor, the rotor would have tocompensate the sharp peaks in the speed.

Fig. 8. Top: Real speed of the center of mass of the robot; Bottom: Equivalentspeed (Reference: black dashes line)

The needed rotor acceleration and the resulting rotor speedcan be seen in Figure 9. Because of the choice of path, thereare barely any moments where the wheels are almost straight.The regions where the control is not applied are thus very small.The result of this is that the rotor speed drifts away from themiddle of its speed range. As mentioned before, the path can beadjusted to allow for more time to compensate this drift.

Fig. 9. Top: Rotor acceleration; Bottom: Rotor speed

The same test was also performed on a path with a sinusoidalshape, with the same maximal wheel angle. The needed rotoracceleration for this path is about 15−20% higher, which clearlyproves the effect of optimizing the path.

VI. CONCLUSION

The snakeboard can be controlled effectively in a very in-tuitive way. The needed rotor acceleration can be reduced bychoosing a new controlled variable. Because of the inefficientway of propulsion of a snakeboard, optimization of the path isnecessary. A balance has to be made between different factorslike efficiency of rotor acceleration (maximal time at a small ra-dius) and avoiding drift in the rotor speed (more time at a big ra-dius). This balance is not only limited to the choice of the pathbut also in the choice of φ0 and φ1, where higher values willlead to a higher disturbance in the equivalent speed. The biggestchallenge in future research holds the planning of a good pathfor the robot.

REFERENCES

[1] Tony Dear, Scott David Kelly, Matthew Travers, Howie Choset SnakeboardMotion Planning with Viscous Friction and Skidding, IEEE InternationalConference on Robotics and Automation (ICRA), Washington, May 26-30,2015

Page 8: Trajectory control of a Snakeboard-robot

CONTENTS viii

Contents

Preface ii

Permission for usage iii

Overview iv

Extended abstract v

Table Of Contents viii

List of Symbols xi

1 Introduction 1

1.1 State of art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Mathematical model 5

2.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2 Intuitive explanation . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.3 Rolling Resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3 Parameter identification and model simulation 12

3.1 Identification of rolling resistance . . . . . . . . . . . . . . . . . . . 12

3.2 Estimation of total inertia . . . . . . . . . . . . . . . . . . . . . . . 13

3.3 Simulation of basic gaits . . . . . . . . . . . . . . . . . . . . . . . . 15

4 Hardware 21

4.1 Arduino Mega Microcontroller . . . . . . . . . . . . . . . . . . . . . 21

4.2 Stepper motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

4.3 DC motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

4.4 Encoders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

Page 9: Trajectory control of a Snakeboard-robot

CONTENTS ix

4.5 Wireless communication . . . . . . . . . . . . . . . . . . . . . . . . 25

4.6 End stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

5 Control method 27

5.1 Control algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

5.2 Controlling the position . . . . . . . . . . . . . . . . . . . . . . . . 28

5.2.1 General method . . . . . . . . . . . . . . . . . . . . . . . . . 28

5.2.2 Stepper motor control frequency . . . . . . . . . . . . . . . . 29

5.3 Selection of controlled variable . . . . . . . . . . . . . . . . . . . . . 30

5.4 Efficiency of actuation . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.5 Optimal path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

5.6 Equivalent speed control . . . . . . . . . . . . . . . . . . . . . . . . 39

5.6.1 Control loop . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

5.6.2 Rotor speed compensation . . . . . . . . . . . . . . . . . . . 40

5.6.3 Tuning of the PID-controller . . . . . . . . . . . . . . . . . . 43

5.6.4 Rotor control frequency . . . . . . . . . . . . . . . . . . . . 46

6 Practical realisation 47

6.1 Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

6.2 Wheel calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

6.2.1 Fixed reference . . . . . . . . . . . . . . . . . . . . . . . . . 50

6.2.2 Angle to straighten wheels . . . . . . . . . . . . . . . . . . . 52

6.3 Distance calculation . . . . . . . . . . . . . . . . . . . . . . . . . . 54

6.4 Velocity calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

7 Results 59

7.1 Controller performance . . . . . . . . . . . . . . . . . . . . . . . . . 59

7.2 Optimal Trajectory . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

7.3 Rotor speed compensation . . . . . . . . . . . . . . . . . . . . . . . 67

7.4 Simulation versus real implementation . . . . . . . . . . . . . . . . 70

8 Conclusion and future developments 74

8.1 Path planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

8.2 Obstacle avoidance . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

8.3 Absolute feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

8.4 Design improvements . . . . . . . . . . . . . . . . . . . . . . . . . . 80

8.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

A DC Motor and driver 83

Page 10: Trajectory control of a Snakeboard-robot

CONTENTS x

B Encoder drawings 86

C Connection table 88

D User manual 89

Page 11: Trajectory control of a Snakeboard-robot

LIST OF SYMBOLS xi

List of Symbols

To simplify the notation, time derivatives are noted with the dot notation (δ, δ).

The use of vectors will be made clear by using a bold font.

Symbol Unit Detailed description

c m−1 Curvature of a curve at a certain point

d m Distance travelled along a curve

Ec J Controlled part of the kinetic energy of the robot

Frr N Rolling resistance force

g m/s2 Gravitational acceleration constant

J kgm2 Inertia of the mainframe of the robot (frame, batteries, ...)

Jp kgm2 Inertia of a wheel platform (+ wheels)

Jr kgm2 Inertia of the rotor

JT kgm2 Total inertia of the robot (J + 2Jp + Jr)

KE J Kinetic energy

L m Distance between center of mass of the robot and the middle

of a wheel platform

L1 m Distance between the middle of a wheel platform and a wheel

itself

m kg Total mass of the robot

R m Radius of a curve at a certain point

V m/s Speed of the center of mass of the robot

Page 12: Trajectory control of a Snakeboard-robot

LIST OF SYMBOLS xii

Vref m/s Reference speed (input of control)

Veq m/s Equivalent speed: speed the robot would have if all energy is

in the translation

x m x-coordinate of the center of mass of the robot

y m y-coordinate of the center of mass of the robot

δ rad Angle of the rotor

φf rad Angle of the front wheels with respect to the main body of

the robot

φb rad Angle of the back wheels with respect to the main body of the

robot

φ rad Wheel angle notation if φf = φb = φ

φ0 rad If φ < φ0, the rotor accelerates to the middle of its speed

range

φ1 rad For φ0 < φ < φ1, the rotor acceleration is zero

θ rad Orientation of the robot

Page 13: Trajectory control of a Snakeboard-robot

INTRODUCTION 1

Chapter 1

Introduction

The snakeboard is a toy that was invented in 1989. It is closely related to the

more popular skateboard. A picture of a real snakeboard is shown in Figure 1.1.

Instead of touching the ground to propel, the rider has to rotate his upper body,

while choosing the wanted direction by turning his feet. Because of the nature of

the propulsion, it is not possible to accelerate in a straight line. Instead, the rider

has to move in a snake shaped trajectory. This is where the name snakeboard

originates from.

This unconventional way of propulsion makes it an interesting problem from a

control point of view.

Figure 1.1: A real snakeboard.

Page 14: Trajectory control of a Snakeboard-robot

INTRODUCTION 2

The goal of this dissertation is to perform trajectory control on a snakeboard robot.

An example of a trajectory is shown in Figure 1.2. The goal of the robot is to

go from point A to point B while moving around the blue path. Since the robot

can not move very efficiently along a path that is almost straight, the original

path needs to be modified. The simplest modification that can be made is by

superposing a sinusoidal path on top of the original path. The result is shown in

red. As the focus of this master dissertation is on controlling the snakeboard, we

will assume that the path is given.

Figure 1.2: Example path from point A to point B (Blue: normal path, Red:

Modified path to allow the snakeboard to move efficiently).

The robot that will be used to perform the experiments can be seen in Figure 1.3.

The upper body of the rider is simulated by a rotor inertia that is controlled by a

motor. Also, the position of both wheels can be controlled by stepper motors.

Page 15: Trajectory control of a Snakeboard-robot

1.1 State of art 3

Figure 1.3: The robot used in this dissertation for testing the control strategy.

In Chapter 2, a mathematical model is discussed in an intuitive way. Next, based

on this model a simulation is implemented in Matlab and verified with findings

from Literature. This is done in Chapter 3. Before discussing the control part

in Chapter 5, some more details on the used hardware setup are discussed in

Chapter 4. More details on some practical aspects of the implementation are

given in Chapter 6. Apart from the control aspects, attention is also paid to

reducing the needed amount of rotor acceleration. This is partly done by taking

another controlled variable instead of the speed of the robot. Also, a basic theory

is developed to generate a more efficient trajectory. The results of these findings

are shown in Chapter 7. To finish, Chapter 8 discusses some future developments

for the snakeboard and how the current system could be improved upon.

1.1 State of art

In this section, a brief summary will be given of the current state of art of the

snakeboard. Early research was mainly focused on building a mathematical model

[1]. This was done based on the Lagrangian. In that paper, also research is

done on different gaits. A gait is when the controlled variables are controlled by

a cyclic input signal, which results in a net motion of the robot. For sinusoidal

inputs, there are three basic gaits. One has as result a displacement in the forward

Page 16: Trajectory control of a Snakeboard-robot

1.1 State of art 4

direction, another one creates a displacement in the sideways direction, and the

last one creates a net rotation as effect. Extensive simulations of these gaits with

different parameters can be found in [2]. These gaits are also simulated in Chapter

3 to verify the used simulation model. In [3] and [4], further research was done on

finding more robust gaits using simple harmonic input functions which result in

stable and/or moving limit cycles.

The model from [1] was later improved on by [5]. This model is used for the simula-

tions in this dissertation, and will be discussed further in Chapter 2. These models

make use of Cartesian coordinates. Because of the nature of the snakeboard, it is

more intuitive to work with curvature of the path as a variable. This model was

developed in [6]. From this model, it becomes clear that the desired curvature of

the path at a certain point fully determines the needed wheel angle at this point.

Explicit solutions exist for both wheel angle and rotor acceleration. To improve

the existing model, the influence of viscous friction and skidding was researched in

[7]. Again, simulations are performed where the inputs are generated by explicit

solutions.

These last papers generate an explicit solution starting from a given path. The

optimal construction of such a path is a missing link in literature. Instead, the

available path planning methods are base on a concatenation of primitive path

segments. Each new segment requires a specific initial configuration of the robot.

In order to change between these configuration the snakeboard has to come to rest.

In [8], this method is developed using only circular segments as path primitives.

A more elaborated attempt can be found in [9] where more path primitives are

taken into account.

In [3] and [8] a picture can be found of a comparable snakeboard robot as the

one used in this dissertation. However no practical result were published. We

assume that their practical research was stopped because the complex theoretical

problem becomes even harder when practical constraints and external influences

are included. From this we conclude that a full trajectory control on a real robot

in real time has never been implemented before. And that the results presented

in this work are the basis of a new aspect in the analysis of the snakeboard.

Page 17: Trajectory control of a Snakeboard-robot

MATHEMATICAL MODEL 5

Chapter 2

Mathematical model

Both for simulation and control, a mathematical model is needed. In this chapter,

a model found in literature is presented. This model is made more intuitive by

explaining the physical meaning of the observed equations. Finally, this model is

expanded to include friction.

2.1 Definition

A model is defined based on the schematic representation of Figure 2.1. The

position of the snakeboard is fully determined by three coordinates: x = (x, y, θ).

Here (x, y) are the coordinates of the center of mass. The angle θ is the angle that

the board makes with the x-axis.

The inputs to the model are u = (φf , φb, δ). Here φf and φb are the angles of the

front respectively back wheel platforms. The angle of the rotor with respect to

the robot is noted as δ. The total mass of the robot is denoted as m. The inertia

of the rotor is Jr, that of the wheel platforms is Jp and finally the inertia of the

robot frame is J . The only dimension of importance for the dynamics is L, the

distance between the center of mass and the center of the wheel platform.

Page 18: Trajectory control of a Snakeboard-robot

2.2 Intuitive explanation 6

Figure 2.1: Schematic representation of the snakeboard.

2.2 Intuitive explanation

The goal of this section is to give some insight into the physics behind the snake-

board. In literature, complex mathematical methods are used to come to the

equations of the snakeboard. However, an intuitive explanation for these equa-

tions is missing. We will start from a model found in literature, and explain how

this model arises from the physics behind the snakeboard. The model used for

this is derived in [5]. The results are as follows:

x = V cos θ − V sinψ2 sin θ

cosψ1 + cosψ2

y = V sin θ − V sinψ2 cos θ

cosψ1 + cosψ2

θ =V sinψ1

L(cosψ1 + cosψ2)

V =

−(d1δ+d2ψ2) sinψ1

cosψ1+cosψ2− (k

2ψ1 sinψ1 cosψ1+ψ2 sinψ2 cosψ2

(cosψ1+cosψ2)2+ ψ1 sinψ1+ψ2 sinψ2

(cosψ1+cosψ2)3(sin2 ψ2 + k2 sin2 ψ1))V

1 + sin2 ψ2+k2 sin2 ψ1

(cosψ1+cosψ2)2

(2.1)

With:ψ1 = φf − φb, ψ2 = φf + φb

d1 =JrmL

, d2 =JpmL

, k2 =J + Jr + 2Jp

mL2

(2.2)

The state V in the above equations does not (in the general case) represent the

Page 19: Trajectory control of a Snakeboard-robot

2.2 Intuitive explanation 7

physical velocity of the center of the snakeboard. Instead it is what’s called a

pseudo velocity. More information on this pseudo velocity can be found in [5].

To simplify this model, we choose φf = −φb = φ. This implies that both wheels

turn the same amount, but in opposite directions. This new angle will further be

noted as φ. Because of this assumption, the model simplifies significantly:

x = V cos θ

y = V sin θ

θ =V sinψ1

L(cosψ1 + 1)

V =

−d1δ sinψ1

cosψ1+1− (k

2ψ1 sinψ1 cosψ1

(cosψ1+1)2+ ψ1 sinψ1

(cosψ1+1)3k2 sin2 ψ1)V

1 + k2 sin2 ψ1

(cosψ1+1)2

(2.3)

Where now ψ1 = 2φ.

Now the parameter V represents the actual speed of the center of mass of the

snakeboard. This speed is always tangential to the turning circle. The equations

for x and y represent a particle moving with a velocity V in the direction of θ.

To make the other two equations more intuitive, the kinematics of the snakeboard

need to be studied. On the assumption that no slip occurs, the radius of the

followed path is a direct function of the wheel angle φ.

This can be seen in Figure 2.2. The turning circle is constructed by drawing lines

perpendicular to both sets of wheels. The intersection of these two lines determines

the center of rotation. Because of the symmetry of the problem, the middle of the

robot also turns around this center of rotation. The radius of the followed curve

is the distance between the center of rotation and the middle of the robot.

More exactly, the relation between radius and wheel angle is given by the following

geometric relation:

L = R tanφ (2.4)

Page 20: Trajectory control of a Snakeboard-robot

2.2 Intuitive explanation 8

Figure 2.2: Radius is controlled by the wheel angles.

From the tangent half-angle formula it follows:

tanφ =sinψ1

1 + cosψ1

(2.5)

If this is substituted together with the relation V = θ · R into (2.4), the equation

for θ in (2.3) is found.

The last equation to be explained is the equation of V . For this, a torque balance

is made around the center of rotation. This point is chosen because the force on

the wheels delivers no torque around this point. This is of course only true if

friction is neglected. The only remaining terms in the torque balance are terms

due to (angular) acceleration. This gives the following result:

Jrδ = −mV

c− JT cV − JT cV (2.6)

Here c represents the curvature: c = 1/R. JT is short for the total inertia: JT =

J + Jr + 2Jp.

This equation is also found in literature, for example in [7] (for the case mL2 = JT ).

Although complex mathematical methods were used to derive this equation, it can

also be derived in a short and intuitive way. The different terms in the equation

arise as follows:

� Jrδ: This is the torque that is needed to give the rotor a certain acceleration.

Page 21: Trajectory control of a Snakeboard-robot

2.3 Rolling Resistance 9

Due to Newton’s third law, this torque is also exerted on the snakeboard,

but in the opposite direction.

� m Vc: The force needed to accelerate the total mass equals mV . As V is

parallel to V , this force is perpendicular to its lever arm. This lever arm

has as length R = 1c. Therefore, this term represents the torque needed to

accelerate the center of mass around the center of rotation.

� JT cV + JT cV : The torque needed to accelerate a rotational inertia JT with

angle θ is equal to:

T =d

dt(JT θ) =

d

dt(JTV c) = JT V c+ JTV c (2.7)

Thus Equation (2.6) arises quite naturally. With the use of (2.4) and some trigono-

metric relations, this equation can be reformed into the equation of V in (2.3). This

information should give the reader a much more intuitive look into the physics be-

hind the snakeboard.

2.3 Rolling Resistance

The model discussed above can be extended by accounting for the rolling resis-

tance. This rolling resistance is primarily caused by the deformation of the wheels

when rolling over a flat rigid surface. The deformation is mainly determined by

the material properties of the wheel and the load on the wheel. In rest, the radial

deformation forces are symmetric as shown in Figure 2.3.a. The resulting reaction

force is a vertical component which counteracts the wheel load.

However, the radial deformation of the wheel exhibits hysteresis effects in motion.

Inward radial deformation requires more energy than outward radial deformation.

This shifts the center of pressure towards the direction of rolling, Figure 2.3.b. The

resulting reaction force still has a vertical component opposing the wheel load but

now due to the eccentricity it also creates a torque which counteracts the wheel

motion. The horizontal component of the reaction force is a shear force which

ensures that the wheel rolls without slipping [10].

Page 22: Trajectory control of a Snakeboard-robot

2.3 Rolling Resistance 10

Figure 2.3: Shift of reaction force during free rolling.

The resistance torque generated by the reaction force can also be represented as a

force which acts on the wheel axes, Figure 2.3.c. This relation leads to a commonly

used expression for the rolling resistance.

W · e = Frr ·R⇔Frr =

e

R·W = Crr ·W

(2.8)

With Crr the rolling resistance coefficient. Note that this rolling resistance is

independent of the speed.

This type of resistance stays constant over a large velocity range. At very high

speeds, the deformation continues to exist outside of the contact area. At this

point, the independence of rolling resistance and speed is lost [11]. In the scope of

this dissertation no such velocities will be reached.

Figure 2.4: Friction on wheels resulting in net torque.

Page 23: Trajectory control of a Snakeboard-robot

2.3 Rolling Resistance 11

The next step is to integrate this rolling resistance into the model. From Figure

2.4 the extra torque component around the center of rotation can be derived. Note

that all wheels carry one fourth of the weight of the board. This leads to an equal

rolling resistance force on all wheels. The total resistance torque around the center

of rotation can be expressed as follows:

Trr = Crr ·m · g ·R

cosφ(2.9)

Where g is the gravitational constant. With the use of (2.4), Equation (2.6) can

be extended to:

Jrδ = −mV

c− JT cV − JT cV − Crr ·m · g ·

l

sinφ(2.10)

Page 24: Trajectory control of a Snakeboard-robot

PARAMETER IDENTIFICATION AND MODEL SIMULATION 12

Chapter 3

Parameter identification and

model simulation

In this chapter the kinematics of the snakeboard are analysed through simulation.

This should give the reader a more intuitive understanding of the behaviour of

the snakeboard. The used inputs to the model are inputs discussed in literature.

This allows us to verify the correctness of the simulation. Some missing parameter

values will first be determined before simulation is possible. These are the rolling

resistance and the inertia of the robot.

3.1 Identification of rolling resistance

The main parameter to be determined is the rolling resistance coefficient. As this

coefficient is influenced by many factors there exists no accurate formula which

defines it. In practice this coefficient is best determined by experiment. In the

performed experiments, the board is given an initial velocity on a straight trajec-

tory and then it is allowed to roll freely. Fitting a first order curve to this part

of the speed profile over time gives the deceleration due to rolling resistance. The

results of such experiment are shown in Figure 3.1.

Using Newton’s second law of motion, the force needed to decelerate the mass of

the snakeboard is easily determined. Writing this force as a function of the weight

Page 25: Trajectory control of a Snakeboard-robot

3.2 Estimation of total inertia 13

of the board, W = mg, reveals the rolling resistance coefficient.

V (t) = a · t+ V (0) (3.1)

Frr = m · a = Crr ·W (3.2)

To obtain a higher accuracy the results are averaged over a few experiments. The

identified rolling resistance coefficient is Crr = 0.005.

From Figure 3.1, one can see that the experiments were always conducted in both

direction over the same path. This allows to correct for any errors which result

from the slope of the floor.

Figure 3.1: Blue: results of a friction test; Red: Linear regression performed on

the data.

3.2 Estimation of total inertia

Both for simulation and control, the total inertia of the robot around its center of

mass is needed. This is hard to measure accurately without specialised equipment.

The used method is based on the conservation of kinetic energy and will only result

in a rough estimation. The experiment starts by giving the robot an initial velocity

on a straight trajectory. As explained above, the robot will now decelerate due to

rolling resistance. After a short distance, a fast transition to a circular trajectory

Page 26: Trajectory control of a Snakeboard-robot

3.2 Estimation of total inertia 14

is performed. During this transition, kinetic energy will be transformed from

translational to rotational energy. From this velocity drop it is possible to estimate

the inertia of the robot, accounting for the additional dissipation of energy due to

the rolling resistance. External influences on the velocity profile such as the slope

of the floor are neglected. These will be compensated for by performing multiple

experiments and taking the average result. An example of a typical velocity profile

is shown in Figure 3.2. The first part of the figure is when the robot is still driving

in a straight line. The part where the velocity profile is steep, is the transition

from a straight line to a circle. The final part is when the robot is driving in

a circle. The green line, Vexpected, is the expected velocity if the transition to a

circular path is not made and only rolling resistance is taken into account. In that

case, no kinetic energy would be present in the rotation.

Figure 3.2: Velocity profile during the inertia test.

The difference between V and Vexpected is energy used for the rotation. By taking

an energy balance, the total inertia can be calculated:

1

2mV 2

expected =1

2mV 2 +

1

2JT θ

2 (3.3)

By using the relation V = θR, the only unknown in this equation is JT . The

estimated value for JT is 1.6 kgm2. In the symbols used in the mathematical

model, this inertia is equal to JT = J + 2Jp +Jr. J is the inertia of the main body

Page 27: Trajectory control of a Snakeboard-robot

3.3 Simulation of basic gaits 15

of the robot, Jp is the inertia of one wheel platform and its wheels, and Jr is the

rotor inertia.

The rotor inertia can be calculated easily by drawing the rotor in a CAD program.

After selecting the right material, the result is 0.049 kgm2 per rotor disk. Since

four rotor disks are used, this gives Jr = 0.196 kgm2.

For both simulation and control, only JT and Jr are needed. There is no need to

determine J and Jp separately.

3.3 Simulation of basic gaits

Simulations can now be performed based on the mathematical model derived in

Chapter 2. To verify the correctness of the simulation code, results from literature

will be simulated. From nature and other comparable systems we learn that mo-

tion is often created by applying cyclic inputs. Examples of this are the motions

performed when cycling, running, ... This idea was also used in literature to iden-

tify gaits which generate motion in different directions, [1], [3], [4] and [5]. The

inputs u = (φf , φb, δ) are simple harmonic functions of time:

t 7→ u = (af sin (ωf t), ab sin (ωbt), aδ sin (ωδt)) (3.4)

Again we will assume that φf = −φb. This is implemented by setting ab = −afand ωb = ωf . From [1] we know that for each variable in the configuration space

x = (x, y, θ) a gait is found which creates net motion in that direction. Note that

some more profound gaits can be found by adding a phase difference βδ to the

input signal of the rotor, [3] and [4].

The following simulations are all started at zero velocity and with the center of

mass in the origin. The orientation of the main frame of the board is chosen along

the x-axis, θ = 0. The parameter values used in the simulation match those of the

real robot. A summary is given in Table 3.1.

Page 28: Trajectory control of a Snakeboard-robot

3.3 Simulation of basic gaits 16

Table 3.1: Parameters used to perform simulations.

Parameter Value Description

m 24 kg Total mass of snakeboard

JT 1.6 kgm2 Total inertia of snakeboard

Jr 0.197 kgm2 Inertia of the rotor

L 0.358m Distance between center of mass and center of

wheel platforms

Note that for now the influence of the rolling resistance is neglected. This allows

us to compare the obtained results with the results from [1] and [5].

The first gait that is found is called the ”drive” gait. This gait has the same

frequency in al three input variables (ωf = ωb = ωδ) and creates net motion in the

x-direction. Figure 3.3 shows a simulation for a timespan of 20 s with the following

input variables.

t 7→ u = (0.5 sin (πt),−0.5 sin (πt), 1.5 sin (πt)) (3.5)

Note that different regions of the rotor acceleration are plotted in different colors.

Also stars are used to indicate the points where the wheels are straight. At these

points, the wheel angle switches signs. This enhances the information which can

be extracted from the figures.

The observed behaviour can be explained with the torque balance of Equation

(2.6). The used rotor input of this gait results in a rotor acceleration which changes

sign every half period. If the sign of the curvature would be fixed, the system would

accelerate over the first half of the period and decelerate over the second half of

the period. Instead the wheel angle changes sign at the same moment the rotor

acceleration changes sign. This means that although the rotor decelerates, the

system keeps accelerating as the sign of the curvature in the torque equation has

also changed.

In this configuration the mean speed of the board keeps increasing. This also means

that the speed with which the path is followed increases. And thus the change

Page 29: Trajectory control of a Snakeboard-robot

3.3 Simulation of basic gaits 17

Figure 3.3: The ”drive” gait.

in orientation θ over every half period will also increase. When θ changes more

than π over this half period, the gradient with which the x-axis is crossed becomes

negative, Figure 3.4. In some parts of the trajectory, the x-displacement will now

decrease. With even higher speeds, the contribution of these parts with a negative

x-displacement will become larger than the ones with a positive x-displacement.

This means that although the mean speed keeps increasing, the travelled distance

along the x-axis seems to decrease again. On the left side of Figure 3.5, the x-

coordinate is shown as a function of time for a long simulation. Here we clearly

see that after a while, the robot indeed changes directions. On the right side of

the picture a close-up is shown over the same time interval as the path presented

in Figure 3.4.

From the above, one can conclude that this gait has little practical relevance in

this form. A controller is needed to reach a stable movement in the x-direction.

Page 30: Trajectory control of a Snakeboard-robot

3.3 Simulation of basic gaits 18

Figure 3.4: The ”drive” gait starting to change direction after 50s.

Figure 3.5: Left: Net x-displacement as a function of time time; Right: Close-up

over same time frame as path depicted in Figure 3.4.

The next gait creates net displacement in the θ direction and is called the ”rotate”

gait. This gait is created by applying an input to the rotor with double the

Page 31: Trajectory control of a Snakeboard-robot

3.3 Simulation of basic gaits 19

frequency of the wheel platforms. Figure 3.6 shows a simulation of this gait for

10s with the input values of (3.6).

t 7→ u = (sin (πt),− sin (πt), 3 sin (2πt)) (3.6)

Figure 3.6: The ”rotate” gait.

The observed results can again be explained with the torque balance. In the first

half period of the wheel angle, the curvature has a positive sign. As the period of

the rotor input is now half that of the wheel angle, the system will both accelerate

and decelerate over this half wheel period. As these both happen over the same

mean curvature the system returns to rest every time the wheels are straight. In

the second half of the wheel period something similar happens but now the sign

of the curvature is the opposite. Increasing the amplitudes will increase the net

rotation over time.

The last gait that is examined creates net motion in the y-direction and is called

the ”parking” gait in literature. This gait is created by applying an input to

the rotor with a frequency that is 50 % higher than the frequency of the wheel

platforms: 3ωf = 3ωb = 2ωδ. The used input for this simulation is as follows:

t 7→ u = (0.5 sin (2πt),−0.5 sin (2πt), 3 sin (3πt)) (3.7)

Page 32: Trajectory control of a Snakeboard-robot

3.3 Simulation of basic gaits 20

Figure 3.7 shows the results for a simulation of 10s. The results can again be

explained with the torque balance of the system. Note that the system will also be

at rest every time the wheels are straight. However if we look at two succeeding

wheel periods, we see that the sign of the rotor acceleration is opposite. The

net result of this gait is a steady displacement in the y-direction. Increasing the

amplitude of the rotor increases the energy in the system leading to a larger steady

mean velocity in the y-direction.

Figure 3.7: The ”parking” gait.

The resulting outputs from the simulations match these found in [1] and [5]. From

this we can conclude that our simulation has the correct behaviour. Although

analysing these gaits improves the insight into the kinematics of this system, they

have little practical relevance. To reach a controlled movement, more advanced

methods are needed. Therefore a general control method will be developed in the

rest of this dissertation.

Page 33: Trajectory control of a Snakeboard-robot

HARDWARE 21

Chapter 4

Hardware

In this chapter, all the changes compared to the original setup will be discussed.

For the mechanical construction of the original robot, we refer to [12].

4.1 Arduino Mega Microcontroller

Because of the complexity of this dissertation, an Arduino Mega controller was

chosen. This board has 128 KB of program memory, 8 KB of SRAM and runs at a

clock speed of 16 MHz. It also has 54 I/O pins, supports PWM and has 6 external

interrupts. The main advantage of this board is the ease of use with the Arduino

software. A complete table with all of the connections to the Arduino is shown in

Appendix C.

4.2 Stepper motors

The angle of the wheels is controlled by stepper motors. These motors have a

holding torque of 2.5 Nm at a rated current of 4 A. The torque at non-zero speeds

was measured and is shown in Figure 4.1. To do one revolution, 200 full steps are

needed. This means that a full step is 1.8°. Because of the relatively low torque

of the stepper motors, the robot can only be used on a relatively smooth surface.

Page 34: Trajectory control of a Snakeboard-robot

4.3 DC motor 22

Both for stability and positional accuracy of the robot it is important that no steps

are missed, because the stepper motors have no feedback.

Figure 4.1: Maximal torque as a function of rotational speed.

The stepper motor driver is the AMIS-30421 [13]. The used boards are shown in

Figure 4.2. Steps are taken by applying a pulse to the NXT pin. The direction

is chosen by changing the logic level of the DIR pin. Multiple settings can be

configured via the SPI interface. The most important settings are the current

level and the option to use up to 1/64 microstepping. For accurate control, 1/16

microstepping is used in this dissertation. A full rotation is thus equal to 3200

microsteps. Unlike the Arduino microcontroller, this driver works at 3.3 V. The

logic level conversion from 5 V to 3.3 V is done with optocouplers. Because the

bandwidth of these optocouplers is lower than the lowest frequency available for

SPI on the Arduino, it is necessary to emulate SPI in software. This allows the

speed to be as low as necessary. For the NXT and DIR pins, the low bandwidth

of the optocouplers forms no problem as the stepping speed is slow enough.

4.3 DC motor

In the original setup, a stepper motor was used to drive the rotor. This gave the

robot a limited torque and speed range. In some places, the slope of the floor was

too high to obtain a forward motion, even with optimal actuation. Therefore, it

was decided to replace this motor with a more powerful one. The motor model

Page 35: Trajectory control of a Snakeboard-robot

4.3 DC motor 23

Figure 4.2: Left: Top view driver; Middle: Bottom view driver; Right: Optocou-

pler board.

number is RMCS-2006, which is a brushed DC motor. Although a brushed DC

motor is not the best choice for durability, it was the most powerful motor that

was available for a limited price.

Another advantage of switching away from a stepper motor is that now speed is

controlled instead of position. This saves a lot of processing power for the Arduino,

because it doesn’t have to send pulses to the stepper driver all the time. Also,

since acceleration is the controlled variable in the used mathematical model, speed

is a more convenient parameter to control than position.

The driver used with this motor is the RMCS-2302. This driver converts a 0-5V

PWM signal to a speed for the DC motor. The output of our controller is the

wanted rotor acceleration. Numerical integration is performed on this acceleration

value to send the wanted speed to the motor driver. Because the coupling between

the motor and the rotor can not handle the full motor torque, the torque will

be limited to about 2.5 Nm by limiting the requested rotor acceleration. The

minimum PWM frequency for the driver is 1 kHz, which is higher than the default

setting for the Arduino. This frequency can be adjusted by changing the TCCRxB

register, where x is the timer connected to the used PWM output. More detailed

information on this is found in [14] and [15].

More information on mechanical dimensions, motor characteristics and specifica-

tions of the driver can be found in Appendix A.

Although both the driver and the motor are able to work in two directions, it

is advised to only work in the forward direction. This is because the position

Page 36: Trajectory control of a Snakeboard-robot

4.4 Encoders 24

of the commutation brushes is not in the center position. This is to improve

commutation when turning in the forward direction. Running the motor in the

backwards direction will result in a lower torque output and in faster wear of the

carbon brushes. Only using the motor in one direction does not form a problem

for controlling the snakeboard. This is because the behaviour of the snakeboard

is independent of the rotor speed. The only important parameter is the rotor

acceleration.

At high rotor speeds, the effect of mass imbalance of the rotor becomes too large.

Therefore, the speed range of the rotor is limited to 0− 150 rpm.

4.4 Encoders

It was chosen to use encoders for feedback. The reason behind this choice is

explained in Section 6.1. The AEDR-8300 [16] reflective encoder is used. This

choice has as advantages its low price and small package. The working principle

is shown in Figure 4.3 (left). A current is sent through a LED. Depending on the

reflectivity of the area in front of the encoder, the photo-detectors will detect a

different amount of reflected light. By having a disk like the one shown in Figure

4.3 (right), the travelled distance can be measured. The black areas represent

areas that don’t reflect a lot of light, while the white areas reflect a lot of light.

Because there are multiple photo-detectors, the sensor can determine the direction

of rotation and output a standard quadrature encoder output. More information

on the interpretation of this output can be found in [17]. The final encoder disk is

constructed by printing the pattern of Figure 4.3 (right) onto transparant paper.

Next, this is glued onto a polished metal disk which is glued onto the wheel.

The AEDR-8300 is made for a resolution of 75 transitions per inch. To fit the

wheels nicely, an optical diameter of 30.5mm was chosen. A simple calculation

leads to an encoder disk with 283 transitions. Because an even amount of tran-

sitions is needed (because the disk is a closed shape), the end result of Figure

4.3 (right) has 282 transitions. Because the wheel diameter of the snakeboard is

62mm, this leads to an effective resolution of 0.69 mm per transition.

Page 37: Trajectory control of a Snakeboard-robot

4.5 Wireless communication 25

Figure 4.3: Left: Working principle of reflective encoders; Right: Reflective disk.

To mount the encoder itself to the wheel base, a custom mounting bracket was

designed. The sensor has to be mounted with a high positional and angular ac-

curacy. Therefore, the design was optimized for a precise and sturdy mounting.

Drawings of the mounting bracket are found in Appendix B. The final result can

be seen in Figure 4.5.

The connection with the Arduino board is quite straightforward. Channel A is

connected to an interrupt, while channel B is connected to a normal input. Each

time a change in the state of channel A is detected, an interrupt is run which

checks the state of channel B. The state of channel B gives information on the

direction of rotation. Depending on the value of A and B, a distance counter is

incremented or decremented. The resolution of the encoders can be doubled by

also adding an interrupt to channel B, but it was chosen not to do this because of

the limited number of interrupts on the Arduino.

4.5 Wireless communication

Having a cable run between the robot and a computer constantly is impractical.

Therefore it was necessary to add wireless communication. This allows a clear

graphical representation of all of the robot and controller parameters. A module

based on the popular nRF24L01+ was chosen (Figure 4.4). This is because of

its cheap price and excellent open source community. Another advantage is that

bidirectional communication is possible. For the integration with Arduino, the

’RF24’-library [18] was used.

Page 38: Trajectory control of a Snakeboard-robot

4.6 End stop 26

The nRF24L01+ needs 7 connections: 3V3, GND, MISO, MOSI, CLK, CS and CE.

While the inputs are 5V tolerant, it is important to only supply the module with

3.3V. The communication with the Arduino board is done through SPI (MISO,

MOSI, CLK and CS). More information on this serial interface can be found in

[19]. Controlling read and write actions is done with the CE-pin. More detailed

information on how to operate this chip is found in the datasheet [20].

The module is able to deliver a maximum throughput of 2Mbps with a maximum

package size of 32 bytes.

Figure 4.4: The NRF24L01+ module that was used for wireless communication.

4.6 End stop

Because of the need for calibrating the wheel angle, an end stop is implemented. It

was chosen to drill a threaded hole and screw in a small threaded rod. As this rot

is supposed to be a fixed reference position, no play is allowed. This is achieved

by tensioning a nut on the screw. A close-up of the final result is shown in Figure

4.5.

Figure 4.5: Close-up of the end stop construction.

Page 39: Trajectory control of a Snakeboard-robot

CONTROL METHOD 27

Chapter 5

Control method

In this chapter the designed control method is discussed. A new controlled variable

will be determined to minimize the needed rotor actuation. Also the influence of

the wheel angle on the efficiency of using rotor acceleration to control the speed of

the robot is examined. From this a theory will be developed which optimizes the

followed path to reduce the needed rotor acceleration.

5.1 Control algorithm

The objective of following a trajectory can be divided into two problems. The

first problem consists of controlling the wheel angle such that the path is followed.

The second problem is to control the rotor acceleration to reach the desired speed

along this path.

A two dimensional path is fully determined by the parameters (x(T ), y(T )), where

T is a parameter used to generate this path. Another possible coordinate system to

represent a path is by using distance and curvature along this path: (d(T ), c(T )).

The distance travelled along this path is noted as d(T ). The curvature at each point

is noted as c(T ). This idea is represented in Figure 5.1. This choice of coordinate

system comes naturally when analysing the snakeboard more closely. As was

mentioned before, the followed radius, and thus curvature, of the snakeboard can

be chosen by setting the correct value for the wheel angle φ at the right moment in

Page 40: Trajectory control of a Snakeboard-robot

5.2 Controlling the position 28

time. This also implies that the needed wheel angle is independent of the actuation

of the rotor. It only depends on the current travelled distance d.

Figure 5.1: A path can be represented as a distance and a curvature in function

of this distance.

Secondly, from the torque balance of Equation (2.6), we see that the speed of the

robot can be controlled by accelerating the rotor. The control is thus split into

two parts: position control (making sure the path is followed) and control of the

speed along this path. To minimize rotor actuation, the speed of the robot will

not be kept constant. Instead, part of the kinetic energy will be controlled to a

constant level. The reasoning behind this is explained in more detail in Section

5.3.

5.2 Controlling the position

5.2.1 General method

This section will discuss the method for following a curve with coordinates (x(T ), y(T )).

T is a parameter used to generate this curve. The first step is to transform this

path into curvature and distance coordinates (c(T ), d(T )). This is done with the

following formula’s:

d(T ) =

∫ T

0

√(dx

dT

)2

+

(dy

dT

)2

dT

c(T ) =dxdT

d2ydT 2 − dy

dTd2xdT 2((

dxdT

)2+(dydT

)2)3/2(5.1)

Page 41: Trajectory control of a Snakeboard-robot

5.2 Controlling the position 29

The wheel angle, φ(T ), can be calculated directly from the curvature, c(T ), using

equation (2.4).

Because of the lack of absolute feedback, only open loop control of the followed path

is possible. This is achieved by measuring the distance travelled, d(t), with the use

of encoders. If d(t) is known, the corresponding value of T can be determined. If

this value is entered into the function φ(T ), the needed wheel angle is known. The

next step is to control the stepper motors such that the wheels reach this angle.

A schematic representation of this method, together with the speed control loop,

will be given in Figure 5.10. To limit the amount of memory that is needed to

store this path into a microcontroller, an interpolation table is created. This table

stores the wanted wheel angle as a function of the travelled distance, for a number

of discrete points. The points in this table are chosen such that when the wheel

angle φ is calculated, the maximum error is less than one microstep. This method

obtains the highest possible accuracy.

5.2.2 Stepper motor control frequency

The aim of this section is to determine the frequency at which the position control

loop needs to be executed. Because of the discrete nature of stepper motors, the

maximum needed stepping frequency is determined by the maximum of φ, the

change in wheel angle. This control frequency is only useful if the response of the

stepper motor is actually fast enough to follow this signal. For a typical sine path

y(x) = 0.08(cos(2.4πx) − 1) at 0.3 m/s, the theoretical maximum of the needed

stepping frequency is around 1100 HZ.

In reality, the stepper motor has a finite settling time when moving to a new posi-

tion. In Figure 5.2, the response to a step of one full step (16 microsteps) is shown.

On the vertical axis the readouts of the encoders are shown. Due to the small size

of this step, the discrete nature of the encoders is clearly visible. As expected, this

response resembles the response of a mass-spring-damper system. The equilibrium

position is passed a first time after about 40 ms. It is recommended to control

such a system at least 10 times as fast. This leads to a minimum control frequency

of 250 HZ. This is the used control frequency.

Page 42: Trajectory control of a Snakeboard-robot

5.3 Selection of controlled variable 30

Figure 5.2: Position response for a step input to the position of the stepper motors.

5.3 Selection of controlled variable

In the next few sections, some concepts are developed to control the speed of

the robot in an efficient way. This section focusses on choosing a new controlled

variable instead of just the speed of the robot. The reason for choosing this new

variable is as follows. If the robot follows a trajectory without rotor actuation

(δ(t) = 0), the speed of the robot looks like Figure 5.3 (left). The path that is

followed is displayed in Figure 5.3 (right). Part of the kinetic energy is in the

rotation, therefore, the speed will be lower in sharp corners. When the path is

straight, no rotation will occur and all kinetic energy is in the translation. The

velocity will reach a maximum.

Page 43: Trajectory control of a Snakeboard-robot

5.3 Selection of controlled variable 31

Figure 5.3: Left: Speed profile without rotor actuation; Right: The followed path.

When the goal is to reach a constant speed, the rotor needs to add kinetic energy

when entering a corner, and extract it again when leaving a corner. This requires a

lot of rotor acceleration. The needed rotor acceleration to reach a constant velocity

on the path of Figure 5.3 is shown in Figure 5.4. In the used practical setup, the

rotor acceleration is limited to δ = 11.2 m/s. This is below the required rotor

acceleration to keep the speed constant. Even if the motor has enough torque

to apply this acceleration, still a bigger rotor speed range is needed. Due to the

limited speed range of the rotor (0− 150 rpm), controlling for a constant speed is

not a conservative solution.

Figure 5.4: Needed rotor acceleration to reach a constant speed.

Page 44: Trajectory control of a Snakeboard-robot

5.3 Selection of controlled variable 32

The goal of this section is to determine a controlled variable that is constant if

δ = 0 (friction is neglected). This will reduce the needed rotor speed range. From

the previous reasoning, it becomes clear that working with (part of) the kinetic

energy might be a good solution. The total kinetic energy of the robot is equal to:

KE tot =1

2mV 2 +

1

2Jθ2 +

1

2Jp((θ + φ)2 + (θ − φ)2) +

1

2Jr(θ + δ)2 (5.2)

The first part of the equation represents the energy of the center of mass. The

second part is the rotation of the frame of the robot itself. The rotational energy

of the wheel platforms is calculated in the third part. Note that both wheels move

in different directions, and thus φ has a different sign for both wheels. The last

term represents the rotational energy of the rotor. If we assume that φ is low,

which is generally the case, this equation is simplified to:

KE tot =1

2mV 2 +

1

2(J + 2Jp)θ

2 +1

2Jr(θ

2 + 2θδ + δ2) (5.3)

Equation (5.3) still contains the rotor speed δ, which can form a problem. A

constant kinetic energy can be reached if the rotor is spinning fast, while the robot

itself is not moving. Therefore, the controlled variable should also be independent

of the rotor speed. To solve this problem, first look at the time derivative of the

part of the kinetic energy that depends on the rotor speed:

d

dt

(1

2Jr(2θδ + δ2)

)= Jr(θδ + θδ + δδ) (5.4)

Also note that the power delivered by the motor is equal to:

Wm = T δ = Jr(δ + θ)δ (5.5)

If δ = 0 is substituted in Equation (5.4), only the term Jrθδ remains. If we now

look at the power provided by the motor (Equation (5.5)) assuming the rotor

acceleration δ is zero, we see that the motor power exactly corresponds to the

time derivative of the kinetic energy of Equation (5.4). From a global energy

balance, we also know that the total energy change of the system is equal to the

Page 45: Trajectory control of a Snakeboard-robot

5.4 Efficiency of actuation 33

work delivered by the motor (in absence of friction). This means that the part

of the kinetic energy that is independent of the rotor speed is constant if δ = 0.

Therefore, the controlled variable that will be used in this dissertation is as follows:

Ec =1

2mV 2 +

1

2JT θ

2 (5.6)

Where JT = J + 2Jp + Jr represents the total inertia of the robot.

Another way to approach this is to transform the speed of the robot to some

equivalent speed Veq. This equivalent speed should be constant if Ec is constant.

It is defined as follows:

Ec =1

2mV 2 +

1

2JT θ

2 =1

2mV 2

eq (5.7)

By taking into account the relation between θ and V , this can be rewritten as:

Veq =

√1 +

JT c2

mV (5.8)

The actual control is done with this equivalent speed instead of with the energy

Ec. The reason behind this is that a setpoint of for example Ec = 1.08 J does not

tell you very much. This is the same as having a setpoint of Veq = 0.3 m/s. It is

far more intuitive to interpret this: the robot will be moving at a speed of around

0.3 m/s.

5.4 Efficiency of actuation

One can intuitively feel that rotor actuation is not always as efficient. For example

when the wheels are straight, nothing will happen when the rotor accelerates.

The main question in this section is if there is an optimal radius R where the

rotor acceleration is the most efficient. Since the goal of the rotor actuation is to

control the value of Ec, we want to examine the relation between dEc

dtand the rotor

acceleration δ.

Page 46: Trajectory control of a Snakeboard-robot

5.4 Efficiency of actuation 34

To simplify this analysis, we assume that the curvature of the path is constant,

c = 0. The rotor equation now becomes:

Jrδ = −(mc2

+ JT

)θ − Frr

c cosφ(5.9)

Where Frr represents the rolling resistance. Equation (5.9) is written as a function

of θ instead of V . This is because a singularity occurs as the radius of the path

becomes zero. The next step is to derive Ec (5.7) with respect to time and eliminate

θ with the use of (5.9).

dEcdt

= θθ(mc2

+ JT

)= −θ

(Jrδ +

Frrc cosφ

)(5.10)

This equation consists of two terms. The first term represents the energy added by

accelerating the rotor. The second term represents the energy lost due to friction.

A first observation is that both the energy added by the rotor and the energy

loss due to friction are proportional to θ. This means that in the case Frr = 0,

actuation is the most efficient if θ is large. As θ is the angle of the robot frame

with respect to the x-axis, this means that the board is rotating fast. As we know

from Figure 2.2, the board will rotate faster if the radius R of the path is smaller

(for the same speed). In absence of friction, paths with tighter turns are more

efficient.

To examine the influence of friction, we have to look at the relative magnitude of

Jrδ and Frr

c cosφ. The first term is independent of the curvature of the path. Using

tion (2.4), 1c cosφ

is plotted as a function of the wheel angle φ in Figure 5.5 (with

the parameters of the real system). From Figure 5.5 we see that the second factor

drops if the wheel angle is bigger.

Page 47: Trajectory control of a Snakeboard-robot

5.5 Optimal path 35

Figure 5.5: Influence of the wheel angle on the magnitude of friction losses.

The conclusion of this analysis is that due to the term θ, which represents the

angular velocity of the robot, both the energy input from the rotor (for a certain

acceleration) and the energy lost due to friction will rise when the turning radius is

smaller. However, due to the effect of 1c cosφ

, the friction term will rise slower than

the acceleration term. This means that even when taking friction into account,

the efficiency is higher for a small turning radius.

Of course, in practice the limit of φ = 90° is never used. This means that the robot

will just spin in place, which is not very useful. Also, in the case of φ = 90° all

four wheels will be in one line. This means that extra support wheels are needed

or the robot will tip over. The robot used in this dissertation does not have any

support wheels. To ensure stability, φ is limited to about 60°.

5.5 Optimal path

This section aims to reduce the needed rotor acceleration by improving the shape of

the followed path. In Figure 1.2 we presented an example path, where a sinusoidal

shape was imposed onto the wanted path. If instead of a sinus shape, other

shapes are imposed on this path, a more efficient movement can be achieved. For

simplicity, we will limit ourselves to designing a shape around a straight path.

Page 48: Trajectory control of a Snakeboard-robot

5.5 Optimal path 36

As long as the wanted path is straight enough, this roximation will stay close

to optimal. For sharper curves, constraints of the reachable wheel angles might

behout more advanced path planning.

As discussed in Section 5.4, the efficiency is maximal when following paths with a

small radius. The minimum radius attainable by the snakeboard is limited by both

friction and stability. Due to high centrifugal forces in sharp corners, the wheels

can slip. Also if the radius is too small, the wheels make sharp angles and the

robot can tip over. The maximal wheel angle that leads to stable results is about

φmax = 60° . Using Equation (2.4), this leads to a minimal radius of Rmin = 21cm.

In theory, the optimal path consists only of half circles, with a radius of Rmin.

This path and the needed wheel angle to follow it is shown in Figure 5.6.

Figure 5.6: Left: Theoretical optimal path; Right: Wheel angle needed to follow

this path.

In practical systems, this path can not be followed because the wheel angle is not

continuous. Therefore, instead of instantaneously switching from one half circle

to the next, a more gradual transition is needed. A more realistic situation is to

use a constant angular acceleration φ until φ reaches zero, and then use a constant

deceleration until φ reaches its other extreme value. An example of this behaviour

in time is represented in Figure 5.7. The switch between two circle halves is made

in one second. This transition time is a parameter of the path, which depends on

Page 49: Trajectory control of a Snakeboard-robot

5.5 Optimal path 37

the torque of the motors, the speed of the robot and the wanted minimal radius

of the path.

Figure 5.7: Left: Optimal wheel angle profile; Right: Angular velocity of the

stepper motors.

The ignal of Figure 5.7 can not be applied directly to the robot. If the equivalent

speed of the robot is not exactly constant, just applying a time signal will lead to

large deviations from the expected trajectory. Therefore, this time signal first has

to be translated into a fixed path. This path can then be followed independent

of the equivalent speed of the robot. Only if the equivalent speed is perfectly

constant at the design value, the signals of Figure 5.7 will be observed.

As introduced in Section 5.3, the equivalent speed is constant if the following

relation holds:

V (t) =Vref√

1 + Jc(t)2

m

(5.11)

As the signal φ(t) is chosen by design, c(t) can be calculated using equation (2.4).

Then the above equation leads to V (t). The path can now be reconstructed using

the following equations:

Page 50: Trajectory control of a Snakeboard-robot

5.5 Optimal path 38

θ(t) = θ0 +

∫ t

0

V (t)c(t) dt

x(t) = x0 +

∫ t

0

V (t) cos θ(t) dt

y(t) = y0 +

∫ t

0

V (t) sin θ(t) dt

(5.12)

(x0, y0, θ0) represent the coordinates of the robot at t = 0. The result of this

calculation for a reference velocity Vref = 0.3 m/s, with the time signals of Figure

5.7, is presented in Figure 5.8. For clarity, the circular parts and the transition

regions are drawn in different colors.

Figure 5.8: Left: Optimal wheel angle as a function of travelled distance; Right:

Optimal path with continuous curvature.

It is clear that the transition between two circular regions is much more smooth

now. To summarise this section we note that the optimal path has three design

parameters. The first parameter is the minimal radius of the path. This is limited

mainly by the stability of the robot and by centrifugal forces. The second parame-

ter is the time in which the transition between circular parts occurs. This is limited

by the torque that can be delivered by the motors controlling the wheel angles.

This transition time can be decreased by minimizing the inertia of the wheels and

the wheel base with respect to the rotation center (Jp). The last design parameter

Page 51: Trajectory control of a Snakeboard-robot

5.6 Equivalent speed control 39

is the time spent in the circular region. If this time is too long, more than half of

a circle is travelled. An example of such path is shown in Figure 5.9. Although

the control towards a constant Veq is very efficient, a lot of distance is travelled for

a limited movement in the x-direction.

Figure 5.9: Path followed if the circular part spans more than half of a circle

5.6 Equivalent speed control

5.6.1 Control loop

The control of the equivalent speed is based on a PID controller. In the torque

balance of Equation (2.6), the curvature c(t) appears in every term on the right

side. This means that if the sign of c(t) switches, the effect of rotor acceleration

will also switch signs. Therefore, δ is not only determined by a PID controller,

but also by the sign of c(t). The final control loop is represented in Figure 5.10.

As mentioned before, to know the value of c(t), feedback of the travelled distance

d is used. For completeness, also the control of the wheel angle φ(t) is added to

this diagram.

Page 52: Trajectory control of a Snakeboard-robot

5.6 Equivalent speed control 40

Figure 5.10: Block diagram of the full control loop.

Note that to be able to let Vref change discontinuously (step inputs), the D-action

of the controller is only performed on Veq instead of the error.

5.6.2 Rotor speed compensation

In some cases, the rotor speed changes are not purely periodical but have a trend.

An example of this is when using a path that follows a large circle. In Figure 5.11,

the results of such simulation are shown. The used path is:

x(T ) = (2 + 0.08 cos (24T )) cosT − 2.08

y(T ) = (2 + 0.08 cos (24T )) sinT(5.13)

Where x and y are the coordinates of the robot in meters, and T ∈ R.

Page 53: Trajectory control of a Snakeboard-robot

5.6 Equivalent speed control 41

Figure 5.11: Left: A snakeboard path around a large circle; Right: Simulated rotor

speed profile.

The rotor speed will converge to its maximum. Although it will not stay at its

maximum, each time the maximum rotor speed is reached, the robot speed can not

be controlled. This will lead to large disturbances for the instantaneous velocity

of the robot. This behaviour is not limited to special trajectories. Even when the

robot follows a straight snake trajectory, this problem often occurs. This is due to

random variations like the slope of the floor.

To solve this problem, remember that rotor actuation is less efficient at small wheel

angles. If the wheels are straight enough (φ < φ0), the rotor is accelerated towards

the middle of its speed range. Although this will have some influence on the speed

of the robot, with the right choice of φ0 the disturbance will be limited. If the

rotor speed reaches its constraints the disturbance will be much bigger.

To further reduce the needed rotor speed range, no rotor acceleration is performed

in the interval φ0 < φ < φ1. Again this is because of the lower efficiency of

rotor actuation at smaller wheel angles. For high wheel angles (φ > φ1), the

normal control is applied. An example trajectory, with the three regions shown in

different colors is shown in Figure 5.12.

Page 54: Trajectory control of a Snakeboard-robot

5.6 Equivalent speed control 42

Figure 5.12: Example of the different control regions along a path (φ0 = 9°, φ1 =

22.5°).

To determine good values for φ0 and φ1, we look at the influence of the wheel

angle on dEc

dtfor different rotor accelerations. This can be used as a measure of

efficiency. The different lines on the graph of Figure 5.13 represent different values

of rotor acceleration. The maximal angle used for φ is 58 °. This angle, together

with the selected values of φ0 and φ1 are visualised with black dashed lines.

To sustain motion, typical values of 2.8 rad/s2 are needed for the rotor acceleration.

Therefore, point (a) is taken as a reference. The wheel angle φ1 below which no

control is applied, is chosen such that the efficiency is about one third of the value

in (a). This is noted as point (b). When φ < φ0, the maximal acceleration is

used to return to the middle of the rotor speed range. A value of 11.2 rad/s2 is

used for this maximal acceleration. This is to limit the torque on the coupling,

as discussed in Section 4.3. This value is represented by the cyan curve on Figure

5.13. To have a large enough time span to accelerate the rotor, φ0 can’t be chosen

low enough to reach the same level as (b). Therefore, a compromise is made and

φ0 is chosen such that the influence of working at (c) is about half that of working

in (a). Although the effect on dEc

dtis not negligible, because of the short time span

in this region, the total disturbance will be small. The final values for φ0 and φ1

are 9 ° and 22.5 ° respectively.

Page 55: Trajectory control of a Snakeboard-robot

5.6 Equivalent speed control 43

Figure 5.13: Influence of wheel angle and rotor acceleration on dEc

dtfor Veq =

0.27 m/s.

Another interesting fact that can be noted from this figure is that for small wheel

angles there is a region where dEc

dtstays fixed at zero. This is because the torque

generated by the rotor is too small to overcome friction.

5.6.3 Tuning of the PID-controller

To tune the PID-controller, system identification is performed on the system. The

input of this identification is the (wanted) rotor acceleration, the output is the

velocity of the robot. From Section 2.2, it can be seen that the gain of this

transfer function will depend on the wheel angle.

The observed behaviour represents a second order transfer function with two real

poles. This can be explained as follows:

� From the torque balance without friction (Equation (2.6)), the relation be-

tween rotor torque and velocity of the robot should be an integrator. Since

the torque caused by friction is a constant value independent of the velocity,

this can not be represented by a transfer function. In an identification, we

Page 56: Trajectory control of a Snakeboard-robot

5.6 Equivalent speed control 44

will estimate this behaviour as a first order transfer function. The expected

time constant is in the order of seconds.

� If the rotor acceleration is controlled, this is the same as controlling the motor

torque. The relation between torque setpoint and actual output torque also

has some dynamics. These dynamics are caused by the electrical transient

of the DC-motor. The torque output of such motor is proportional to the

current. Due to inductance and resistance, the current needs a finite time to

settle to a new value. Typical time constants for this size of motor are only

a few milliseconds. Therefore, these dynamics can be neglected.

� The motor driver of the rotor has the option to include damping on the input

signal. The coupling between motor and rotor is based on friction. If the

motor torque becomes too high, the coupling will slip and damage will occur.

Since the input to the motor driver is the wanted motor velocity, any discon-

tinuity in this signal will lead to a very large torque on the motor. Possible

causes of such discontinuity are: resetting the microcontroller, overflows or

other bugs in the code. To limit the chance of damage of such events, a small

amount of damping was added. The time constant of this damping is of the

order of a few hundred milliseconds. This cannot be neglected.

The proposed theoretical transfer function, for a certain wheel angle, has the

following form:

G(s) =Kp

(1 + sτ1)(1 + sτ2)(5.14)

An identification of the system is performed on the dataset of Figure 5.14 (left).

This data was gathered by fixing the wheels to an angle of φ = 53 °, and applying

the shown input to the rotor. Verification is done on a new dataset, with the

results shown on Figure 5.14 (right). For clarity a scaled version of the input

was added to both plots. The method used to perform this identification is the

prediction error method. The resulting parameters, for the chosen wheel angle,

are: Kp = 0.09, τ1 = 2.8, τ2 = 0.4.

Page 57: Trajectory control of a Snakeboard-robot

5.6 Equivalent speed control 45

Figure 5.14: Left: Dataset used for identification; Right: Verification on another

dataset.

Although the gain of the system changes with the wheel angle, the PID-controller

is tuned at a well chosen angle of φ = 53 °. To motivate this choice, first of all note

that no control is performed for wheel angles less than 22.5 °. The upper limit of

the wheel angle is about 60 °. To have an efficient path, the wheel angle is high

most of the time, so most of the time is spent close to the wheel angle of 53 °. If

the PID-controller is tuned at too low of a wheel angle, the controller will be too

aggressive when the wheel angle is high. Taking all these arguments into account,

φ = 53 ° is a robust choice for all practical trajectories.

A PID-controller is composed of two zeros z1 and z2, and an integrator. By choos-

ing the two zeros at the location of the poles of the identified transfer function,

these will theoretically cancel out. The resulting dynamics should in theory repre-

sent those of an integrator. The degree of freedom that remains is the gain K. This

gain is tuned by hand to eliminate overshoot while keeping a fast settling time. By

collecting terms, the different constants of the PID-controller are calculated from

the following equality:

C(s) = P +I

s+Ds = K

(s− z1)(s− z2)s

(5.15)

The final controller design has the following parameters: P = 84, I = 26, D = 32.

Page 58: Trajectory control of a Snakeboard-robot

5.6 Equivalent speed control 46

As mentioned in Section 4.3, we want to limit the maximal torque produced by the

rotor. This is done by limiting the rotor acceleration to a maximum of 11.2 rad/s2.

Because of differentiation, the noise on the speed measurements gets amplified

a lot. To reduce the influence of this noise, a low pass filter is applied on the

differentiation. This low pass filter has the following format:

Yk = αXk + (1− α)Yk−1 (5.16)

Where Yk and Xk represent the filter output and input respectively at sample time

k. A value of α = 0.2 was chosen. The time constant of this filter is around 250ms,

which is much faster than the dominant time constant of the system. The effect

of this filter on the derivative of the error is seen in Figure 5.15. The left figure

represents the output for a sinusoidal trajectory. The right figure is the output for

the optimal trajectory.

Figure 5.15: Left: Effect of filter for sinusoidal trajectory; Right: Effect of filter

for optimal trajectory.

5.6.4 Rotor control frequency

Based on the performed identification, the time constant for the input damping is

about 400 ms. As will be discussed in Section 6.4, the speed is only calculated once

every 50 ms. In that respect, it makes no sense to control the rotor acceleration at

a rate faster than 20 Hz.

Page 59: Trajectory control of a Snakeboard-robot

PRACTICAL REALISATION 47

Chapter 6

Practical realisation

This chapter mainly focusses on some practical aspects of the implementation on

the real robot. The discussed subjects are not necessary to understand the used

control method, but provide some background information on how some concepts

were implemented in practice.

6.1 Feedback

To have an accurate control of the system, position feedback is wanted. Several

options are discussed below.

� Camera feedback

The main advantage of camera feedback is that its accuracy can be relatively

high. Problems arise for tracking in bigger spaces. This can be solved by

creating a camera system that moves in the room.

� Radio systems

Most radio systems have a very limited accuracy (GPS: 10m, Wifi/Blue-

tooth: 1-5m). Systems exist with an accuracy down to 10 cm [21]. With

some additional filtering it is possible to use this form of feedback. It was

chosen not to use this because of the high cost of the hardware.

� Encoder feedback

With the use of encoders, it is possible to calculate the trajectory of the

Page 60: Trajectory control of a Snakeboard-robot

6.1 Feedback 48

robot. As this method is not an absolute feedback, there will be some drift

in the estimation of the position. This method is the most practical solution

to realize in the timespan of this dissertation, and therefore this will be the

used method.

There are basically three mechanisms that can create an error in the position

estimation of the robot:

� Slip

When the centrifugal force on the wheels becomes too large, it is possible

that the robot would slip. Since this force is proportional to V 2, and the

speed of the robot is very low, slip is not an issue.

� Drift angle

In addition to slip, there is also a phenomenon called drift angle. Because

of centrifugal forces on the wheels, there will be an angle difference between

the followed direction and the direction of the wheels. This is caused by

elasticity of the wheels. This kind of effect mainly has an influence for

vehicles with a high mass and elastic tyres, for instance like a car. The

wheels of the snakeboard are very stiff compared to the normal forces they

will experience. Therefore, this effect is negligible.

� Wheel misalignment

The wheels can be misaligned from the wanted direction. Because the stepper

motors have no absolute feedback, it is important to create a known reference

position for the wheels. This allows for very accurate knowledge of the

wheel angle. The used method to calibrate the stepper motor position is

discussed in Section 6.2. It is also important that the stepper motors don’t

miss steps, because this cannot be detected. Therefore a smooth floor is

preferred. Lastly, because of random variations in friction/elevation of the

floor, the direction of the wheel will show some variations with respect to

the wanted direction. Due to the random nature of these variations, it can

be assumed that the net effect will be limited.

Page 61: Trajectory control of a Snakeboard-robot

6.2 Wheel calibration 49

6.2 Wheel calibration

In order to follow a trajectory accurately, the most important thing is to calibrate

the wheel position. Even a small error in wheel angle can lead to a large error in

the long term. There are two possible effects that lead to an error:

� φf = φb 6= 0: This means that the robot travels in a straight line, but there

is an error in the direction travelled with respect to the direction indicated

by the main frame of the board. The error is linear and can be quantified

as:

E =d

tanφf(6.1)

� φf 6= φb: Instead of travelling along a straight line, the robot now follows a

circle. The error now rises in a nonlinear way with the distance travelled.

In Figure 6.1, the result of these errors is shown. The ideal trajectory has a wheel

misalignment of 0° and follows the y-axis. Note that after a travelled distance of

10 meters the magnitude of the second type of error is more than 10 times larger.

Therefore, this error is the most important, and the focus will be on limiting this

effect.

Figure 6.1: Left: Trajectory error with equal offset on the wheels; Right: Trajec-

tory error with a different offset on the wheels.

Page 62: Trajectory control of a Snakeboard-robot

6.2 Wheel calibration 50

To calibrate the wheels to the straight position, two things are needed:

� Fixed reference position: With stepper motors and relative encoders, it is im-

possible to know at which position the wheels are when the power is switched

on. Therefore there has to be a fixed reference position.

� Position of this reference: Once the wheels are at this reference position, it is

important to know how far this position deviates from the straight position

of the wheels (φ = 0).

6.2.1 Fixed reference

To create a reference position, an end stop was installed on the robot (Section

4.6). To use this end stop as a reference, the wheel base has to collide perfectly

with this end stop. The problem with this approach is that the collision with the

end stop can’t be detected. This is because the resolution of the encoders is less

than the distance travelled by moving the stepper motors over one microstep.

To solve this problem, first some theory about stepper motors is needed. A

schematic representation of a stepper motor is given in Figure 6.2 [22]. When

a certain phase is activated, this generates a magnetic field which wants to align

the rotor with this phase. To increase the accuracy of a stepper motor, microstep-

ping can be used. For example when both phases A and B are activated at the

same time, the magnetic field will be in the middle of these two phases. By chang-

ing the relative amplitude of the currents in phases A and B, the magnetic field

can be at any position in between.

When the wheel base collides with the end stop, the rotor can not move any further.

If the magnetic field moves further away from the rotor, the torque will first rise.

This will happen until there is one full step difference between the preference

position of the rotor and the rotor position itself (Figure 6.3). From this point

on, the aligning torque on the rotor will drop and reach zero when the difference

is equal to two steps. If the magnetic field moves further away than two steps,

the torque becomes negative. The rotor movement is now unstable and moves

in the other direction until a new equilibrium position is reached. This backlash

Page 63: Trajectory control of a Snakeboard-robot

6.2 Wheel calibration 51

Figure 6.2: Working principle of a stepper motor.

that occurs has a magnitude of multiple microsteps, and is detectable with the

encoders. Also, the size of this backlash is always of the same magnitude, and

thus the new equilibrium position after backlashing is a fixed position.

Figure 6.3: Normalized torque of a stepper motor as a function of the angular

deviation (in steps) from the preference position.

The method to reach this fixed reference position is summarized as follows. First

Page 64: Trajectory control of a Snakeboard-robot

6.2 Wheel calibration 52

the stepper motor moves quickly until no wheel movement is detected for multiple

microsteps (collision has occurred). In the next phase, the steps are taken at a

much slower rate. This is because when this backlash occurs, there is a finite

settling time, so the movement is not detected instantaneously. Any steps taken

between the onset of the backlash and the actual detection of this backlash will

result in a deviation from the fixed reference.

6.2.2 Angle to straighten wheels

After determining the reference position, the wheels can be placed approximately

straight in a visual way (while keeping track of the needed amount of microsteps).

If both wheels have the same angle, an error of the first type (Figure 6.1) will

occur. This error can not be detected by encoders because all four wheels will

travel the same distance. What can be detected is an angle difference between

front and back wheels. This will lead to different readings on the left and the right

encoder. Using this information, the wheels can be put into the same orientation.

When this is achieved, only the first type of error will remain. As was discussed

earlier, this error is less important.

In what’s next, the assumption is made that the front wheels are perfectly straight.

When the back wheels are not perfectly straight, the axes of the wheels will travel

in a circle with radius Rf and Rb respectively. This is shown in Figure 6.4. The

distance between the wheels of the same wheel platform measures 2L1 = 340 mm.

This means that the back wheels will travel in a curve with radius r1 = (Rb −170) mm and r2 = (Rb + 170) mm respectively. After an entire circle is travelled,

the difference in travelled distance between both of the back wheels is equal to:

∆D = 2π(r2 − r1)= 4πL1

(6.2)

After an arbitrary distance, the encoder on the outer wheel will have registered

a greater amount of encoder pulses than the inner wheel: N2 > N1. Ni denotes

the amount of encoder pulses on encoder i. Since the amount of encoder pulses

counted by an encoder is proportional to the distance travelled by the wheel:

Page 65: Trajectory control of a Snakeboard-robot

6.2 Wheel calibration 53

N2 −N1

N1

=2π(r2 − r1)

2πr1

⇒ Rb =L1(N1 +N2)

N2 −N1

(6.3)

Now we can use some basic trigonometry to determine φb, which is a measure of

the misalignment:

φb = sin−1 2L

Rb

(6.4)

The total length of the snakeboard, 2L, is a fixed distance which measures 720 mm.

The stepper motor does not allow to correct φb exactly. Only discrete steps of1.8◦

16= 0.1125◦ can be taken. The amount of steps that best matches φb can be

found by:

N = round

[φb

0.1125

](6.5)

Figure 6.4: Calibration parameters.

Since N1 and N2 are integer numbers, the accuracy of this method is limited for

short distances. The next step in this calibration procedure is to calculate how

much distance has to be travelled to detect a misalignment of 1 microstep. For this

misalignment, the travelled path has a radius of Rb = 2Lsinφb

= 720mmsin 0.1125◦

= 366.7 m.

Page 66: Trajectory control of a Snakeboard-robot

6.3 Distance calculation 54

The optical encoders have a resolution of 0.69 mm. As was stated before, the

difference in travelled distance for both wheels will be 4πL1 after one full circle.

After travelling a distance d, this difference is equal to:

∆D =d

2πRb

· 4πL1 (6.6)

For ∆D to be equal to the encoder resolution of 0.69 mm, a distance of d = 0.75 m

needs to be travelled. If both encoders read the same value after a distance of

more than 75 cm, the calibration is accurate up to 1 microstep.

6.3 Distance calculation

For the chosen control method, an accurate feedback of the distance travelled by

the center of mass is necessary. The first step is to determine how many encoders

should be used, and where they should be placed. The easiest solution would be to

add a fifth wheel to the robot, under the center of mass, and thus directly measure

the distance travelled. To limit the amount of mechanical changes to the robot,

this option is not chosen.

Because we control the angle of the wheel platforms (φ), and thus know its value,

in theory it is possible to work with one encoder on one of the wheels. The velocity

relation can then be derived from Figure 6.5:

V2 = V + θ ×L+ (φ+ θ)×L1 (6.7)

Figure 6.5: Kinematic encoder model of the snakeboard.

Page 67: Trajectory control of a Snakeboard-robot

6.3 Distance calculation 55

Note that θ and φ are vectors along the z-axis (rotation vectors). L is the vector

pointing from the center of mass to the rotation axis of the wheel platform. L1 is

the vector pointing from this axis to the center point of the wheel. For an accurate

measurement of V , the number of parameters in this equation should be as low as

possible. One of the main concerns is that the magnitude of L1 is hard to reliably

measure, and may even change over time. This is because we do not know which

part of the wheel will be in contact with the ground (Figure 6.6).

Figure 6.6: Variation of contact point with the ground.

The influence of this effect can be minimized by using an encoder on both front

wheels. From the geometry of the problem (Figure 6.5), it is known that Vf makes

an angle φ with respect to V . Assuming symmetry, Vf = V1+V22

. This gives the

following result:

V =V1 + V2

2cosφ (6.8)

The only assumptions made in this equation are that φ is perfectly known, and

that both wheels behave in a symmetrical way around the rotation center of the

wheel platform. There is no need to know L1 exactly, as long as both wheels have

the same behaviour.

Extra information that would be gathered by working with four encoders is rel-

atively limited. Consider for example a situation where there is an equal offset

on both wheel angles. The robot will follow a straight line and all encoders will

read the same distance. But the direction of this straight line is not the expected

direction. There is no way to detect this kind of phenomenon, so even with four

encoders the accuracy still depends mainly on the knowledge of φ.

Page 68: Trajectory control of a Snakeboard-robot

6.3 Distance calculation 56

Now that the speed of the center of mass is known, the distance travelled can be

calculated. This distance will be noted as d. It is calculated as follows:

d =

∫ t

t0

V dt =

∫ t

t0

V1 + V22

cosφ dt (6.9)

The calculation of a cosine alone already takes about 100µs on the used micro-

controller. Because of this limitation, recalculating the distance travelled on every

encoder pulse is not practical. Instead, calculation is split into multiple intervals.

The distance travelled after interval k is equal to:

dk+1 ≈ dk +D1 +D2

2cosφavg (6.10)

Where D1 and D2 are the distances travelled in the current interval by wheels 1

and 2 respectively. This approximation is only valid if cosφ does not change a lot

in the span of one interval. In Figure 6.7, the error of this approach is estimated.

This depends on the current angle φ and on the amount of microsteps the wheels

moved during the calculation interval. To have a worst case error of below 1.0%, a

maximum of 6 microsteps can be taken in one interval. For an average trajectory,

the maximum stepping speed is about 1100 microsteps per second. Therefore, the

distance should be calculated atleast about 200 times per second. Depending on

the wanted accuracy, this number can be chosen higher or lower.

Figure 6.7: Error made by estimating φavg as φ as a function of the current wheel

angle and the amount of microsteps taken in the calculation interval.

Page 69: Trajectory control of a Snakeboard-robot

6.4 Velocity calculation 57

6.4 Velocity calculation

The velocity can be estimated from the distance measurements discussed above:

V = d2−d1t2−t1 , where di and ti represent the distance and time of two measurement

points. Due to the discrete nature of the encoders, there will always be some un-

certainty on the velocity. For a bigger time difference t2 − t1, the influence of this

discretization in distance will be less. On the other side, because of the longer av-

eraging time, high frequency variations in the speed will be filtered out. Therefore,

a good balance between discretization error and averaging time is needed.

The error is the largest when the average velocity of the wheels is the lowest (less

encoder pulses to average over the measurement interval). Therefore, the first step

is to check where this worst case scenario arises. Assuming that the robot starts

with a velocity V0 in the straight part of the trajectory, the speed of the wheels

will change depending on the current angle on the wheels. Because part of the

kinetic energy goes into the rotation, the speed of the center of mass will drop,

and so does the wheel velocity. A second effect is that because of the angle of the

wheels, the wheels will have to spin faster to reach a certain velocity at the center

of mass. The net effect of these two phenomena is summarized in the following

equation:

Vf = V01√

1 + J tanφ2

ml2cosφ

(6.11)

In this equation, Vf is the average wheel velocity that is reached at a certain wheel

angle φ, if no kinetic energy was lost during the rotation. The factor√

1 + J tanφ2

ml2

describes the effect of part of the kinetic energy going into the rotation (Section

5.3). The factor cosφ comes from (6.8) and converts the velocity of the center of

mass to the average wheel velocity. Equation (6.11) can be rewritten as:

Vf = V01√

cosφ2 + Jml2

sinφ2

(6.12)

Since the factor Jml2

is smaller than one, the velocity of the wheels will always be

faster when turning. From this it follows that the worst case scenario occurs when

Page 70: Trajectory control of a Snakeboard-robot

6.4 Velocity calculation 58

following a straight line. On a straight line, φ is zero, and thus from Equation

(6.10):

dk+1 = dk +D1 +D2

2(6.13)

Where Di is equal to the amount of encoder pulses measured by encoder i mul-

tiplied by the encoder resolution. If the distance travelled in a certain interval is

not exactly a multiple of the encoder resolution, measurements of the velocity can

vary, even if the velocity is constant. For example if both encoders read on average

100.1 pulses per second, each encoder has a 10% chance of reading 101 pulses after

a second. In the worst case scenario, both encoders will read an extra pulse. The

effective amount of pulses measured in one second can vary between 100 and 102.

This means that the peak to peak error, for a constant speed, is equal to:

EPTP =2

n· 100 (6.14)

Where n is the total amount of encoder pulses of both encoders in a time interval

t2− t1. EPTP represents the peak to peak error, as a percentage of the velocity. To

reach a peak to peak error of 5%, the minimum number of encoder pulses needed

per time interval is 40. At a velocity of 27 cm/s, the needed sampling frequency is

about 20 Hz. This gives an accuracy of V = 27±0.675 cm/s. The accuracy will be

better when the robot is not following a straight line. When the robot is turning,

the speed of the wheels is higher, and thus n is higher. This leads to a lower peak

to peak error.

Page 71: Trajectory control of a Snakeboard-robot

RESULTS 59

Chapter 7

Results

In this chapter the results of the implemented controller are analysed. This is done

by performing experiments on the practical setup discussed in Chapter 4. To avoid

running into constraints of rotor speed, symmetrical trajectories around a straight

line are used for most experiments. Because of the lack of absolute feedback, the

focus of this chapter is on verifying the performance of the speed controller. Also

the influence of changing the sinusoidal variations around the straight line will

be examined. To finish, the results on the real robot are compared with results

gathered from a simulation.

7.1 Controller performance

This section discusses the performance of the designed PID-controller versus a P

and PI-controller that were tuned by hand. This will be done for the sinusoidal

trajectory y = 0.08(cos (2.4πx) − 1), shown in Figure 7.1. The robot starts from

zero speed with a setpoint of Veq = 0.27 m/s. After 30 seconds the setpoint is

changed to zero. The used parameters for the controller are shown in Table 7.1.

Page 72: Trajectory control of a Snakeboard-robot

7.1 Controller performance 60

Figure 7.1: Followed path for comparison of controllers.

Table 7.1: Used parameters for the controllers.

Controller P I D

P 140

PI 98 20

PID 84 26 32

The results for a simple P-controller are shown in Figure 7.2. The first graph

represents the actual speed of the robot, while the second graph represents the

equivalent speed as discussed in Section 5.3. The black dashed line represents the

setpoint. The different regions discussed in Section 5.6.2 are drawn in different

colors. Because of friction, there will be a steady state error. This means that the

average equivalent speed will always be below the setpoint. To solve this problem,

a PI-controller is used.

Page 73: Trajectory control of a Snakeboard-robot

7.1 Controller performance 61

Figure 7.2: Top: Real speed of the robot; Bottom: Equivalent speed (P-controller).

In Figure 7.3, the results with the PI-controller are presented. We see that the

average value of Veq is equal to the setpoint. The influence of disturbances is still

rather large. This is improved upon by our final PID-controller.

Figure 7.3: Top: Real speed of the robot; Bottom: Equivalent speed (PI-

controller).

Although the chosen PID-controller has a higher settling time (Figure 7.4), the

error on Veq has improved a lot. The reason for this higher settling time is that the

controller is designed such that it not only works for sinusoidal variations around

a trajectory, but also for other trajectories like the optimal trajectory discussed in

Section 5.5.

Page 74: Trajectory control of a Snakeboard-robot

7.1 Controller performance 62

Figure 7.4: Top: Real speed of the robot; Bottom: Equivalent speed (PID-

controller).

At the end of the trajectory, the last two controllers seem to perform worse when

trying to reach Veq = 0. This can be explained by looking at the input to the

system, shown in Figures 7.5 to 7.7. For both the PI and PID-controller, the rotor

velocity hits its upper limit before Veq reaches zero. At this point, the rotor is

unable to decelerate the robot. The robot is now only slowed down by rolling

resistance.

Also note that due to the relatively high speed of the robot, the rotor speed

compensation (cyan) only has a limited effect. Better examples will be discussed in

Section 7.3. This underlines the importance of planning a good path and choosing

the right speeds to travel this path.

Figure 7.5: Top: Applied rotor acceleration; Bottom: Rotor velocity (P-controller).

Page 75: Trajectory control of a Snakeboard-robot

7.1 Controller performance 63

Figure 7.6: Top: Applied rotor acceleration; Bottom: Rotor velocity (PI-

controller).

Figure 7.7: Top: Applied rotor acceleration; Bottom: Rotor velocity (PID-

controller).

To quantitatively compare the three controllers, use is made of the RMS error

defined as follows:

Erms =

√1

t2 − t1

∫ t2

t1

(Veq(t)− Vref (t))2 dt (7.1)

This will be calculated for both the complete time interval and the interval 5-25

seconds. This second measure is added because of the slower settling time of the

PID-controller. Also we already know that in some cases the performance at the

end is worse due to the rotor speed reaching its maximum.

Page 76: Trajectory control of a Snakeboard-robot

7.2 Optimal Trajectory 64

Table 7.2: Comparison of the RMS value of the error for the different controllers.

Time interval P PI PID

0-end 0.0558 0.0627 0.0573

5-25 0.0275 0.0192 0.0135

As expected, the improvement is not noticeable when looking at the full time

interval. Once the robot needs to maintain a constant setpoint, we see a clear

drop in the RMS error. Adding the integrator reduces the RMS error by about

30%, going to full PID-control again adds an improvement of about 30%. Also

note that RMS error of the PID-controller is about equal to the expected peak to

peak error of the speed measurement.

Because of the lack of absolute feedback, no performance measure can be calcu-

lated for the position control along the trajectory. To have some indication of

performance, some trajectories with a length of 5 to 7 m were followed. One of

these trajectories is the one shown in Figure 1.2. The observed deviation at the

endpoint was never bigger than 20 cm, which is in line with what we expected. A

video of the robot travelling this trajectory can be viewed at [23]. In this video,

we can clearly see the effect of the rotor reaching its minimal speed of 0 rpm. The

robot can not accelerate until the wheels have switched orientations. This shows

the importance of path planning, keeping in mind the constraints of the robot.

7.2 Optimal Trajectory

In this section, the results for following the optimal trajectory are discussed. The

chosen trajectory consists of circles with a radius of 22 cm, followed for 2 seconds,

joined by transition regions of 1 second. This is shown in Figure 7.8. One could

increase the time spent on the circles more. This will lead to a higher control

efficiency (more time on a smaller radius), but also leads to a much smaller net

displacement along the x-axis.

Page 77: Trajectory control of a Snakeboard-robot

7.2 Optimal Trajectory 65

Figure 7.8: The used path to verify the increase in efficiency.

The results for following this trajectory are shown in Figures 7.9 and 7.10. When

the robot switches between circles a large peak in the velocity occurs. This is

because the robot rotates slower in these transition regions and thus more kinetic

energy is available for the translation. For this kind of trajectory, controlling the

robot to a constant speed would need a very powerful motor to compensate these

peaks in velocity. These results make the effect of working with the equivalent

velocity as controlled variable very clear. The peaks are totally invisible in Veq, so

there is no need to compensate these.

Figure 7.9: Top: Real speed of the robot; Bottom: Equivalent speed (PID-

controller; optimal path).

Page 78: Trajectory control of a Snakeboard-robot

7.2 Optimal Trajectory 66

The real reason to work with this kind of path is to further reduce the needed

rotor acceleration. Therefore, we will compare the used rotor acceleration to follow

this path with the acceleration necessary for the sine path shown above. This is

done with the same setpoint of Veq = 0.27 m/s. Since the goal is to limit the

needed speed range of the rotor, the RMS value of the rotor acceleration is a bad

performance measure. High peak values would have a much higher weight. A

better performance measure P is the following:

P =1

T

∫|δ| dt (7.2)

Where T is the total integration time. P represents the average of the absolute

value of the rotor acceleration. A lower value is better. This value will be calculated

for different cases. The first case is just the full trajectory. To look at the influence

of the start, the second case takes the full trajectory starting from t = 5 s. Because

the sine path has a larger region where it can compensate the rotor speed to the

middle of its range, these compensation regions are excluded in the third case.

The last case excludes both the start and the compensation regions. The results

are shown in Table 7.3.

Table 7.3: Comparison of the needed rotor acceleration (rad/s2) to follow a tra-

jectory.

Sinusoidal path Optimal path

Full interval 3.47 2.94

No start 3.21 2.69

No compensation 3.29 2.87

No start, No compensation 2.96 2.63

The optimal trajectory scores about 15− 20% better in every case. As expected,

the rotor compensation plays a bigger role for the sinusoidal path. This can be

seen by comparing the difference of rows 1 and 3. For completeness, the rotor

speed and acceleration along the optimal trajectory are shown in Figure 7.10.

Page 79: Trajectory control of a Snakeboard-robot

7.3 Rotor speed compensation 67

Figure 7.10: Top: Applied rotor acceleration; Bottom: Rotor velocity (PID-

controller; optimal path).

7.3 Rotor speed compensation

In the previous experiments, the effect of the rotor speed compensation was pretty

limited. To see the full effect of this compensation, the same straight sinusoidal

trajectory as in Section 7.1 is travelled at a lower speed. An example of the rotor

speed, both with and without this compensation, is shown in Figure 7.11. Without

compensation, the rotor speed clearly drifts away from the middle of its range.

Figure 7.11: Typical rotor speed profile (Left: uncompensated; Right: compen-

sated).

The result of rotor speed compensation can also be improved by more careful path

Page 80: Trajectory control of a Snakeboard-robot

7.3 Rotor speed compensation 68

planning. For example every few sinusoidal pieces of path, there is a straight

section where the rotor speed can be brought to the middle of it’s range. An

example of this is shown in Figure 7.12. This has as advantage that the robot can

reach much higher speeds, and still have the time to adjust its rotor speed. The

downside of this is that in the longer straight sections, the speed of the robot can

not be controlled. Another downside is that the transition from a sine path to a

straight part has to be carefully planned to allow for a continuous change in wheel

angle.

Figure 7.12: Example of a path where straight sections are added.

This last disadvantage can be overcome by simply modifying a standard sine

shaped trajectory. A sine wave has two points per period where the wheel an-

gle is equal to zero degrees. If at those two points a straight section is added, the

path is still symmetrical. This idea is represented in Figure 7.13. This method

has as advantage that the wheel angle is now continuous without adding extra

planning.

The length of the straight sections is an important design parameter. It has to be

long enough to allow for enough compensation of the rotor speed. But if it is too

long, the speed of the robot will drop drastically. This is because controlling the

speed of the robot is not possible in a straight section. A typical rotor speed profile

while travelling the trajectory of Figure 7.13 is shown in Figure 7.14. Due to the

long straight section, the rotor speed can always return to 75 rpm. But because

of the longer length of one period of the path, more energy has to be added per

Page 81: Trajectory control of a Snakeboard-robot

7.3 Rotor speed compensation 69

Figure 7.13: Left: Standard sine path; Right: Sine trajectory with extended

straight interval.

period. This explains why the red peaks are larger than normal.

Figure 7.14: Rotor speed along a modified sinusoidal path.

From these last two sections, it becomes clear that one of the most important

problems in an effective navigation of a snakeboard is the path planning. An ideal

trajectory might for example exist of pieces of the optimal trajectory. If the rotor

speed comes too close to one of its extreme values, a period with some straight

sections may be added. This ensures that the motion is efficient, and also that the

rotor speed will not reach its extremes.

Page 82: Trajectory control of a Snakeboard-robot

7.4 Simulation versus real implementation 70

7.4 Simulation versus real implementation

To conclude this chapter, we will examine the performance of the mathematical

model derived in Chapter 2 (including rolling resistance). The used control al-

gorithm is implemented in Matlab and a simulation is performed over the same

trajectory. The sampling time for this simulation is also equal to 50 ms. The error

in the speed measurement is modelled as Gaussian noise. The standard deviation

of this noise is chosen such that a decent approximation is made of the 5 % peak

to peak error discussed in Section 6.4.

The results of this simulation compared to measurements on the real robot are

shown in Figures 7.15 to 7.18. It is clear that the simulation gives a realistic

representation of the robot. Figure 7.15 shows the control effort. We clearly see

that the average rotor acceleration is the same magnitude in both cases. In the

case of the real experiment, the average rotor acceleration over one period changes

from period to period. This is because of variations of the slope of the floor.

These disturbances depend on the testing location and have not been modelled

in the simulation. The rotor speed profiles are shown in Figure 7.16. Here we

clearly see that the simulation has to do more effort to get up to speed. A possible

explanation of this is again due to the slope of the floor. Once the robot is in

steady state, there is a good match with the real experiment. Figure 7.17 shows

the equivalent speed, as defined in Section 5.3, of the real experiment and the

simulation. The step responses look very similar. The bigger disturbances are

again caused by variations in the floor surface. Figure 7.18 shows the measured

and simulated speed over time.

Page 83: Trajectory control of a Snakeboard-robot

7.4 Simulation versus real implementation 71

Figure 7.15: Top: Applied rotor acceleration; Bottom: Simulated rotor accelera-

tion.

Figure 7.16: Top: Applied rotor speed; Bottom: Simulated rotor speed.

Figure 7.17: Top: Measured equivalent speed; Bottom: Simulated equivalent

speed.

Page 84: Trajectory control of a Snakeboard-robot

7.4 Simulation versus real implementation 72

Figure 7.18: Top: Measured speed; Bottom: Simulated speed.

Due to small speed differences accumulating, a phase difference will occur be-

tween both graphs. To plot both curves on one graph, it is better to use the

travelled distance d as coordinate on the x-axis instead of time. Figure 7.19 and

7.20 show the speed signals with respect to the travelled distance. The influence

of non equal speeds is now visible in the shorter distance that was travelled in the

simulation.

Figure 7.19: Measured and simulated equivalent speed as a function of distance.

Page 85: Trajectory control of a Snakeboard-robot

7.4 Simulation versus real implementation 73

Figure 7.20: Measured and simulated speed as a function of distance.

Again both simulation and the real experiment show very similar dynamics. In

conclusion, the used mathematical model predicts the system very well. Most of

the error compared to the real system is caused by the disturbance of floor gradient

variations.

Page 86: Trajectory control of a Snakeboard-robot

CONCLUSION AND FUTURE DEVELOPMENTS 74

Chapter 8

Conclusion and future

developments

This master dissertation was mainly focused on improving the existing robot to

enable the realisation of trajectory control along a given trajectory. Although an

optimal path was determined to minimize the needed rotor acceleration, no theory

for general path planning was developed. As we see it, this holds the largest future

challenge. This investigation can also be extended to include obstacle avoidance.

In this chapter, a short introduction of how we see these problems is given. Also

some changes will be discussed on how a better snakeboard robot can be built.

8.1 Path planning

Path planning can be approached from different angles. The most general, least

constrained, case is when only the initial and final position of the center of mass are

given. In this case a straight line can be defined which connects these two points.

A sinusoidal path or the optimal path can be superposed on this line to enable

the robot to create net motion in that direction. This curve should have sufficient

curvature to allow for efficient actuation and control. However the curvature can

not be too large, due to the limitations of stability. Also, the sign of the curvature

should change frequently enough such that the rotor stays within its speed range.

Another design factor is the length of the straight parts of the trajectory to allow

Page 87: Trajectory control of a Snakeboard-robot

8.1 Path planning 75

for efficient rotor speed compensation. Other constraints are on the wheel angles

and the needed torque from the stepper motors to changes these wheel angles. An

example of this method can be seen on Figure 8.1. The superposed signal is based

on a sine wave. The period of the superposed sine wave is modified such that the

path consists of an integer amount of sine waves.

Figure 8.1: Example of a straight forward path planning method.

Note that in this approach the orientation and wheel angles in the initial and

final point are assumed to be adapted to the generated path. In reality the initial

and final orientation are extra constraints on the problem. This can be taken

into account by generating a curve which does not only connect the initial and

final point but which is also tangent to the wanted orientation in these points. A

promising parametric curve which is able to deal with this problem is the Bezier

curve. The general definition of a Bezier curve of order n is:

B(t) =n∑

i=0

(n

i

)(1− t)n−itiPi, 0 ≤ t ≤ 1 (8.1)

The points Pi are called the control points. The parameter t is only used to

generate the trajectory. The Bezier curve has a couple of interesting properties:

� The kth first derivatives at the start (end) of a Bezier curve only depend on

the first (last) (k + 1) control points.

Page 88: Trajectory control of a Snakeboard-robot

8.1 Path planning 76

– k = 0: The initial and final positions of the curve are the first and last

control points.

– k = 1: In its starting point, the Bezier curve is tangent to the line

connecting the first two control points. The same holds for the end

point and the last two points.

� The Bezier curve is contained in the convex hull of its control points.

More information on the properties of Bezier curves can be found in [24].

In order to connect any two points and account for the wanted orientations in these

points a Bezier curve of order n = 3 is needed. This curve uses four control points

and thus has 8 degrees of freedom. The initial and final constraints only need 6

degrees of freedom. The remaining freedom can be used to optimize the resulting

curve. The same technique as above can be used to modify this path such that

the robot can move along it. Figure 8.2 show an example of this method. Note

that the assignment is to move from one black dot to the other. The red dots are

the additional control points of the Bezier curve to make the curve tangent to the

orientations.

Figure 8.2: Example of a path planning method including orientation constraints.

For this method the robot is assumed to be at rest in its initial position such that

the wheel angles can be adjusted to the generated path without consequences. In

Page 89: Trajectory control of a Snakeboard-robot

8.2 Obstacle avoidance 77

order to overcome this assumption a full path planning method should be created

which also takes into account the initial and final curvature. Finding such a curve

is no longer straight forward and will be left for future research.

When the distance between the two endpoints is of the order of one period, super-

posing a sine wave no longer makes sense. Then the problem can be tackled by

trying to create a Bezier curve which directly satisfies the curvature constraints

in the endpoints. As the curvature at a certain point depends on the first and

second derivatives of this curve, the constraints from the initial configuration can

be satisfied with the first three control points. The same can be said about the

constraints of the final configuration and the last three control points.

From this, one can conclude that six points suffice to satisfy the constraints inde-

pendently [25]. This leads to a Bezier curve of order n = 5. However, it can also

be shown that an order of n = 4 suffices to satisfy these constraints. An example

of the implementation of this method can be seen on Figure 8.4.

The main challenge here is finding a trajectory that is suitable for a snakeboard

robot. The needed path needs a certain amount of curvature to allow for efficient

actuation and control. However the curvature can not be too large, due to the

limitations of stability. Other limitations include the speed and acceleration with

which the wheel angle can change. This problem can be solved by using nonlinear

numeric optimization methods.

Note that the suggested Bezier curve of order n = 5 actually contains 12 degrees of

freedom while the initial and final configuration only use eight degrees of freedom.

From this one can conclude that there is certainly room for optimization.

8.2 Obstacle avoidance

The realized path planning method can be extended to an algorithm for obstacle

avoidance. This can be done by using the convex hull property of the Bezier curve.

This states that the curve will be contained inside the convex hull of its control

points. The convex hull can be seen as the area that would be spanned by an

elastic band around the control points.

Page 90: Trajectory control of a Snakeboard-robot

8.2 Obstacle avoidance 78

A possible method for obstacle avoidance is explained in Figure 8.3. The goal is to

navigate from the left black star to the right black star without colliding with the

objects (the squares filled with waves). This is done by creating subspaces which

do not contain any objects. These are the blue squares of the figure. Also note

that the objects were virtually enlarged to account for the spatial dimensions of

the robot and the amplitude of the path that will be superposed upon it.

Now a parametric representation of the border points (indicated by yellow stars)

can be defined. The exact position of these border points is determined together

with the green stars which are the other control points of the Bezier curves. Note

that Bezier curves of order n = 5 are used such that the change between adjunct

curves happens at constant curvature. This is needed to be able to superpose a

signal upon it which the robot can follow.

When all the control points of the Bezier curve which connect two border points

lie within the blue square, then the convex hull theory states that the curve will

lie inside the blue square and the robot will thus not collide with any objects.

Figure 8.3: Obstacle avoidance using Bezier curves of order n = 5 (sketch).

Page 91: Trajectory control of a Snakeboard-robot

8.3 Absolute feedback 79

8.3 Absolute feedback

In this master dissertation, a trajectory control method is presented based on

partial feedback. The trajectory consists of a two dimensional path for the center

of mass of the robot and the kinetic energy with which this path needs to be

followed. The partial feedback is realised with discrete encoders on the wheels of

the robot. This enables an accurate tracking of the travelled distance and through

derivation also the speed of the robot. The limitations of this method are that no

compensation is possible for errors that build up due to calibration errors, slip of

the wheels, missing of steps, ...

In this section a method will be presented that can control the path when absolute

feedback is available. This absolute feedback gives the x and y position of the

center of mass and the orientation of the board θ. When these values deviate too

much from the predefined path, a new path needs to constructed. This can be

done in two different ways. The first method is to recalculate the total base line

and modify it to a curve which allows efficient locomotion of the robot. With this

method the previous path is completely neglected. If this is not desired a new

reference path can be calculated which converges to the initial path, this is the

second method. The main design parameter in this path planning is the point of

convergence with the previous path. The choice of this point mainly depends on

the constraints of the robot, and thus should not be too close. Also a location too

far away will lead to poor behavior. Once the endpoint of this path is known, the

path planning method which uses a Bezier curve can be used.

Page 92: Trajectory control of a Snakeboard-robot

8.4 Design improvements 80

Figure 8.4: Top: Original and new reference path; Bottom left: Orientation along

path; Bottom right: Wheel angle along path.

Figure 8.4 shows an implementation of the absolute feedback using Bezier curves

of order n = 4. The blue stars represent the configuration detected by the absolute

feedback. The black stars indicate the configuration where the robot needs to be

back on track. The three additional control points which make up the Bezier curve

are displayed as red stars in the top figure. The resulting path, orientation and

wheel angles are displayed as red curves on the respective figures.

8.4 Design improvements

In this section, several design changes will be discussed to improve the snakeboard

robot.

� Wheel position control: currently the wheel orientation is controlled by step-

per motors. There are several drawbacks to this kind of system. Due to the

large weight of the robot and the low torque of these motors, steps are easily

missed due to small objects/ridges blocking the wheels. Also due to random

variations of gradient and friction, the position of these wheels will deviate

multiple microsteps around the wanted position. These problems can be

fixed by implementing a closed loop servo system to control the wheel angle.

Another solution would be to use stepper motors with a gearbox. This will

Page 93: Trajectory control of a Snakeboard-robot

8.4 Design improvements 81

increase both the maximal torque and the gradient of the torque-wheel angle

characteristic, and thus decrease the mentioned problems.

� Lower battery weight: The current lead acid batteries have a very low gravi-

metric energy density [26]. If lithium based batteries are used, this drastically

decreases the weight of the robot. A lower weight also leads to lower friction

losses. Another added benefit is that also the volumetric energy density of

lithium based batteries is much higher [26]. Therefore it is possible to place

the batteries such that the center of mass of the robot is much lower. This

improves the stability of the robot when taking sharp corners.

� Frame/rotor construction: Like mentioned before, the ideal snakeboard robot

has a low weight (and thus low friction) with a low center of mass. Improve-

ments can surely be made with respect to the current set up. If the weight

drops drastically, the friction will also drop drastically. This means that a

less powerful motor is necessary, and thus also less battery capacity is needed.

These things lead to an even lower weight of the robot.

� Support wheels: If the full range of φ = 0 ° to φ = 90 ° is wanted, support

wheels can be added that prevent the robot from tipping over. This does

not increase the efficiency of the robot drastically, but it allows the robot to

follow trajectories with sharper turns.

� Physical brake: The rotor speed compensation explained in Section 5.6.2

accelerates the rotor to the middle of its speed range. This is because the

wanted speed setpoint is not known in advance. Depending on if the robot

has to accelerate or decelerate, the sign of the rotor acceleration is different.

Therefore the middle of the speed range is the optimal value. However,

when the system can be decelerated through braking forces on the wheels,

the entire speed range of the rotor could be made available for accelerating

the system. Because of this, the path planning can allow longer sections with

the same sign of curvature. Note that the implementation of this braking

system should be as light as possible.

Page 94: Trajectory control of a Snakeboard-robot

8.5 Conclusion 82

8.5 Conclusion

In conclusion, we can say that although the equations that describe the snakeboard

are highly nonlinear, still a relatively simple and intuitive control strategy is pos-

sible. In general this system needs relatively powerful hardware to reach limited

speeds, but this can be improved by making a smart choice of trajectory. Another

aspect that was only briefly touched is that the design of the robot can make a

huge difference. As described in the last few paragraphs, a lot more aspects of

designing, controlling and path planning of the snakeboard remain to be explored.

Page 95: Trajectory control of a Snakeboard-robot

DC MOTOR AND DRIVER 83

Appendix A

DC Motor and driver

Page 96: Trajectory control of a Snakeboard-robot

RHINO MOTION CONTROLS RMCS-2302 50V 20A DC motor driver w/t PWM speed control (Max. 50Vdc and 20A)

http://www.rhinomc.com http://www.rhinomotioncontrols.com Page 2

High-Torque DC Motor Driver w/t PWM Interface [RMCS-230X]

Key Features Smooth and quiet operation at all speeds

Zero-Backlash DC Servo Motor Performance

Input supply voltage from 12VDc to 50VDC

Selectable Gain Multiplier

Selectable Error Limit

Pots for tuning of Speed, Back Emf and Dampness.

LED indication for power and error states

Description Thank you for purchasing RMCS-2302 50V 20A drive/controller. The Speed and Direction of the DC motor

are controlled by PWM and DIRECTION digital interface.

Technical Specifications Specification Min Max Units Comments

Supply Voltage 12 50 Volts DC Between +Ve and GND Current 0.5 20 Amps Current Limit Pot DIR voltages 0 5 Volts DC Between + and – input pins Ambient Temp. 0 70 Celsius Humidity 0 95% Non condensing PWM Frequency 1 20 kHz

Mechanical Specifications Specification Details

Dimensions (L * W * H) 100mm * 75mm *25mm Weight 155gms Heat Sink Anodized Aluminum 3mm thickness Mounting Screw Holes 3.6mm minimum diameter

Page 97: Trajectory control of a Snakeboard-robot

RHINO MOTION CONTROLS RMCS-2302 50V 20A DC motor driver w/t PWM speed control (Max. 50Vdc and 20A)

http://www.rhinomc.com http://www.rhinomotioncontrols.com Page 3

High-Torque DC Motor Driver w/t PWM Interface [RMCS-230X]

Power and Motor Terminal Assignments Terminal No. Terminal Name Description

Terminal 1 GND Power Ground or Power –Ve Terminal 2 +V Power +Ve (12VDC to 50VDC Max wrt. GND) Terminal 3 Motor 1 DC motor connection 1 Terminal 4 Motor 2 DC motor connection 2

INPUT Terminal Assignments Terminal No. Terminal Name Description

Terminal 1 PWM+ PWM signal input Terminal 2 PWM- GND Terminal 3 DIR+ 0/5V input for altering DIR Terminal 4 DIR- GND

Potentiometer settings (From left of board)

Pot No. Pot Name Description

Pot 1 Proportional Gain Proportionally increase or decrease the speed gain Pot 2 Integral Gain To compensate for load using back EMF setting Pot 3 Differential Gain To reduce or increase the dampness of the PWM and direction input

Power Supply Selection A high-torque DC motor requires high current during startup and during high load or irregular load

conditions. The general rule of thumb to make sure your power supply is adequate for a DC motor is to

make sure it can supply the maximum current required by the motor during stall condition. It is also good

practice to have sufficient low –ESR decoupling capacitors on the output of the supply before you connect

it to a DC motor drive. This is to make sure that the motor driver does not reset or suffer from variations

in speed due to an insufficient or unregulated supply.

Page 98: Trajectory control of a Snakeboard-robot

ENCODER DRAWINGS 86

Appendix B

Encoder drawings

Page 99: Trajectory control of a Snakeboard-robot

ENCODER DRAWINGS 87

Page 100: Trajectory control of a Snakeboard-robot

CONNECTION TABLE 88

Appendix C

Connection table

Table C.1: Connection table for the Arduino Mega controller

Pin Function Description

2 E0CHA Encoder 0 Channel A output

3 E1CHA Encoder 1 Channel A output

4 E0CHB Encoder 0 Channel B output

5 E1CHB Encoder 1 Channel B output

7 PWMDC PWM input for DC motor driver

8 DIRDC Direction input for DC motor driver

11 CE CE pin of the nRF24L01+ module

12 CS NRF Chip select of the nRF24L01+ module

16 E2CHB Encoder 2 Channel B output

18 E2CHA Encoder 2 Channel A output

28 NXT2 Next step input for stepper motor driver 2

30 DIR2 Direction choice for stepper motor driver 2

32 SS2 Slave select for stepper motor driver 2

35 NXT3 Next step input for stepper motor driver 3

36 DIR3 Direction choice for stepper motor driver 3

38 SS3 Slave select for motor stepper driver 3

40 SoftMISO Master In Slave Out for both stepper motor drivers

42 SoftMOSI Master Out Slave In for both stepper motor drivers

44 SoftCLK SPI Clock for both stepper motor drivers

51 MOSI Master Out Slave In for the nRF24L01+ module

50 MISO Master In Slave Out for the nRF24L01+ module

52 SCK SPI Clock for the nRF24L01+ module

Page 101: Trajectory control of a Snakeboard-robot

USER MANUAL 89

Appendix D

User manual

This section will give a brief summary of how to get started with the snakeboard

robot. The robot is powered by two 12V batteries in series which can be switched

on and off with a physical switch on the robot. These power both the motor drivers

and the Arduino Mega controller. When the power is turned on, the program on

the Arduino starts running automatically.

Before continuing, make sure that the correct software is installed. The software

needed to open the Arduino files and to upload them to the Arduino Mega 2560

controller can be downloaded for free from the official website of Arduino. The

extra libraries that need to be installed can be found on the attached disc which is

glued on the final page of this dissertation. To upload programs from the computer

to the Arduino microcontroller a USB A/B cable is needed.

Aside from the Arduino software, the main part of the other files on the attached

disc are Matlab files. Only functions which are included in the standard installation

are used.

The Arduino program to follow a certain trajectory is called Thesis FullProgram.ino.

The trajectory is represented by a combination of two arrays. One contains the

travelled distance along the path, the other the respective wheel angle at that

distance. In order to speed up some of the calculations, the cosine of the wheel

angle and the conversion factor of Equation (5.8) are added as a third and a fourth

array. A few paths are already available in the program. The wanted path can be

Page 102: Trajectory control of a Snakeboard-robot

USER MANUAL 90

uncommented before compiling.

Extra trajectories can be added with the use of the Matlab script called: Gen-

erateTrajectory.m. This program converts a parametric expression of the path to

the four arrays explained above and saves them to a text file called path.txt. This

file also includes the declaration of the arrays such that its content can simply

be copied into the Arduino program Thesis FullProgram.ino. An example of how

to generate special trajectories without a parametric representation is found in

OptimalPath.m.

To be able to receive data via the wireless connection, a second Arduino board

is needed. The program that needs to be uploaded to this board is named Re-

ceiver.ino. This board has to be connected to the receiving computer, with the

serial monitor open. As soon as the robot starts sending data, this data will be

printed into the console. An example output is given in Figure D.1.

Figure D.1: Example output of the serial monitor

The output format is as follows:

<Time (ms)> <integral of error on Veq> <encoder 0 count> <encoder 1 count>

<DC motor acceleration (rpm/7.5ms)> <DC motor speed (rpm)> <φ (microsteps)>

Page 103: Trajectory control of a Snakeboard-robot

USER MANUAL 91

<V (m/s)> <Veq/V >

This data can be saved to a text file and loaded with the Matlab script plotFeed-

back.m to make clear visual graphs.

Page 104: Trajectory control of a Snakeboard-robot

BIBLIOGRAPHY 92

Bibliography

[1] Jim Ostrowski et al., Nonholonomic Mechanics and Locomotion: The Snake-

board Example, Jim Ostrowski et al., IEEE, 1994.

[2] Jonathan Jamieson, Dynamics and Simulation of a Snakeboard’s Motion, Uni-

versity of Strathclyde Glasgow, 2012.

[3] A. R. Asnafi - M. Mahzoon, Some flower-like gaits in the snakeboards locomo-

tion, Springer Science+Business Media, 2006.

[4] A. Asnafi and M. Mahzoon, Some New Robust Pseudo Forward and Rotation

Gaits for the Snakeboard, Sharif University of Technology, Scientia Iranica, Vol.

15, No. 5, pp 644-651, October 2008.

[5] A.S. Kuleshov, Further Development of the Mathematical Model of a Snake-

board, Lomonosov Moscow State University, 2007.

[6] Tony Dear et al, Snakeboard motion planning with local trajectory information,

California, 2013.

[7] Tony Dear et al, Snakeboard Motion Planning with Viscous Friction and Skid-

ding, IEEE, 2015.

[8] Stefano Iannitti et al, Minimum Control-Switch Motions for the Snakeboard: A

Case Study in Kinematically Controllable Underactuated Systems, IEEE, 2004.

[9] Francesco Bullo and Andrew D. Lewis, Kinematic controllability and motion

planning for the snakeboard, IEEE, 2002.

[10] Bharat Mohan Redrouthu et al, Tyre modelling for rolling resistance (Mas-

ter’s thesis), Chalmers University Of Technology 2014.

Page 105: Trajectory control of a Snakeboard-robot

BIBLIOGRAPHY 93

[11] Sebastian Verhelst, Autotechniek - 2.4.1 Rolweerstand , University Of Ghent,

2014-2015.

[12] Simon Houwen, Ontwerp en realisatie van een snakeboard-robot (Master’s the-

sis), Howest, 2010-2011.

[13] AMIS 30421 Micro-Stepping Stepper Motor Bridge Controller, http://www.

onsemi.com/pub_link/Collateral/AMIS-30421-D.PDF.

[14] Setting PWM frequency on the Arduino, http://playground.arduino.cc/

Code/PwmFrequency.

[15] ATmega2560 datasheet, 2014, http://www.atmel.com/images/

atmel-2549-8-bit-avr-microcontroller-atmega640-1280-1281-2560-2561_

datasheet.pdf.

[16] AEDR-8300 datasheet, Avago Technologies, 2007, www.avagotech.com/

docs/AV02-0088EN.

[17] Encoder Measurements: How-To Guide, 2013, http://www.ni.com/

tutorial/7109/en/.

[18] RF24 library, 2016, https://github.com/TMRh20/RF24.

[19] The Serial Peripheral Interface, http://avrbeginners.net/architecture/

spi/spi.html.

[20] nRF24L01 Transceiver IC, Nordic Semiconductor, http://www.nordicsemi.

com/eng/Products/2.4GHz-RF/nRF24L01.

[21] Ultra-wideband positioning system, 2016, https://www.pozyx.io/.

[22] Stepper motor basics, 2016, http://www.orientalmotor.com/technology/

articles/stepper-motor-basics.html.

[23] Video: Trajectory control of a snakeboard robot, 2016, https://youtu.be/

691MAhXD6F8.

[24] A Primer on Bzier Curves, http://pomax.github.io/bezierinfo/.

Page 106: Trajectory control of a Snakeboard-robot

BIBLIOGRAPHY 94

[25] Ji-wung Choi et al, Continuous Curvature Path Generation Based on Bezier

Curves for Autonomous Vehicles, 2010.

[26] Battery cell comparison, http://www.epectec.com/batteries/

cell-comparison.html.

Page 107: Trajectory control of a Snakeboard-robot

LIST OF FIGURES 95

List of Figures

1.1 A real snakeboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Example path from point A to point B (Blue: normal path, Red:

Modified path to allow the snakeboard to move efficiently). . . . . . 2

1.3 The robot used in this dissertation for testing the control strategy. . 3

2.1 Schematic representation of the snakeboard. . . . . . . . . . . . . . 6

2.2 Radius is controlled by the wheel angles. . . . . . . . . . . . . . . . 8

2.3 Shift of reaction force during free rolling. . . . . . . . . . . . . . . . 10

2.4 Friction on wheels resulting in net torque. . . . . . . . . . . . . . . 10

3.1 Blue: results of a friction test; Red: Linear regression performed on

the data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.2 Velocity profile during the inertia test. . . . . . . . . . . . . . . . . 14

3.3 The ”drive” gait. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.4 The ”drive” gait starting to change direction after 50s. . . . . . . . 18

3.5 Left: Net x-displacement as a function of time time; Right: Close-

up over same time frame as path depicted in Figure 3.4. . . . . . . 18

3.6 The ”rotate” gait. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.7 The ”parking” gait. . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

4.1 Maximal torque as a function of rotational speed. . . . . . . . . . . 22

4.2 Left: Top view driver; Middle: Bottom view driver; Right: Opto-

coupler board. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

4.3 Left: Working principle of reflective encoders; Right: Reflective disk. 25

4.4 The NRF24L01+ module that was used for wireless communication. 26

4.5 Close-up of the end stop construction. . . . . . . . . . . . . . . . . 26

Page 108: Trajectory control of a Snakeboard-robot

LIST OF FIGURES 96

5.1 A path can be represented as a distance and a curvature in function

of this distance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

5.2 Position response for a step input to the position of the stepper

motors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

5.3 Left: Speed profile without rotor actuation; Right: The followed path. 31

5.4 Needed rotor acceleration to reach a constant speed. . . . . . . . . . 31

5.5 Influence of the wheel angle on the magnitude of friction losses. . . 35

5.6 Left: Theoretical optimal path; Right: Wheel angle needed to follow

this path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

5.7 Left: Optimal wheel angle profile; Right: Angular velocity of the

stepper motors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

5.8 Left: Optimal wheel angle as a function of travelled distance; Right:

Optimal path with continuous curvature. . . . . . . . . . . . . . . . 38

5.9 Path followed if the circular part spans more than half of a circle . . 39

5.10 Block diagram of the full control loop. . . . . . . . . . . . . . . . . 40

5.11 Left: A snakeboard path around a large circle; Right: Simulated

rotor speed profile. . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

5.12 Example of the different control regions along a path (φ0 = 9°, φ1 =

22.5°). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

5.13 Influence of wheel angle and rotor acceleration on dEc

dtfor Veq =

0.27 m/s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

5.14 Left: Dataset used for identification; Right: Verification on another

dataset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

5.15 Left: Effect of filter for sinusoidal trajectory; Right: Effect of filter

for optimal trajectory. . . . . . . . . . . . . . . . . . . . . . . . . . 46

6.1 Left: Trajectory error with equal offset on the wheels; Right: Tra-

jectory error with a different offset on the wheels. . . . . . . . . . . 49

6.2 Working principle of a stepper motor. . . . . . . . . . . . . . . . . . 51

6.3 Normalized torque of a stepper motor as a function of the angular

deviation (in steps) from the preference position. . . . . . . . . . . . 51

6.4 Calibration parameters. . . . . . . . . . . . . . . . . . . . . . . . . 53

6.5 Kinematic encoder model of the snakeboard. . . . . . . . . . . . . . 54

6.6 Variation of contact point with the ground. . . . . . . . . . . . . . . 55

Page 109: Trajectory control of a Snakeboard-robot

LIST OF FIGURES 97

6.7 Error made by estimating φavg as φ as a function of the current

wheel angle and the amount of microsteps taken in the calculation

interval. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

7.1 Followed path for comparison of controllers. . . . . . . . . . . . . . 60

7.2 Top: Real speed of the robot; Bottom: Equivalent speed (P-controller). 61

7.3 Top: Real speed of the robot; Bottom: Equivalent speed (PI-

controller). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

7.4 Top: Real speed of the robot; Bottom: Equivalent speed (PID-

controller). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

7.5 Top: Applied rotor acceleration; Bottom: Rotor velocity (P-controller). 62

7.6 Top: Applied rotor acceleration; Bottom: Rotor velocity (PI-controller). 63

7.7 Top: Applied rotor acceleration; Bottom: Rotor velocity (PID-

controller). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

7.8 The used path to verify the increase in efficiency. . . . . . . . . . . 65

7.9 Top: Real speed of the robot; Bottom: Equivalent speed (PID-

controller; optimal path). . . . . . . . . . . . . . . . . . . . . . . . . 65

7.10 Top: Applied rotor acceleration; Bottom: Rotor velocity (PID-

controller; optimal path). . . . . . . . . . . . . . . . . . . . . . . . . 67

7.11 Typical rotor speed profile (Left: uncompensated; Right: compen-

sated). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

7.12 Example of a path where straight sections are added. . . . . . . . . 68

7.13 Left: Standard sine path; Right: Sine trajectory with extended

straight interval. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

7.14 Rotor speed along a modified sinusoidal path. . . . . . . . . . . . . 69

7.15 Top: Applied rotor acceleration; Bottom: Simulated rotor acceler-

ation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

7.16 Top: Applied rotor speed; Bottom: Simulated rotor speed. . . . . . 71

7.17 Top: Measured equivalent speed; Bottom: Simulated equivalent

speed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

7.18 Top: Measured speed; Bottom: Simulated speed. . . . . . . . . . . . 72

7.19 Measured and simulated equivalent speed as a function of distance. 72

7.20 Measured and simulated speed as a function of distance. . . . . . . 73

8.1 Example of a straight forward path planning method. . . . . . . . . 75

Page 110: Trajectory control of a Snakeboard-robot

LIST OF FIGURES 98

8.2 Example of a path planning method including orientation constraints. 76

8.3 Obstacle avoidance using Bezier curves of order n = 5 (sketch). . . . 78

8.4 Top: Original and new reference path; Bottom left: Orientation

along path; Bottom right: Wheel angle along path. . . . . . . . . . 80

D.1 Example output of the serial monitor . . . . . . . . . . . . . . . . . 90

Page 111: Trajectory control of a Snakeboard-robot

LIST OF TABLES 99

List of Tables

3.1 Parameters used to perform simulations. . . . . . . . . . . . . . . . 16

7.1 Used parameters for the controllers. . . . . . . . . . . . . . . . . . . 60

7.2 Comparison of the RMS value of the error for the different controllers. 64

7.3 Comparison of the needed rotor acceleration (rad/s2) to follow a

trajectory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

C.1 Connection table for the Arduino Mega controller . . . . . . . . . . 88

Page 112: Trajectory control of a Snakeboard-robot
Page 113: Trajectory control of a Snakeboard-robot