MOBILE ROBOT LOCALIZATION with POSITION CONTROL

19
T.C. DOKUZ EYL ¨ UL UNIVERSITY ENGINEERING FACULTY ELECTRICAL & ELECTRONICS ENGINEERING DEPARTMENT MOBILE ROBOT LOCALIZATION with POSITION CONTROL Project Report by Ayhan ŞAVKLIYILDIZ - 2011502093 Burcu YELİS - 2010502069 Advisor Yrd.Doç.Dr. Ahmet ÖZKURT May,2015 IZMIR

Transcript of MOBILE ROBOT LOCALIZATION with POSITION CONTROL

Page 1: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

T.C.DOKUZ EYLUL UNIVERSITY

ENGINEERING FACULTYELECTRICAL & ELECTRONICS ENGINEERING

DEPARTMENT

MOBILE ROBOT LOCALIZATION with POSITION CONTROL

Project Report

by

Ayhan ŞAVKLIYILDIZ - 2011502093

Burcu YELİS - 2010502069

Advisor

Yrd.Doç.Dr. Ahmet ÖZKURT

May,2015 IZMIR

Page 2: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

ABSTRACT

The subject of this project is the motion control problem of wheeled mobile robots.

With reference to the unicycle kinematics, we review and compare several control strate-

gies for trajectory tracking and pose stabilization in an environment free of obstacles.

Project is developed for a two-wheel differentially-driven mobile robot.

I

Page 3: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

Contents

ABSTRACT I

Contents II

List of Tables III

List of Figures IV

1 INTRODUCTION 1

2 THE GOAL AND METHOD 2

2.1 Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.2 Reasons of Using Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.3 Hardware Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.3.1 Arduino Mega 2560 . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.3.2 L298N – Dual H- Bridge Motor Control . . . . . . . . . . . . . . 4

2.3.3 131:1 Metal Gearmotor 37Dx57L mm with 64 CPR Encoder . . 6

3 Algorithm 8

4 COST ANALYSIS 13

5 CONCLUSION 14

II

Page 4: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

List of Tables

4.1 Cost Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

III

Page 5: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

List of Figures

2.1 L298N – Dual H- Bridge Motor Control . . . . . . . . . . . . . . . . . . 4

2.2 Arduino Sketch Considerations . . . . . . . . . . . . . . . . . . . . . . . 6

2.3 131:1 Metal Gearmotor 37Dx57L mm with 64 CPR Encoder . . . . . . . 7

3.1 doEncoder() Function Algorithm . . . . . . . . . . . . . . . . . . . . . . 8

3.2 Mathematical expression for Pose of the Robot . . . . . . . . . . . . . . 8

3.3 doPose() Function Algorithm . . . . . . . . . . . . . . . . . . . . . . . . 9

3.4 doForward() Function Algorithm . . . . . . . . . . . . . . . . . . . . . . 9

IV

Page 6: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

1. INTRODUCTION

Wheeled mobile robots are increasingly present in industrial and service robotics, par-

ticularly when flexible motion capabilities are required on reasonably smooth grounds

and surfaces. Several mobility configurations (wheel number and type, their location

and actuation, single- or multi-body vehicle structure) can be found in the applications.

The most common for single-body robots are differential drive and synchro drive (both

kinematically equivalent to a unicycle), tricycle or car-like drive, and omnidirectional

steering.

Beyond the relevance in applications, the problem of autonomous motion planning

and control of robots have some theoretical challenges. In particular, these systems are

a typical example of nonholonomic mechanisms due to the perfect rolling constraints

on the wheel motion.

In the absence of workspace obstacles, the basic motion tasks assigned to a wheel

mobile robot may be reduced to moving between two robot postures and following

a given trajectory. The robot position control indicates that the problem is truly

nonlinear; linear control is ineffective, even locally.

So the aim of this project is to provide robot position control in a theoretical ap-

proaches that reduce the errors.

1

Page 7: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

2. THE GOAL AND METHOD

The goal of this project is designing a low-cost robot which has position control. In

this project, a robot which already exists in the school, was used. The goal is to:

• Research and choose small size and good features of hardware parts.

• Implement the system as fast as possible with cheap parts.

• Write the algorithm with minimax principle.

In this project, Arduino program was used for software implementation.

2.1 Arduino

Arduino is an open-source physical computing platform based on a simple microcon-

troller board, and a development for uploading software for the board.

Position control,pose setting and motor controller algorithm will be programmed on

Arduino.

2.2 Reasons of Using Arduino

• Arduino boards are inexpensive.

• The Arduino software runs on Windows, Macintosh OSX and Linux operating

system. A great majority of microcontroller systems are limited to Windows.

• The Arduino programming is easy-to-use.

• The Arduino software has open source tools and can be expanded.

• The Arduino hardware can be expanded.

2

Page 8: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

2.3 Hardware Components

2.3.1 Arduino Mega 2560

Arduino is a very popular and easy to use programmable board for creating your

own projects. Consisting of a simple hardware platform and a free source code editor

with an easy “one-click compile/upload” feature, it’s designed to be really easy to use

without being an expert programmer.

Arduino is also the most popular microcontroller board for advanced users and all

kinds of more ambitious projects. It’s been used to make robots, home automation gad-

gets, automotive projects, for sensing and controlling lights, motors, locks and servos,

sound and video, interactive objects like animated sculptures, toys and games, radio

links and just about anything else you can dream up. It can even be a web server and

connect your projects to the Internet. A huge number of example projects (including

both hardware designs and software source code) are available to help beginners get

started.

3

Page 9: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

2.3.2 L298N – Dual H- Bridge Motor Control

An H-Bridge is a circuit that can drive a current in either polarity and be controlled

by Pulse Width Modulation (PWM).

Pulse Width Modulation is a means in controlling the duration of an electronic

pulse. In motors try to imagine the brush as a water wheel and electrons as a the

flowing droplets of water. The voltage would be the water flowing over the wheel at

a constant rate, the more water flowing the higher the voltage. Motors are rated at

certain voltages and can be damaged if the voltage is applied to heavily or if it is

dropped quickly to slow the motor down. Thus PWM. Take the water wheel analogy

and think of the water hitting it in pulses but at a constant flow. The longer the pulses

the faster the wheel will turn, the shorter the pulses, the slower the water wheel will

turn. Motors will last much longer and be more reliable if controlled through PWM.

Figure 2.1: L298N – Dual H- Bridge Motor Control

4

Page 10: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

Pins:

• Out 1: Motor A lead out

• Out 2: Motor A lead out

• Out 3: Motor B lead out

• Out 4: Mo (Can actually be from 5v-35v, just marked as 12v)

• GND: Ground

• 5v: 5v input (unnecessary if your power source is 7v-35v, if the power source is

7v-35v then it can act as a 5v out)

• EnA: Enables PWM signal for Motor A (Please see the ”Arduino Sketch Consid-

erations” section)

• In1: Enable Motor A

• In2: Enable Motor A

• In3: Enable Motor B

• In4: Enable Motor B

• EnB: Enables PWM signal for Motor B

Specifications:

• Double H bridge Drive Chip: L298N

• Logical voltage: 5V Drive voltage: 5V-35V

• Logical current: 0-36mA Drive current: 2A (MAX single bridge)

• Max power: 25W

• Dimensions: 43 x 43 x 26mm

• Weight: 26g

5

Page 11: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

Figure 2.2: Arduino Sketch Considerations

2.3.3 131:1 Metal Gearmotor 37Dx57L mm with 64 CPR Encoder

This powerful is a brushed DC gearmotor that have hardware features an integrated

quadrature encoder with 64 counts per revolution (CPR) of the motor shaft. DC

motors are intended for use at 12 V, though in general, these kinds of motors can run

at voltages above and below the nominal voltage (they can begin rotating at voltages

as low as 1 V). Lower voltages might not be practical, and higher voltages could start

negatively affecting the life of the motor.

Using the Encoder

A two-channel Hall effect encoder is used to sense the rotation of a magnetic disk on

a rear protrusion of the motor shaft. The quadrature encoder provides a resolution of

64 counts per revolution of the motor shaft when counting both edges of both channels.

To compute the counts per revolution of the gearbox output, multiply the gear ratio

by 64. The motor/encoder has six color-coded, 11 (28 cm) leads terminated by a 1*6

female header with a 0.1 pitch. This header works with standard 0.1 male headers and

our male jumper and precrimped wires. If this header is not convenient for your

application, you can pull the crimped wires out of the header or cut the header off. The

following table describes the wire functions:

6

Page 12: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

Figure 2.3: 131:1 Metal Gearmotor 37Dx57L mm with 64 CPR Encoder

Cable Color and Names:

• Red : motor (connects to one motor terminal)

• Black : motor (connects to the other motor terminal)

• Green: encoder GND

• Blue : encoder Vcc (3.5 – 20V)

• Yellow : encoder A output

• White : encoder B output

The Hall sensor requires an input voltage, Vcc, between 3.5 and 20 V and draws a

maximum of 10 mA. The A and B outputs are square waves from 0 V to Vcc approxi-

mately 90 degree out of phase. The frequency of the transitions tells you the speed of

the motor, and the order of the transitions tells you the direction.

7

Page 13: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

3. Algorithm

In this project, whole algorithm was written by us. Firstly, encoder output has

been tested. Because encoder CPR(counter per revolute) values did not fit to encoder

datasheet values. Hence, according to these measured counter values doEncoder() func-

tion was constructed.

After doEncoder() function construction, interrupts were attached to the digital

pins(2 and 3) of the Arduino Mega and interrupts were written in the initialization

of the program. The encoder algorithm was shown in below figure:

Figure 3.1: doEncoder() Function Algorithm

Secondly doPose() and doForward() function was constructed according to desired

coordinate points by using the mathematical expression below:

Figure 3.2: Mathematical expression for Pose of the Robot

8

Page 14: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

Pose function was shown in below figure:

Figure 3.3: doPose() Function Algorithm

Forward function was shown in below figure:

Figure 3.4: doForward() Function Algorithm

9

Page 15: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

The main program is given below figure:

10

Page 16: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

11

Page 17: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

12

Page 18: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

4. COST ANALYSIS

Product Quantity Unit Price Total Price;

Arduino Mega 1 70 TL 70 TL;

Motor Driver L298N 1 20 TL 20 TL;

DC Brushed Motor with Encoder 2 80 TL 160 TL ;

Other Materials - - 20 TL ;

Total - - 270 TL;

Table 4.1: Cost Table

13

Page 19: MOBILE ROBOT LOCALIZATION with POSITION CONTROL

5. CONCLUSION

Every project progresses in the direction of theory. But the theoretical procedure

might change with economical and environmental reasons. In order not to run into

a problem, theoretical procedure has to be prepared with regard to economical and

environmental reasons.

In this paper, the road map has been explained as a process of the project. The

software part of the robot has been researched and explained. Pose function, forward

function,mathematical expressions, encoder function have been mentioned. Arduino

has been mentioned related to the software part which based on Arduino microcon-

troller.

The challenging part of this project is to reading the encoder counts, mathematical

expressions and wheel errors. In this point, hardware implementation calculations

should be sensitive for the main program was written in a good looped algorithm.

14