ABSTRACT The Mechatronic Team has the main objective for the development project to make the...

42
NEURO COPTER” LINEAR QUADRATIC GAUSSIAN DESIGN LQG AND IMPLEMENTATION OF THE CONTROL SYSTEM OF AN UNMANNED AERIAL VEHICLE UAV WITH STATE SPACE MODELLING AND KALMAN FILTERING AND AUTONOUMOUS GUIDANCE WITH COMPUTER VISION AND DATA LINK COMMUNICATIONS

Transcript of ABSTRACT The Mechatronic Team has the main objective for the development project to make the...

“NEURO COPTER” LINEAR QUADRATIC GAUSSIAN DESIGN LQG AND IMPLEMENTATION OF THE CONTROL SYSTEM OF AN

UNMANNED AERIAL VEHICLE UAV WITH STATE SPACE MODELLING AND KALMAN FILTERING AND AUTONOUMOUS

GUIDANCE WITH COMPUTER VISION AND DATA LINK COMMUNICATIONS

MECHATRONIC TEAMABSTRACT

The Mechatronic Team has the main objective for the development project to make the electromechanical integration of the acquisition, actuators and power systems of an Unmanned Aerial Vehicle UAV, and also do the respective flight test. Therefore, it is required to make a careful selection by engineering criteria of both the vehicle and the electronic components on board that will allow us to achieve the established objective of obtain an autonomous vehicle useful for multiple applications.

MECHATRONIC TEAM

Selection of components: vehicle, sensors and actuators

Design of electronic board: Control Power Servo Drives, Acquisition of PWM signals and micro controller QE128.

Freescale QE 128 Programming. (microcontroller).Flight test: Data Capture of sensors and actuators.Neuronal control and system identification.

Tasks

General Mechatronic Diagram

Diagram of the Electronic board: “Neurocopter 1.0”

uControlerQE128

MAX232

MULTIPLEXOR 74157

DBD

9D

BD9

+3V SOURCE

+12V SOURCE 7805REGULATOR

7809REGULATOR

4N33 OPTOCOUPLER

TLP521-4OPTOCOUPLER

DATA-LINK MODEM VOLTAGE SOURCE

CAMERA VOLTAGE SOURCE

PWM CH1

PWM CH2

PWM CH3

PWM CH4

TR/RX 1

TR/RX 2

PWM TO DATA-LINK MODEM

TO GPS DEVICE

SD MEMORY

IMU

ULTRSONIC SENSOR

Acceleration X ADC

Acceleration Y ADC

Acceleration Z ADC

Angular Rate X ADC Angular Rate X ADC

Angular Rate Y ADC Angular Rate Y ADC

Angular Rate Z ADCAngular Rate Z ADC

SPI

HIGH ADC

PWM To Thrust Driver

PWM To Roll Servo 1

PWM To Roll Servo 2

PWM To Pitch Servo

PWM To Yaw Servo

PWM CAPTURE FROM RADIO CONTROLER SWITCH CONTROL BIT

RADIO CONTROLER CH1

RADIO CONTROLER CH2

RADIO CONTROLER CH3

RADIO CONTROLER CH4

Freescale µController QE128 Programming

ADC interfaces. Serial Communication interface. (Tx & Rx)PWM modules: PWM signal generation, and

capture of PWM signals.SPI protocol (Master – Slave): SD memory in

SPI mode.Flight algorithms.

Flight Test Diagram

Flight test: Real Time Data Capture of sensors and actuators.

PWM and sensors Capture

Conversion of digitized data to

units of measurement

data

Kalman Filter

System ID

Neuro controller:MLP network model is used. The design of the NN is composed by 9 values at the input layer, 10 activation sigmoid neurons at the hidden layer, and 5 linear neurons at the output layer. The training is done by the backpropagation algorithm of the NN Matlab toolbox.

Inputs:accelX: Linear Acceleration axis X ( m/s2).accelY: Linear Acceleration axis Y ( m/s2).accelZ: Linear Acceleration axis Z ( m/s2).GyroX: Angular velocity axis X (°/sec).GyroY: Angular velocity axis Y (°/sec) .GyroZ: Angular velocity axis Z (°/sec) .AngX: Angle X in degrees °.AngY: Angle Y in degrees °.Height:Height of the helicopter from the land in centimeters.

Outputs:u1: % PWM Duty Cycle Main Rotor.u2: % PWM Duty Cycle Pitch Servo.u3: % PWM Duty Cycle Roll Servo (Right side).u4: % PWM Duty Cycle Roll Servo (Left side).u5: % PWM Duty Cycle Yaw Servo.

Neuro controller for a MIMO system ID

Pitch servo:

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100009

9.5

10

10.5

11

11.5

12

12.5

13

muestra

% P

WM

PWM Main Neuronal

PWM Main Real

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100009.4

9.6

9.8

10

10.2

10.4

10.6

10.8

11

11.2

11.4

muestra

% P

WM

PWM Pitch Neuronal

PWM Pitch Real

Main rotor velocity:

Training Results: Real PWM VS Neuronal PWM

Roll servo (Right side): Yaw servo:

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 1000011

11.2

11.4

11.6

11.8

12

12.2

12.4

12.6

muestra

% P

WM

PWM Roll Derecha Neuronal

PWM Roll Derecha Real

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 1000010.5

10.6

10.7

10.8

10.9

11

11.1

11.2

11.3

11.4

11.5

muestra

% P

WM

PWM Yaw Neuronal

PWM Yaw Real

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

10.8

11

11.2

11.4

11.6

11.8

12

12.2

muestra

% P

WM

PWM Roll Izquierda Neuronal

PWM Roll Izquierda Real

Roll servo (Left side):

The development of autonomous scale helicopters responds to the need for greater flexibility, agility and simplicity of operation. However, they present highly nonlinear flight dynamics and also they have high sensitivity to control inputs and disturbances. If we add the fact that helicopters present different characteristics for each flight mode, the development and implementation of an intelligent control system becomes a critical factor for the deployment of this kind of air vehicles.

CONTROL

CONTROL STAGES

System IdentificationLQG controller designNeural Network design

DIAGRAM

ax

ay

az

pqrh

HELICOPTER

Black Box

Inp

ut Data

Ou

tpu

t D

ata

System Identification

We used the method of Linear Regression with Least Squares using QR decomposition to approximate the real system to a transfer function.

-m -2 -1

m 2 1 0-m -2 -1

m 2 1

b z +...+b z +b z +bY(z)H(z)=

X(z) a z +...+a z +a z +1

Transfer function of order “m”:

Rewriting the equation above and adding an error term representing the difference between the real system and approximate system, the linear regression model is obtained:

y(n)= (n) + (n)e Output Data Available Regressi

onVector

UnknownParamete

rs

s

Error Term

22= y(n)- (n)e

According to the least squares sense, it is necessary to minimize:

A method of estimating the unknown parameters in a way to reduce the square error is through Linear Regression with Least Mean Square Estimation using QR decomposition 1

0 1R z

Knowing that:

The matrix can be separated in an orthogonal Q matrix and in an upper triangular R matrix using the command (QR).

Where ‘p’ is the number of unknown parameters

System Identification

LQG

LQE (Kalman Filter): An optimal estimator for estimating the states in the presence of AWGN noise.

LQR: An optimal regulator supplied by estimated states (LQE) which are taken to zero.

LQE LQR

Noise measured by sensorsExogenous disturbanceComponent degradation

Linear Quadratic Gaussian Controller (LQG)

• Diagram of LQG controller:

x=Ax+Bu+Πw

y=Cx+Du+Ψv

ˆ ˆ ˆx=Ax+Bu+L(y-Cx)

Optimal Estimator(LQE)

Kalman Filter

ˆu=-Kx

Optimal Controller(LQR)

+

xN

YU

r

Exogenous disturbance

LQG

Noise measured by sensors

Linear Quadratic Gaussian Controller (LQG)

1 1

2 2

( )

( )

( )

( )

h W Xo b

h h

y W h b

y y

u

h- h+

y- y

W1 W2

Configuration:

Neural Network ControllerThe neural network controller tries to identify the controller K obtained by the Linear Quadratic Regulator LQR method. It is important to notice that the inputs to the neural network are the outputs of the Kalman filter.

XO

Nonlinear

Neurons

Linear Neurons

2J e

e yd y

Jp p

p

2

22 2

2

(2 )

J J e e y y

W e e y y W

Je h

W

Learning Algorithm:

The algorithms for updating the weights is the Backpropagation which involves the development of partial derivatives.

1 11

JW W

W

2

21 1

21

(2 ) 1

J J e e y y h h

W e e y y h h W

Je W h h Xo

W

2 22

JW W

W

It is necessary to establish a Quadratic Cost Function in order to penalize the error and reduce the energy that is coupled to the system

Neural Network Controller

• Final Diagram:

x=Ax+Bu+Πw

y=Cx+Du+Ψv

ˆ ˆ ˆx=Ax+Bu+L(y-Cx)

Optimal Estimator(LQE)

Kalman Filter

+

xN

YU

r

Exogenous disturbance

LQG

Noise measured by sensors

W1W2

Neural Network

Neural Network Controller

COMPUTER VISION

Computer vision is a field of artificial intelligence, which objective is to program a computer in order to “understand” a scene or characteristics of a

certain image.A common problem in airports is the presence of birds that blocks the

aircraft takeoff. Another common situation is the lack of a fast and movable surveillance system. That’s why we propose an affordable, easy to use,

modular system with three operation modes.

ABSTRACT

General Diagram

AbstractTracking mode. The Neurocopter is able to

follow a certain object within its vision rangeAll weather vision. In addition for the

Tracking Mode this Mode allows enhance the image for poor or excessive light situations

Bird Detection. It allows us to identify bird in the scene.

Tracking ModeAcquisition

(Wireless camera)Video enhancement

(space filters)Color Selection

Color segmentation (Euclidean distance)

Segmented Image enhancement

(Morphological Operations )

Representation and Description

(Centroid and Trajectory Calculation)Visualization

Reference signals for Control Team

Tracking ModeWe explore the following pre-processing

algorithms:Mean filterMedian filterMorphological filters (Opening, Closing, Filling Holes

and Clear Border)

Tracking ModeThe segmentation algorithm was

implemented in a Nvidia GTX 465 video card exploding its parallel processing technology. It gave us a reduction of 55.7% in time of execution.

Euclidean distance

2122 tysxE

All Weather VisionThis mode was achieved using the Gamma Correction which

consists in a non-linear adjust of the brightness or luminance on an image. For the darkest pixels the brightness is highly increased while the brightness for the clearest pixels is increased in an minor amount. As a result more details are visible on the image.

rcS .

All Weather VisionThe gamma correction was implemented on the

GPU because most of the operations include matrices, this allows us to take advantage of the parallel processing.

Gamma Night Vision = 0.9Gamma Sun Block = 1.03

Time CPU0.0159

Time GPU0.0028

Reduction of 82.4%

Bird DetecctionImage

Acquisition(Gray scale conversion)

Pre-processing(Median Filter)

Segmentation(Thresholding)

Representation

(Morphological Operations)

Description (Centroid)

Thresholding: It’s about defining a threshold which separates the objects from the background. It is useful only if there is a clear difference between the objects and the background of the scene.

Bird Detection

Threshold = 0.3There is no need to use elaborated algoritms like the Otsu algoritm

DATALINK

The purpose of these project is to solve the communication problems and to ensure the control of the helicopter and its monitoring.

Some problems may happen in the communication system due to limitations like electromagnetic interference, loss of communication link, errors in transmission or capture of wrong information.

ABSTRACT

DATALINK-ABSTRACT The principal objectives are:To select the technology for the

communications system which satisfied to the required specifications.

To design a software when can monitoring the data transmitted ( altitude, orientation and speed)

To display the absolute position of the vehicle through the GPS scale

Datalink Diagram

2. Datalink Down

1. Datalink Up

3. TCP Protocold

Control(Client)

GCS(Server)

ACTIVITIESChoose a communication device and

configure and test it.Simulate data acquisition of the sensors and

GPS in order to evaluate the software developed.

Display information received from the helicopter to the base station.

MONITORING BY GOOGLE EARTHStart of Google Earth

Extract latitude, longitude

Receive GPS data?

KML record

Show flight and UAV position

Finish?

End

No

Yes

No

Yes

SERIAL PORT COMMUNICATIONStart

Receive VC

frame?

End

No

Configuration of the serial

port parameters

Open serial port

Send ACK frame

Prepare to receive

Data?

State: Data received

Finish data

sending?

State: Finish

Close serial port

1

1

No

No

Yes

Yes

Yes

SERIAL PORT COMMUNICATIONStart

Receive VC

frame?

End

No

Configuration of the serial

port parameters

Open serial port

Prepare to receive

State: Send Data

Finish data

sending?

State: Finish

Close serial port

1

No

Send VC frame

1

Yes

Yes

XML AND KMLXML, acronym for Extensible Markup Language .

It’s an extensible meta tags developed by the World Wide Web Consortium (W3C)

XML is not born only for use internet, it is proposed as a standard for exchanging structured information between different platforms. It can be used in databases, text editors, spreadsheets and almost anything imaginable.

KML is a markup language and its used to represent data in three dimensions.

KML PROGRAMMATION KML Programmation

<xml version<kml xmlns=“…”

<Placemarks><name>…</name>

<description>….. </description><point>

<coordinates>Latitud,longitud,altura</coordinates>

</point></Placemarks>

</kml>

DESIGN OF THE GCS

Conclusions. The mathematical analysis allows a comprehensive understanding of the system to be developed: Place a scale

helicopter called “Neuro Copter” prototype in a state of "Hover." Given the cost numbers and physical dimensions of the prototype to implement, was determined to take safety

measures for the first flight test, using a security system comprised of harness, and a safe landing. In addition, convenient saw the acquisition of a prototype low-cost training in comparison to the final model for the respective flight test and flight training.

As a way of alleviating the computational burden of the Control Team and the Vision Team was chosen to perform each of the two processes on different computers. We created a client-server application TCP / IP to communicate between computers.

The GCS is an important tool that will serve as interface man - machine for controlling the UAV. This software will change in real time between each of the navigation modes are available: Collision Avoidance, Navigation and Waypoint Day / Night Vision.

The GCS will allow real time viewing of both the position of the UAV and its speed, angular acceleration, height and other states. In addition, you can display the battery status is making contingency alert to be issued.

The image processing is strongly improved by the use of parallel processing tecnology provided by the graffic card. The Linear Regression with Least Squares using QR decomposition is more efficient that using pseudo-inverse and,

also, this last method does not always provides a consistent solution for estimating the unknown parameters. The Linear Quadratic Gaussian Controller allows the track of all the states even if they are contaminated by AWGN

noise. The estimated level of system identification using neural networks using the MLP model is vastly superior to the

estimation using the autoregressive model ARX. Neural networks are highly recommended for system identification and development of controllers for nonlinear

systems. For the training is recommended to leave 20% of the information to make the neural network able to generalize. Once, the neuro controller is trained, it is necessary to validate the neural network. For example, feed to the system

with different values to the training patterns and verify that the output is consistent. Leave a small margin of error on the training goal (non-zero error) in order to allow the network to generalize. For the modeling of the system take advantage of neural networks, and decompose the system into simple

elements. The torque of the helicopter is 1, 0115 Kg.m.