Genetic Algorithm Based LQR for Attitude Control of a Magnetically Actuated CubeSat

11
Page 1 of 11 American Institute of Aeronautics and Astronautics Genetic Algorithm Based LQR for Attitude Control of a Magnetically Actuated CubeSat Sarthak Kukreti * Department of Aerospace Engineering and Engineering Mechanics, College of Engineering and Applied Science, University of Cincinnati, Cincinnati, OH 45221 Alex Walker and Phil Putman Sierra Lobo, Inc., 11401 Hoover Rd, Milan, OH 44846 Kelly Cohen § Department of Aerospace Engineering and Engineering Mechanics, College of Engineering and Applied Science, University of Cincinnati, Cincinnati, OH 45221 CubeSats are a popular means by which to conduct small-scale experiments in space. They are relatively inexpensive to build and launch. However, the limited size of CubeSats poses some design challenges. For CubeSat missions requiring active 3-axis attitude control, magnetorquers have been a popular means of actuation due to their small size, weight, and power requirements. However, 3-axis magnetic attitude control raises additional challenges with controllability. The present work aims to apply LQR based genetic algorithm tuned controller to the problem of magnetic actuation of a CubeSat. It is shown that genetic LQR is capable of outperforming a proportional-derivative-like angular rate, quaternion feedback control law and a constant gain linear quadratic regulator (LQR). The fidelity of the control algorithms are compared with respect to their responses to aerodynamic and gravity gradient disturbance torques. Nomenclature Magnetic field vector Magnetic field magnitude in spacecraft x-axis Magnetic field magnitude in spacecraft y-axis Magnetic field magnitude in spacecraft z-axis D derivative gain applied to fuzzy PD control law Inverse gain applied to overall PD control law ̅ Principal moment of inertia vector Ix principal moment of inertia corresponding to spacecraft x-axis Iy principal moment of inertia corresponding to spacecraft y-axis Iz principal moment of inertia corresponding to spacecraft z-axis Cost function value Feedback gain matrix produced by constant-gain LQR algorithm Cost function constants with subscripts Magnetic moment vector Magnetic moment magnitude in spacecraft x-axis * PhD Student, Department of Aerospace Engineering and Engineering Mechanics, College of Engineering and Applied Science, University of Cincinnati, Cincinnati, OH 45221, AIAA Student Member Research Scientist, Sierra Lobo, Inc., 11401 Hoover Rd, Milan, OH 44846, AIAA Member Senior Research Scientist, Sierra Lobo, Inc., 11401 Hoover Rd, Milan, OH 44846 § Professor, Department of Aerospace Engineering and Engineering Mechanics, College of Engineering and Applied Science, University of Cincinnati, Cincinnati, OH 45221, AIAA Associate Fellow Downloaded by Kelly Cohen on January 9, 2015 | http://arc.aiaa.org | DOI: 10.2514/6.2015-0886 AIAA Infotech @ Aerospace 5-9 January 2015, Kissimmee, Florida AIAA 2015-0886 Copyright © 2015 by the American Institute of Aeronautics and Astronautics, Inc. All rights reserved. AIAA SciTech

Transcript of Genetic Algorithm Based LQR for Attitude Control of a Magnetically Actuated CubeSat

Page 1 of 11

American Institute of Aeronautics and Astronautics

Genetic Algorithm Based LQR for Attitude Control of a

Magnetically Actuated CubeSat

Sarthak Kukreti*

Department of Aerospace Engineering and Engineering Mechanics, College of Engineering and Applied Science,

University of Cincinnati, Cincinnati, OH 45221

Alex Walker† and Phil Putman‡

Sierra Lobo, Inc., 11401 Hoover Rd, Milan, OH 44846

Kelly Cohen§

Department of Aerospace Engineering and Engineering Mechanics, College of Engineering and Applied Science,

University of Cincinnati, Cincinnati, OH 45221

CubeSats are a popular means by which to conduct small-scale experiments in space. They

are relatively inexpensive to build and launch. However, the limited size of CubeSats poses

some design challenges. For CubeSat missions requiring active 3-axis attitude control,

magnetorquers have been a popular means of actuation due to their small size, weight, and

power requirements. However, 3-axis magnetic attitude control raises additional challenges

with controllability. The present work aims to apply LQR based genetic algorithm tuned

controller to the problem of magnetic actuation of a CubeSat. It is shown that genetic LQR is

capable of outperforming a proportional-derivative-like angular rate, quaternion feedback

control law and a constant gain linear quadratic regulator (LQR). The fidelity of the control

algorithms are compared with respect to their responses to aerodynamic and gravity gradient

disturbance torques.

Nomenclature

�̅� Magnetic field vector

𝑏𝑥 Magnetic field magnitude in spacecraft x-axis

𝑏𝑦 Magnetic field magnitude in spacecraft y-axis

𝑏𝑧 Magnetic field magnitude in spacecraft z-axis

D derivative gain applied to fuzzy PD control law

∆ Inverse gain applied to overall PD control law

𝐼 ̅ Principal moment of inertia vector

Ix principal moment of inertia corresponding to spacecraft x-axis

Iy principal moment of inertia corresponding to spacecraft y-axis

Iz principal moment of inertia corresponding to spacecraft z-axis

𝐽 Cost function value

𝐾 Feedback gain matrix produced by constant-gain LQR algorithm

𝑘 Cost function constants – with subscripts

�̅� Magnetic moment vector

𝑚𝑥 Magnetic moment magnitude in spacecraft x-axis

* PhD Student, Department of Aerospace Engineering and Engineering Mechanics, College of Engineering and

Applied Science, University of Cincinnati, Cincinnati, OH 45221, AIAA Student Member † Research Scientist, Sierra Lobo, Inc., 11401 Hoover Rd, Milan, OH 44846, AIAA Member ‡ Senior Research Scientist, Sierra Lobo, Inc., 11401 Hoover Rd, Milan, OH 44846 § Professor, Department of Aerospace Engineering and Engineering Mechanics, College of Engineering and Applied

Science, University of Cincinnati, Cincinnati, OH 45221, AIAA Associate Fellow

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886

AIAA Infotech @ Aerospace

5-9 January 2015, Kissimmee, Florida

AIAA 2015-0886

Copyright © 2015 by the American Institute of Aeronautics and Astronautics, Inc. All rights reserved.

AIAA SciTech

Page 2 of 11

American Institute of Aeronautics and Astronautics

𝑚𝑦 Magnetic moment magnitude in spacecraft y-axis

𝑚𝑧 Magnetic moment magnitude in spacecraft z-axis

µ𝐸 Specific gravitational constant for Earth (4𝜋2 AU3/year2)

𝑅 Positive-definite control history weighting matrix for LQR algorithm

𝑅𝐸/𝑆𝐶 Distance from spacecraft center of gravity to Earth’s center of gravity

𝑅𝑥𝐸/𝑆𝐶

Distance from spacecraft center of gravity to Earth’s center of gravity in spacecraft x-axis

𝑅𝑦𝐸/𝑆𝐶

Distance from spacecraft center of gravity to Earth’s center of gravity in spacecraft y-axis

𝑅𝑧𝐸/𝑆𝐶

Distance from spacecraft center of gravity to Earth’s center of gravity in spacecraft z-axis

𝑄 Positive-definite state history weighting matrix for LQR algorithm

�̅� Quaternion with parameters 2-3 corresponding to Euler axis

𝑞𝑒𝑟𝑟,1 First parameter of quaternion corresponding to transformation from current frame to desired frame

𝜏�̅� Control torque vector

𝜏𝐶,𝑥 Control torque magnitude in spacecraft x-axis

𝜏𝐶,y Control torque magnitude in spacecraft y-axis

𝜏𝐶,𝑧 Control torque magnitude in spacecraft z-axis

𝜏�̅�𝑒𝑠 Desired torque calculated from control law

𝜏𝐺𝐺,𝑥 Gravity gradient torque magnitude in spacecraft x-axis

𝜏𝐺𝐺,𝑦 Gravity gradient torque magnitude in spacecraft y-axis

𝜏𝐺𝐺,𝑧 Gravity gradient torque magnitude in spacecraft z-axis

𝜏𝑥 Torque exerted about spacecraft x-axis

𝜏𝑦 Torque exerted about spacecraft y-axis

𝜏𝑧 Torque exerted about spacecraft z-axis

�̅� Euler axis between desired and current reference frames

�̅� Angular velocity vector in spacecraft body-fixed frame

𝜔𝑥 Body-fixed angular rate in spacecraft x-axis

𝜔𝑦 Body-fixed angular rate in spacecraft y-axis

𝜔𝑧 Body-fixed angular rate in spacecraft z-axis

�̇�𝑥 Rate of change of body-fixed angular rate in spacecraft x-axis

�̇�𝑦 Rate of change of body-fixed angular rate in spacecraft y-axis

�̇�𝑧 Rate of change of body-fixed angular rate in spacecraft z-axis

I. Introduction

HE problem of fully magnetic actuation for satellite attitude control has been studied over the past two decades.

In recent times, there has been a growing number of CubeSat launches into space and we anticipate a wide

variety of civilian and military applications using this very affordable yet effective technology. The problem

of fully magnetic actuation for CubeSat attitude control has been studied over the past few years. Furthermore, Ref.

1 explored the fidelity of infinite quadratic cost, finite quadratic cost, and constant gain quadratic cost controllers using

linearized system models. Reference 1 also investigated Lyapunov methods for three-axis stabilization and the B-dot

algorithm for detumble. Moreover, the B-dot algorithm and the constant gain quadratic cost controller were utilized

with provisions for special attitude cases for the Ørsted satellite. The constant gain algorithm was chosen for its

computational efficiency and fairly good performance with respect to the other three-axis stabilization algorithms

investigated1.

The application of a proportional-derivative-like control law to the attitude control problem has been known to be

asymptotically stabilizing for the case where control torques are always available in three linearly independent

directions; however, magnetic actuation only allows for the application of control torques in two linearly independent

directions at any one time. The proportional-derivative-like control problem has been examined for the case of

magnetic actuation in Ref. 2. Essentially, it was found that solely magnetically actuated attitude control of a satellite

with a proportional-derivative-like feedback control law allows global asymptotic stability as long as the proportional

and derivative gains are scaled appropriately with respect to one another and assuming the magnetic field varies

periodically with time, which is generally a good assumption for a satellite in a Keplerian orbit2, 3.

Reference 4 provides a thorough investigated the use of the B-dot and the proportional-derivative-like control law

for control of a 10 cm X 10 cm X 10 cm CubeSat. In Ref. 4, delays are taken into account to calculate computational

time and magnetic field measurement. The measurement/actuation time, the proportional gain, and the derivative gain

T

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886

Page 3 of 11

American Institute of Aeronautics and Astronautics

were optimized for a three-axis stabilizing control law. It was found that the control law allowed pointing accuracies

of about ten degrees and settling times on the order of an hour or two, even with substantial measurement and state

estimation noise. The application of LQR (Linear Quadratic Regulator) feedback gain controller to the problem of

magnetic attitude control of a CubeSat is appropriate, because the system is inherently nonlinear and therefore needs

to be optimized to get the best bang for the buck from the magnetorquers. Essentially, the LQR gain scheduling law

aims to rotate the CubeSat from its present attitude to a desired attitude about the Euler axis of rotation between the

two attitudes while simultaneously minimizing the total system angular velocity. The restrictions on the size of the

gain terms with respect to one another, such that the system is asymptotically stable, can also be captured by tuning

the LQR control feedback gains by implementing genetic algorithm to find an optimal solution5, 6. The techniques

presented herein are directly applicable to any magnetically actuated satellite that can be modeled as a rigid body. The

mass distribution, geometry, and orbit of the satellite in turn determine controller-specific constants. The main research

goal is to develop an optimal LQR controller by using genetic algorithms and to then check whether the controller

show robustness to external disturbance inputs like aerodynamic, solar pressure and gravity gradient torques as well

as varying degree of effectiveness in terms of pointing accuracy of the CubeSat.

II. System Model

The satellite is modeled as a rigid body whose principal moments of inertia align with the spacecraft body axes.

The Euler equations for rigid body motion describe the time-variation of the body-fixed angular rates given any initial

state of rotation of a rigid body and a time-history of external torques in the body-fixed frame5:

z

z

y

y

x

x

z

yx

yx

y

xz

zx

x

zy

zy

z

y

x

I

I

I

I

II

I

II

I

II

(1)

The external torques present in this equation consist of the disturbance torques and the magnetic control torque.

The magnetic control torque results from an interaction of the local magnetic field with the magnetorquers, which are

basically coils of wire through which an electric current passes in order to produce a magnetic moment on the local

magnetic field. The magnetic moment vector crossed with the local magnetic field vector yields the magnetic control

torque:

z

y

x

xy

xz

yz

xyyx

zxxz

yzzy

zC

yC

xC

m

m

m

bb

bb

bb

bmbm

bmbm

bmbm

0

0

0

,

,

,

(2)

The gravity gradient torque results from the slight variation in the principal moments of inertia of the spacecraft.

Derivation of the mathematical expression for this torque can be found in Ref. 8:

xy

SCE

y

SCE

x

zx

SCE

z

SCE

x

yz

SCE

z

SCE

y

SCE

E

xGG

xGG

xGG

IIRR

IIRR

IIRR

R5

,

,

,

3

(3)

The quaternion attitude representation utilizes a linear time-varying equation to propagate the time-varying attitude

of a rotating body with respect to time. Using the time-history of angular rates, the time-history of the quaternion

attitude representation can be calculated using:

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886

Page 4 of 11

American Institute of Aeronautics and Astronautics

(4)

Table 1. Mass properties of simulated CubeSat.

Spacecraft Axis Principal Moment (kg-m2)

IX 8.817×10-4

IY 9.804×10-4

IZ 1.035×10-3

Modeling of the orbital dynamics was accomplished by using the modified SGP4 algorithm suggested in Ref. 9.

The two-line element set (TLE) utilized in conjunction with the SGP4 algorithm to generate a simulated orbit was that

of the Raiku spacecraft, a CubeSat launched from the International Space Station in late 2012. Modeling of the Earth’s

magnetic field was accomplished by using the 13th order International Geomagnetic Reference Field (IGRF) model

with secularly varying terms. Efficient algorithms for calculating the magnetic field utilizing this model are given in

Ref. 10. The overall control algorithm, following the general structure of Ref. 4, utilizes a measurement phase followed

by a constant-value actuation phase. Between the two phases, a time delay of 0.1 seconds simulates the time necessary

for the attitude control computer to calculate the required output, and another time delay of 0.1 seconds simulates the

time necessary to turn off the magnetorquers. The control algorithm repeats indefinitely. The simulations for the

controller response for the uncontrolled CubeSat for a tumbling initial condition is shown below in Figs. 1-3.

Figure 1. Uncontrolled error quaternion response.

𝑑�̅�

𝑑𝑡=1

2(

0 −𝜔𝑥

𝜔𝑥 0

−𝜔𝑦 −𝜔𝑧

𝜔𝑧 −𝜔𝑦

𝜔𝑦 −𝜔𝑧

𝜔𝑧 𝜔𝑦

0 𝜔𝑥

−𝜔𝑥 0

) �̅�

Figure 2. Uncontrolled body-fixed reference

frame over all simulation time.

Figure 3. Uncontrolled angular rates over all

simulation time.

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886

Page 5 of 11

American Institute of Aeronautics and Astronautics

III. Methodology

A. Optimal Solution of Linear Constant-Gain Feedback Control

The constant gain linear quadratic regulator for attitude control is the linear PD feedback matrix that minimizes a

cost function, thus solving an optimal control problem. The general cost function, Eq. (5), is the integral over time of

an “everywhere positive” quadratic function of the states and control action in addition to a terminal cost penalty for

a final state error5, 6.

ft

t

TT

ff

T dttRututQxtxtSxtxJ0

)()()()((2

1)()(

2

1 (5)

In Eq. (5), Q and R are both positive-definite matrices, meaning any appropriately-sized nonzero vector

quadratically multiplying these matrices, as x and u do, will result in a positive value7. The matrix S is positive semi-

definite, meaning some final state vectors will result in zero cost10, 12. The optimal control problem is solved by finding

the minimum of the cost function subject to the linearized dynamics of the system, given by Eq. (6), and the assumed

feedback control, given by Eq. (5).

BuAxx (6)

Kxu (7)

In addition, because the periodicity is a sufficient condition for magnetic attitude controllability (assuming linear

independence of the magnetic field and its time derivative), the periodic behavior of the linearized system is taken

into account. The solution to the time-invariant optimal control problem given in Eqs. (8, 9), with an infinite final time

and zero final cost, is given by the Algebraic Riccati Equation (ARE), given in Eq. (8), and the corresponding equation

for the feedback gain matrix, given in Eq. (9).

PAPAQPBPBR TT 10 (8)

PxBRKxu T1 (9)

The ARE can be solved for the constant matrix, 𝑃, which can be used to solve for the constant feedback gain matrix10,12.

B. Genetic Algorithm Overview

Genetic algorithms are a heuristic approach to solving parameter optimization problems11. The parameters to be

optimized are coded in strings of numbers12. A set of possible solutions is generated using the coding scheme, and the

problem is evaluated using the strings of the possible solutions. Each solution is evaluated based on a fitness function,

which is the inverse of a cost function, and the fittest solutions are selected with higher frequency to recombine with

one another or possibly mutate into new solutions to produce the next generation of possible solutions. The best

solutions may even be deliberately copied into the new generation, a process known as elitist selection, in order to

increase likelihood of solution convergence or offset the effects of high mutation rate, which tends to lead to a longer

time to find the solution12, 14. The process is repeated from the solution evaluation step until convergence 13, 14.

Then, the genetic operations are carried out over a number of generations until the solution converges to an

optimum7. This optimum is found by evaluating the cost function in Eq. (10), whose parameters for the magnetic

attitude control problem are found in Table 2; these parameters were found by estimating the values they multiply and

ensuring the products were roughly the same, similar to Bryson’s rule for the LQR.

The cost function for the magnetic attitude control problem is that given by Eq. (10).The cost function penalizes

averages of the states5, weighted by approximate order-of-magnitude factors, and the final time at which the attitude

angular error is above the ten degree error bound.

faveave tkkkJ 321 deg max)( ftt (10)

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886

Page 6 of 11

American Institute of Aeronautics and Astronautics

Table 2. Genetic Algorithm Cost Function Constants

k1 1

k2 5×10-5

k3 5×10-8

𝜃𝑚𝑎𝑥 10°

Figure 4. Genetic LQR controller development process block diagram.

IV. Design and Results

A. PD Controller Design

The PD attitude control law multiplies the angular rate error by a constant derivative gain, multiplies the Euler-

axis portion of the error quaternion by a constant proportional gain, sums the two quantities, and uses the negative of

the result, modified by the inverse of the moment of inertia tensor, as a desired torque. This desired torque vector is

mapped to its projection on the plane perpendicular to the magnetic field which were first suggested in Ref. 1.

An iterative process of simulation, solution evaluation, and gain attenuation is undertaken. Coupled with this task,

the actuation and measurement times are adjusted such that the simulated solutions exhibited the desired settling

characteristics. The relation in Eq. (11) is used to find the component of the desired torque projected on the actuation

plane and the magnetic moment that must be supplied by the magnetorquers to produce this torque1.

The PD controller uses the following gains: P=1.05×10-5 and D=7.85×10-3. It also uses an actuator on time of 50

seconds and an actuator off time of 20 seconds, which were tuned to improve the final settling characteristics,

achieving a more-consistent settling attitude error13-14.

BerrBdes DIPI

2B

BM des

BM (11)

Develop heuristic understanding of problem using Bryson’s Rule

Designing LQR controller gains

Implementing Genetic algorithm to tune the LQR controller gains

Tailoring genetic algorithm to tune

controller gains Adjusting Magnetorquer actuation and

measurement times

Run Simulation

Analyze results

Implement best controller gains and actuation times

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886

Page 7 of 11

American Institute of Aeronautics and Astronautics

Figure 4. PD error quaternion response with both aerodynamic and gravity gradient disturbances.

Figure 5. PD angular rate error response with

aerodynamic and gravity gradient disturbances.

B. Preliminary LQR Design Setup (Bryson’s Rule)

An LQR is designed for the magnetic attitude control problem using the method and general design procedure

discussed as follows. Bryson’s rule is used to develop the Q and R matrices used in the initial design. This approach

will act as a starting point for the LQR design. Using Bryson’s rule, the maximum desired quaternion error is the sine

of half the maximum desired displacement from the desired attitude, ten degrees. The maximum desired angular

velocity error is 10-4 rad/sec, approximately the resolution of the angular rate sensors. Lastly, the maximum desired

actuation is 0.02 A-m2, half of the maximum the magnetorquers can exert, so that the actuator does not get saturated.

The resulting first guess Q and R matrices are shown in Eq. (11) and Eq. (12), respectively, and the resulting first

guess Kalman gain matrix is shown in Eq. (13). All designs utilize 50 seconds actuators on and 20 seconds actuators

off15.

8

8

8

2.1000000

02.100000

002.10000

00014000

00001400

00000140

Q (11)

Figure 6. PD magnetic moment response with

aerodynamic and gravity gradient disturbances

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886

Page 8 of 11

American Institute of Aeronautics and Astronautics

248000

024800

002480

R (12)

0.2051143.0057.12285.00001342.0001202.0

1143.00.2051235.00001342.02285.00001384.0

057.11235.00.205001202.00001384.02285.0

K (13)

The approximate LQR Design was found by hand tuning the Kalman gain matrix by factors between one tenth and

ten to find the controller exhibiting the best performance, with minimum settling time and minimum average steady-

state error. This controller was determined15 to be that with a Kalman feedback gain matrix of 1.45×10-3𝐾, where 𝐾

is the matrix given by Eq. (13). The controller as well as the characteristic parameter responses for the LQR are shown

below in Figs. 7-9. This initial testing was done so as to get a gain matrix K in the ball park of the optimal solution.

To find the optimal solution genetic algorithms will be utilized to tune the Q and R matrices to give the optimal

Kalman feedback gain matrix.

Figure 7. LQR error quaternion response with both aerodynamic and gravity gradient disturbances.

.

Figure 8. LQR angular rate error response with

aerodynamic and gravity gradient disturbances. Figure 9. LQR magnetic moment response with

aerodynamic and gravity gradient disturbances.

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886

Page 9 of 11

American Institute of Aeronautics and Astronautics

C. Genetic LQR Setup

The variables that constitute the search space for the LQR controller are the Q, R matrices. The intervals of the

search space for the Q matrix are [0, 109] and the range for R is [0, 104]. The decision variables are encoded as real

values in the GA. The algorithm has also been run several times to ensure that the true global minima is found in the

search space and only the best results with the lowest cost function (along with the corresponding decision variables)

have been reported in the present study.

In the present simulation because of the large search space, the classifier system is chosen to have a high crossover

fraction of 0.8 and a mutation fraction of 0.3 are chosen to search a wide range of possible solutions. A high penalty

is imposed when the choices of controller gains give an unstable closed loop response. The algorithm is terminated if

the change in the objective function is lower than a specified tolerance level. However, a high mutation rate usually

prevents convergence on a solution, so elitist selection is utilized to keep the two best members of each generation.

Population size is kept to 100 members, plus the two best members of the previous generation (i.e. 100 for the first

generation and 102 for each subsequent generation). Members are selected for breeding with roulette wheel style

selection.

The system is set to minimize a sum of terms proportional to the last time that total pointing error is greater than

ten degrees, the average pointing error, and the average angular rate. Each simulation is run for 20 hours of simulation

time. Initially, the population is set to a random set of 100 members. In addition to tuning the LQR gains, the genetic

algorithm system was also tasked with tuning the measurement and actuation times. Each time has an upper limit of

65 seconds and a lower limit of 10 seconds, both of which are imposed by heuristically checking the algorithm for

optimal performance threshold.

The resulting Q and R matrices are shown in Eq. (14) and Eq. (15), respectively, and the resulting Kalman gain

matrix is shown in Eq. (16). The actuation times were found to be; 54 seconds actuators on and 18 seconds actuators

off.

8

8

8

6.1500000

06.150000

006.15000

00012200

00001220

00000122

Q (14)

235800

023580

002358

R (15)

0.1871179.0357.12279.00001347.0001477.0

1179.00.1871325.00001347.02279.00001763.0

357.11325.00.187001192.00001477.02279.0

K (16)

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886

Page 10 of 11

American Institute of Aeronautics and Astronautics

Figure 10. Genetic LQR error quaternion response with both aerodynamic and gravity gradient

disturbances.

.

Figure 11. Genetic LQR angular rate error

response with aerodynamic and gravity gradient

disturbances.

V. Discussion and Conclusions

The results generated were obtained using a maximum deviation of 20% in the nominal quaternion parameter

values (the quaternion was normalized after random error was introduced), a maximum deviation of 20% in the

nominal angular velocity values, and a maximum deviation of 100 nT in the nominal magnetic field values13-15.

The convergence of the Genetic LQR to an acceptable solution was observed within about 90 generations. This

took approximately three days on a computer with 16 GB RAM and an Intel CORE™i7 processor. The results show

strong similarity to PD and LQR controller designs for magnetic attitude control. Settling times and steady state

behavior are similar.

Table 3. Quantitative comparison of controllers with aerodynamic and gravity gradient disturbance torques.

Controller θave (deg) ωave (rad/sec) tf (sec) J

Genetic LQR 10.79 2.476×10-4 33359.6 0.002437

LQR 13.52 2.837×10-4 35424.3 0.002819

Simple PD 15.59 2.636×10-4 35894.4 0.002573

A genetic algorithm system was utilized to tune a constant gain linear quadratic regulator (LQR) controller for

magnetically actuated attitude control of a CubeSat. The results show convergence to the desired attitude within about

Figure 12. Genetic LQR magnetic moment

response with aerodynamic and gravity gradient

disturbances.

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886

Page 11 of 11

American Institute of Aeronautics and Astronautics

an hour and a half from an initial attitude error of sixty degrees. This result is shown to be better than the PD-type

control laws applied to this problem, including the LQR controller. After updating the time parameters and accounting

for the disturbance torques, the genetic LQR shows better angular rate responses, remains within the ten degree

pointing accuracy region much better and has a lower cost function when compared with the other controllers as shown

in Table 3. The Genetic LQR controller therefore, exhibits a higher robustness than the PD or LQR controller.

References 1Wisniewski, R., “Satellite Attitude Control Using Only Electromagnetic Actuation,” Ph.D. Thesis, Dapartment

of Control Engineering, Aalborg University, Aalborg Ø, Denmark, December 1996. 2Lovera, M. and Astolfi, A., “Spacecraft Attitude Control Using Magnetic Actuators,” Automatica, Vol. 40, 2004,

pp. 1405-1414. 3Bhat, S. P., “Controllability of Nonlinear Time-Varying Systems: Applications to Spacecraft Attitude Control

Using Magnetic Actuation,” IEEE Transactions on Automatic Control, Vol. 50, No. 11, November 2005. 4Guerrant, D. V., “Design and Analysis of Fully Magnetic Control for Picosatellite Stabilization,” Master’s Thesis,

California Polytechnic State University, San Luis Obispo, CA, 2005. 5Ghoreishi, S., Nekoui, M. A., “Optimal Weighting Matrices Design for LQR Controller Based on Genetic

Algorithm and PSO”, Advanced Materials Research, 433-440, 7546, November 2012. 6Wongsathan, C., Sirima, C., “Application of GA to Design LQR Controller for an Inverted Pendulum System,”

in Proceedings of the IEEE International Conference on Robotics and Biomimetics, 2009. 7A. H. Zaeri, M. BayatiPoodeh, and S. Eshtehardiha, “Improvement of Cûk Converter Performance with Optimum

LQR Controller Based on Genetic Algorithm,” in Proceedings of International Conference on Intelligent and

Advanced Systems, 2007. 8Sidi, M. J., Spacecraft Dynamics & Control: A Practical Engineering Approach, Cambridge, Neq York, NY,

1997. 9Vallado, David A., Paul Crawford, Richard Hujsak, and T.S. Kelso, "Revisiting Spacetrack Report #3," presented

at the AIAA/AAS Astrodynamics Specialist Conference, Keystone, CO, 2006 August 21–24. 10Wertz, J. R., Spacecraft Attitude Determination and Control, Reidel, Dordrecht, Holland, 1978. 11 Vick, A., and Cohen, K., "Genetic Fuzzy Controller for a Gas Turbine Fuel System", in Book, Intelligent and

Autonomous Aerospace System, edited by John Valasek, AIAA’s Progress in Aeronautics & Astronautics Series,

October 2012. 12 N. Ernest, K. Cohen, and C. Schumacher “Collaborative Tasking of UAV’s Using a Genetic Fuzzy Approach”

in Proceedings of the 51st Aerospace Sciences Meeting, no. AIAA-2013-1032. Grapevine, TX: January 2013. 13Alex Walker, MSc Thesis, “Fuzzy Attitude Control of a Magnetically Actuated CubeSat”, University of

Cincinnati, Department of Aerospace Engineering and Engineering Mechanics November 2013. 14 Walker, A., Putman, P., and Cohen, K., “Fuzzy Logic Attitude Control of a Magnetically Actuated CubeSat”,

AIAA Paper 2013-5059, AIAA Infotech@Aerospace Conference, Boston, MA, 19-22 August 2013. 15 Kukreti, S., Walker, A., and Cohen, K., "The Attitude Control of a Magnetically Actuated CubeSat Using PD

and LQR Controllers", 39th Annual AIAA Dayton-Cincinnati Aerospace Sciences Symposium, Paper 39DCASS-045,

March 5, 2014, Dayton, OH.

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

0886