Top Banner
The Pennsylvania State University The Graduate School College of Engineering RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL USING INVERSION A Dissertation in Aerospace Engineering by Kaushik Basu © 2018 Kaushik Basu Submitted in Partial Fulfillment of the Requirements for the Degree of Doctor of Philosophy December 2018
168

RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Apr 16, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

The Pennsylvania State University

The Graduate School

College of Engineering

RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL USING

INVERSION

A Dissertation in

Aerospace Engineering

by

Kaushik Basu

© 2018 Kaushik Basu

Submitted in Partial Fulfillment

of the Requirements

for the Degree of

Doctor of Philosophy

December 2018

Page 2: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

The dissertation of Kaushik Basu was reviewed and approved∗ by the following:

Robert G. Melton

Professor of Aerospace Engineering

Dissertation Advisor, Chair of Committee

David B. Spencer

Professor of Aerospace Engineering

Joseph P.Cusumano

Professor of Engineering Science and Mechanics

Joseph F.Horn

Professor of Aerospace Engineering

Jack W. Langelaan

Associate Professor and Graduate Studies Advisor

∗Signatures are on file in the Graduate School.

ii

Page 3: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Abstract

Spacecraft missions with requirements for tighter tolerances and that take advantage of improving

computational technology, and having more stringent control requirements,including time optimal

solutions are required.

An inverse-dynamics method is used in conjunction with a particle swarm algorithm to find

near-minimum time reorientation maneuvers in the presence of path constraints. The method

employs a quaternion formulation of the kinematics, using B-splines to represent the quaternions.

The inverse particle swarm optimization provides a method to determine an initial starting point for

a more accurate algorithm that uses a gradient-based method. The inverse method provides certain

advantages in this problem over other methods such as enforcement of boundary conditions and the

increase of computational efficiency by avoiding the use of numerical integrators.

Once the technique is established, parallelization of the algorithm demonstrates the potential for

flight hardware to be implemented that will aid in performing near real-time solutions. In total the

superior terminating kinematic results and speed up of computing time from hours to just several

seconds will allow the implementation using space hardened Graphic Processor Units and Field

Programmable Gate Arrays to perform autonomous guidance and navigation.

iii

Page 4: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Table of Contents

List of Figures vi

List of Tables viii

List of Symbols ix

Acknowledgments xi

Chapter 1Introduction 1

Chapter 2Literature Review 4

Chapter 3Problem Formulation and Method of Solution 173.1 Kinematic Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.2 Particle Swarm Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.3 The B-Spline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273.4 Overall Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

Chapter 4Application 304.1 Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304.2 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.3 Penalty Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334.4 Inverse Dynamics Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354.5 Solution Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374.6 Interesting Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434.7 Summary of PSO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644.8 PSO Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Chapter 5Parallelization 67

iv

Page 5: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Chapter 6Pseudospectral Solutions 716.1 Optimal Control Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716.2 Pseudospectral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726.3 Pseudospectral Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

Chapter 7Conclusions and Recommendations 837.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837.2 Recommendations for Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

Appendix AParticle Swarm Code 85A.1 Matlab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

Appendix BInversion Dynamics Code and Cost Function 95B.1 Matlab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

Appendix CPseudospectral 103C.1 Matlab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

Appendix DiPSO Runs 108D.1 PSU run tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

Appendix EBSpline Implementation 112E.1 BSplines by Shene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112E.2 Matlab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Appendix FParallelization Code 120F.1 C++ Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

References 152

v

Page 6: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

List of Figures

1.1 Swift Instruments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Path Constraint Cones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.1 History of Time Optimal Attitude Problems. . . . . . . . . . . . . . . . . . . . . . . 52.2 Unconstrained Path and Body Rate Solutions. . . . . . . . . . . . . . . . . . . . . . 72.3 Unconstrained Torque Solutions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.4 Precessional components per axis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.1 B-Spline Formulation with PSO update. . . . . . . . . . . . . . . . . . . . . . . . . 283.2 Overall Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

4.1 Particle Swarm Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374.2 Kinematics for Direct PSO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414.3 Body Rates for Direct PSO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424.4 Torques for Direct PSO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434.5 Kinematics for Case A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444.6 Body Rates for Case A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.7 Torques for Case A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.8 Sensor-Axis Path for Case B. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474.9 Kinematics for Case B. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484.10 Body Rates for Case B. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494.11 Torques for Case B. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504.12 Sensor-Axis Path for Case C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514.13 Kinematics for Case C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524.14 Body Rates for Case C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534.15 Torques for Case C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544.16 Sensor-Axis Path for Case C (additional 9000 generations). . . . . . . . . . . . . . . 554.17 Kinematics for Case C. (additional 9000 generations) . . . . . . . . . . . . . . . . . 564.18 Body Rates for Case C. (additional 9000 generations) . . . . . . . . . . . . . . . . . 574.19 Torques for Case C. (additional 9000 generations) . . . . . . . . . . . . . . . . . . . 584.20 Path for Case D. (Splitting the Keep Out Cones) . . . . . . . . . . . . . . . . . . . 594.21 Torques for Case D. (Splitting the Keep Out Cones) . . . . . . . . . . . . . . . . . . 604.22 Path for Case E. (Looping Path) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614.23 Torques for Case E. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624.24 Time relaxation Case E. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634.25 Reproduction of Body Rates using PSO Torque Values . . . . . . . . . . . . . . . . 66

vi

Page 7: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

5.1 Run Time vs Number of Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . 695.2 Controller implementation of Parallelization . . . . . . . . . . . . . . . . . . . . . . 695.3 Rigid Body Attitude System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

6.1 Constrained time-optimal path of the sensor axis . . . . . . . . . . . . . . . . . . . 756.2 Solutions Generated by DIDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766.3 Case F without PSO guess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776.4 Case F without PSO guess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786.5 Case G with PSO guess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796.6 Case G with PSO guess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806.7 Case F without PSO guess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816.8 Case G with PSO guess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

vii

Page 8: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

List of Tables

4.1 Direct PSO Unconstrained Results . . . . . . . . . . . . . . . . . . . . . . . . . . . 404.2 Inverse PSO Unconstrained Results . . . . . . . . . . . . . . . . . . . . . . . . . . . 414.3 Summary of PSO Runs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644.4 Summary of Minor Violations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

5.1 lxcluster.tlt.psu.edu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685.2 arcaca.aero.psu cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685.3 iPSO 30 Particles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

D.1 (30 Particles, 3000 Iterations) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108D.2 (500 Particles, 3000 Iterations) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109D.3 (1000 Particles, 3000 Iterations) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110D.4 (1500 Particles, 3000 Iterations) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

viii

Page 9: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

List of Symbols

α azimuth component of rotation vector (kinematic variable represented by B-Spline generatedby P1 to Pnk )(eg. for nk=6 P1 to P6)

β elevation component of rotation vector (kinematic variable represented by B-Spline generatedby Pnk+1 to P2nk )(eg. for nk=6 P7 to P12)

BL,P k particle position lower bound

BU,P k particle position upper bound

BL,V k particle velocity lower bound

BU,V k particle velocity upper bound

C DCM (Direction Cosine Matrix)

cC cognitive weighting coefficient

cI inertial weighting coefficient

cS social weighting coefficient

εi Euler parameters (i=1, . . . , 4)

gBest global best particle

GG J value associated with global best particle

I Satellite inertia tensor

J objective (or cost) function

J objective function with penalty terms, also referred to as the performance index or fitnessfunction

λi rotation vector component (i=1, . . . , 3)

Mmax maximum torque constraint

ix

Page 10: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Mi torque component (i=1, . . . , 3)

nk number of kinematic points used to evaluate B-Spline. (eg. nk=6)

N number of particles

NIT number of iterations

θ rotation about rotation vector (kinematic variable represented by B-Spline generated byP2nk+1 to P3nk )(eg. for nk=6, P13 to P18)

pBest particle’s best position

Pn(N) swarm where (n=1, . . . , 19 when nk=6) and (N=1, . . . , 30 when N=30)

Pn single particle containing n elements(n=1, . . . , 19 when nk=6)

σi satellite sensor orientation vector component (σ is aligned with b1-axis and used to measureits orientation with the inertial axis)

tf final time of maneuver (Generated by P3nk+1)(eg. for nk=6, P19)

ui control torque (i=1, . . . , 3)

Vn single particle’s velocity containing n elements(n=1, . . . , 19 when nk=6)

ωi body rate (i=1, . . . , 3)

x

Page 11: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Acknowledgments

I would like to acknowledge people who made contribution to writing my dissertation. First of

all, I would like to thank my adviser, Dr. Robert G. Melton, for his continuous help and support

throughout my graduate studies. This dissertation research was an enjoyable process because of his

guidance and advice. Dr Melton was also my teaching mentor during my teaching fellowship at the

Pennsylvania State University. I would also like to thank Dr. David B. Spencer as my secondary

adviser helping me tremendously with this subject material. Drs. Joseph P. Cusumano, and Joseph

F. Horn have taught me some great courses as well as allowing me to audit other courses that have

provided a firm foundation for my research endeavors.

Additionally, acknowledgments have to be given to Vidullan Surendran and Ghanghoon Paik

who have made numerous contributions during my studies and have also been good friends. Vidullan

Surrendran was invaluable with programming related issues and was a great teaching instructor for

his subject as well other areas within the field. Ghanghoon Paik has been great to collaborate with

and has been very helpful during my research work. Kirk Heller assisted with access to the high

performance computing cluster facility with the associated guidance.

Finally, I would like to thank my parents and brother who have done more than enough. This

work could never be finished without their support. My studies to this date would not be possible

without their help and assistance.

xi

Page 12: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Chapter 1 |

Introduction

The subject of interest in this dissertation is the time-optimal reorientation of a rigid body

spacecraft with path constraints. There is a class of problems in satellite attitude dynamics that

deals with a combination of time and fuel optimization. There are other problems that deal with fuel

optimization alone, including a zero-propellant maneuver of the ISS (International Space Station)

conducted in 2006 by NASA [1]. The first set of time optimal maneuvers conducted for a spacecraft

was part of the TRACE Mission in August 10th,2010 [2]. The objective was to acquire telemetry

data (i.e snapshots at numerous terrestrial locations) in a series of attitude maneuvers over the

shortest possible time. This resulted in a similar result to the classical Brachistochrone problem

where a longer path was taken to achieve the time-optimal solution. In this case, the path length

was characterized by the accumulated arc lengths of each angular rotation.

The time optimal solution in the TRACE mission was conducted offline [3]. That is, the problem

was prescribed and solved using ground-based computing facilities and resources and then uploaded

to the spacecraft via a datalink for a future slew operation. The reason for this is that these time

optimal solutions are difficult to find, even approximately, and require significant time to solve

completely. Required solution times were greater than 20 minutes during this milestone of the first

time optimal maneuver. Feasible solutions, that is local optimal solutions, can be obtained faster

but looking through the entire control space for global optimal solutions requires more time and a

1

Page 13: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

different approach than what was used for the TRACE mission.

The spacecraft mission that inspired this research is the Swift Gamma Burst spacecraft mission

[4].The purpose of this mission is to detect GRBs (gamma-ray bursts) which are powerful explosions

in the universe. They occur usually once a day and are brief, with Swift detecting about 100 bursts a

year. The BAT (Burst Alert Telescope) detects the GRB using a wide field of view. The instruments

are shown in Figs (1.1) [3]. With the position detected the spacecraft swiftly slews the spacecraft to

align the XRT (X-Ray Telescope) and the UVOT (Ultra-Violet/Optical Telescope) within 90-180

seconds. All three telescopes acquire critical data from the rapidly fading afterglow from the GRB.

Figure 1.1: Swift Instruments

An example of a maneuver for Swift is shown in Fig (1.2) where the initial orientation of the

telescope axis as represented by a dashed green line. It has to terminate its re-orientation in the

direction of the solid red line,the next GRB target, while avoiding the bright yellow sun cone, blue

Earth cone and the grey moon cone as those optical sources could damage the delicate light-sensitive

telescope. Presently, Swift computes a slewing maneuver primarily designed to make the telescope

axis avoid entering the “keep-out” cones, but without trying to minimize the slew time.

The focus of this dissertation is to develop techniques that can aide in obtaining possible global

2

Page 14: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

21

0

Path Constraint Cones

-11

0.50

-0.5

0

-0.5

-1

0.5

1

Earth Keep Out Cone

Moon KeepOut Cone

Sun KeepOut Cone

Inital Starting Sensor Orientation

Final Sensor Orientation

Figure 1.2: Path Constraint Cones

minimum-time solutions and reduce the computation time such that the computing can be conducted

on-board the spacecraft in real-time, that is RTOC (Real Time Optimal Control). In order to seek a

global solution the research employs the method of PSO (Particle Swarm Optimization). The heart

of the research examines techniques to speed up the computation time, including the development

of the Inversion Method. Once this method has been demonstrated, the PSO utilizing the inversion

method is then parallelized to speed up the calculation. A discussion of an architecture of a near

real time control system for attitude control of a spacecraft is considered.

3

Page 15: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Chapter 2 |

Literature Review

This chapter seeks to provide a broad survey of the literature pertaining to optimal attitude

maneuvers of rigid bodies. This chapter was presented at the AAS/AIAA Space Flight Mechanics

Conference in Williamsburg, Virginia, 2015 [5]. It is rather limited in breadth, given that papers

addressing flexibility effects or modeling multibody dynamics (e.g. gyroscopic devices) are not

included. Those constitute a vast body of work and, although clearly important to theoretical and

practical issues in spacecraft dynamics, lie beyond the manageable scope of this dissertation. An

earlier survey by Scrivener and Thompson [6] considers a variety of dynamical models, all pertaining

to the time-optimal reorientation maneuvers but it pre-dates the development of global search

methods, such as the one used in this dissertation.

The papers surveyed here could be divided by problem type or method of solution, with many

combinations of categories. Instead, we begin with a discussion of features that are common to

nearly all of the work, and focus later on specific aspects of current interest. Nearly all of the papers

surveyed here employ some method of optimal control theory, using either a classical indirect method

(calculus of variations and Pontryagin’s Minimum Principle) or a direct method. A concise history

of the problem is shown in Fig.(2.1).

4

Page 16: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Figure 2.1: History of Time Optimal Attitude Problems.

Unconstrained Paths

All of the papers surveyed here include some constraints on the initial and final states, with the

rest-to-rest maneuver being most commonly addressed. Problems that include path constraints, i.e.,

restrictions on the orientation of one or more body axes during the maneuver, will be addressed in a

later section.

5

Page 17: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

The earliest work in the open literature, by Dixon et al [7], examines the problem of minimizing

fuel usage when only two impulsive control torques are employed. The kinematic formulation uses

Euler angles, and although large-angle maneuvers are considered, the potential for encountering a

singularity is not addressed. D’Amario and Stubbs [8] develop a closed-loop controller that executes

an eigenaxis maneuver (rotation about a single axis that is fixed in both the inertial and body fixed

frames) between two rest states of a spacecraft.

Bilimoria and Wie’s seminal paper [9] considers the time-optimal rest-to-rest maneuver of a

spherically symmetric1 spacecraft, with independent control torques of equal maximum authority

for each axis. The problem requiring a time optimal 180 deg. rotation about the z-axis with no

path constraints is shown in Fig.(2.2) [9] with the path traversed and body rates of the optimal

solution. The solution is bang-bang2, with the number of control switches between extreme torque

values depending upon the magnitude of the reorientation angle. For cases where the equivalent

eigenaxis rotation would have been less than or equal to 72 deg, seven switches are required; for

reorientations greater than 72 deg., only five switches are required. These results are shown in

Fig.(2.3) [9]. Interestingly, the time-optimal solution is not a simple eigenaxis maneuver. The

optimal solution makes use of the fact that not all directions have the same maximum control torque

available, and the dynamics can include precessional motion to reach the final specified attitude

more rapidly than if a single axis were employed. These precessional components are resolved in in

Fig.(2.4) [9]. It can be seen in the uz component of the figure that the area A is greater than area B

which results in a greater net torque over the eigenaxis torque shown in dotted lines. The ux and uy1The symmetry refers to the mass distribution. In fact, the significant property is that all three principal moments

of inertia are equal.2Bang-bang has torque at either fully maximum or minimum.

6

Page 18: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

component show a similarity between the two torque profiles. The authors use an indirect method,

solved numerically via a multiple shooting method.

Bilimorie and Wie 1993

Constrained Time-Optimal Slewing Maneuvers for Rigid Spacecraft

Figure 2.2: Unconstrained Path and Body Rate Solutions.

Seywald and Kumar [10] consider the possibility of singular control (with independent three-axis

controls) for spherically symmetric mass distributions, and for a variety of initial and final states.

They show that all three controls cannot be singular, i.e., one control torque must always be

saturated, that is fully maximum or minimum. In this thrust control,minimum control means

maximum thrust in the opposite direction. It is possible for one or two controls to be singular, with

finite or infinite order. Subsequently, Byers [11] showed that no singular control is possible for the

7

Page 19: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Time-Optimal Three-Axis Reorientation of a Rigid Spacecraft

Bilimorie and Wie 1993

Control Input for ø = 180 (5 switches) Control Input for ø = 30 (7 switches)

Figure 2.3: Unconstrained Torque Solutions.

case of a rest-to-rest maneuver for this problem.

Byers [12] developed an approximate analytic solution to the problem of time-optimal, rest-to-rest

maneuvers for asymmetric spacecraft. The solution uses a truncated Taylor series to represent the

state transition matrix, with the coefficients in the series generated recursively.

Shen and Tsiotras [13] consider an axisymmetric body with only two control torques available.

The vehicle is spin-stabilized about its unique symmetry axis, which must be reoriented to a specified

direction in minimum time. A special set of kinematic variables [14], valid only for axisymmetric

8

Page 20: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Bilimorie and Wie 1993

Time-Optimal Three-Axis Reorientation of a Rigid Spacecraft

Figure 2.4: Precessional components per axis.

bodies, is used.

Bai and Junkins [15] revisited the problem first considered by Bilimoria and Wie, and found that

there are multiple local minima, with some having six control switches when the reorientation is less

than or equal to 72 deg. They also found that if the total control torque magnitude is bounded, the

time-optimal solution is the eigenaxis maneuver. This is entirely consistent with the fact that such

a system is degenerate – every orientation of the body axes in the physical object will lead to the

same dynamics in a given problem, and the same maximum control torque is available about any

direction.

A different problem, considered by Molodenkov and Sapunkov [16] uses a performance index

9

Page 21: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

that is a linear combination of time and control effort

J =∫ T

0(α1 + α2|u|) dt (2.1)

where α1, α2 are constant weighting factors, and the final time T is unspecified. The body has a

spherically-symmetric mass distribution and the components of the control torque u are independent

and bounded.

Li et al [17] examine the global stabilization problem (i.e., how to control a spacecraft from an

arbitrary set of initial conditions to some specified equilibrium point). They treat the problem in

terms of optimum tracking, with the performance index for the kinematics being quadratic in the

states (quaternions 3 and angular velocities); the controller then tracks the resulting optimal state

trajectories. The method can achieve global stability in the absence of external disturbances, and

can converge to a neighborhood of the desired equilibrium if disturbances are present.

The papers by Crassidis and Markley [18] and Crassidis et al [19] involve tracking problems,

wherein an optimal trajectory is first computed and then the controller must force the spacecraft to

follow it. Such requirements arise typically in spacecraft mission designs where a particular event

must be anticipated, for example, a high-speed planetary flyby in which the spacecraft must execute

a defined attitude maneuver in order to capture visual details of the planet’s surface. Other papers,

by Sharma and Tewari [20], Kim and Kim [21], and Krstic and Tsiotras [22] also treat the problem

as a tracking task.

Ioslovich [23] and Ioslovich et al [24] both consider asymmetric spacecraft maneuvering with3See Chapter 3 for an explanation of quaternions.

10

Page 22: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

performance index of∫

Σ|ui| and∫|u| respectively, with tf unspecified. Liu and Singh [25] solve the

problem of combined time and fuel, assuming that the solution has bang-bang control structure.

They use a switching-time optimization algorithm to determine the optimum switching times that

satisfy the first-order necessary conditions.

Geometric control methods take advantage of known properties of the solution space – in the

case of attitude maneuvers, the motion from initial to final attitudes is an orthogonal transformation

that can be represented as motion on the manifold defined by the group SO(3). SO(3) is the group

of all rotations in the Euclidean space of dimension order of 3. Two papers that use geometric

control for this advantage are Spindler [26], which considers a rest-to-rest maneuver, using a system

that minimizes the kinetic energy of rotation over a fixed time-interval. The problem is formulated

in a way that avoids the use of costates, but instead introduces differential equations for the controls.

Biggs and Horri [27] use geometric control in the problem of a spin-stabilized spacecraft that must

be reoriented in a fixed time-interval, using a performance index that is quadratic in the control

torque.

In practice, attitude regulators generally operate in conditions where attitude errors resulting

from small disturbances must be corrected; however, in the event of a large disturbance or if initial

conditions place the spacecraft in an unanticipated attitude state, a regulator may need to perform a

large-angle maneuver. Tewari [28] develops a nonlinear feedback control for an attitude regulator for

an asymmetric spacecraft. The formulation uses Modified Rodriguez Parameters (MRP’s) for the

kinimatics 4 and a performance index that is quadratic in the control torques, but higher-order in the

states due to cross-coupling in the dynamics. Global stability is proven via Lyapunov analysis and4See Chapter 3 for an explanation of MRP’s.

11

Page 23: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

the simulated performance shows rapid convergence. Tsiotras [29] examines the regulator problem for

an axisymmetric spacecraft. The performance index is quadratic in the states, and the formulation

uses the special kinematics [14] noted earlier for axisymmetric bodies. Mazenc and Akella [30]

consider the problem of attitude regulation when there is a delay in the input (e.g., a transport

delay due to signal propagation time from ground control to the spacecraft). For an asymmetric

spacecraft, they show that arbitrarily large reorientation maneuvers can be controlled without a

limit on the time delay.

Path Constraints

Path constraints, such as restrictions on the permissible direction that one or more axes of the

spacecraft can have during the maneuver, pose additional challenges. These constraints typically

arise from operational concerns, such as preventing intense sunlight from damaging an optical sensor.

These so-called keep-out constraints maintain a minimum angular distance αx between some specified

axis σ fixed in the spacecraft and the direction σX to the object X to be avoided.

Cx = σ · σx − cos(αx) ≤ 0 (2.2)

In the classical indirect method, one then augments the Hamiltonian with the term µxCx, where

the multiplier µx ≥ 0 if the constraint is active and µx = 0 otherwise. Furthermore, the so-called

tangency conditions [31] must also be applied (i.e., for any part of the trajectory on the boundary,

not only C, but also its first and second time derivatives must be zero).

12

Page 24: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Hablani [32] develops a control algorithm that prevents the boresight of an onboard telescope

from entering the keep-out cone of a bright object. The controller uses pitch and yaw commands to

execute the maneuver, and roll commands to maintain communication with a ground station. In the

event that the boresight encounters a keep-out cone boundary, the controller forces the spacecraft

to move such that the boresight slides along the constraint boundary until an exclusion-free zone

with a path to the target becomes available. Spindler [33] uses geometric control theory to solve

the path-constrained problem with a performance index that is quadratic in the angular velocities.

Such a formulation has practical merit for missions where structural considerations preclude the

use of high angular rates in the maneuver. Mengali and Quarta [34] also consider the problem of

reorientation when keep-out cones are present. Although their formulation is not cast as an optimal

control problem, the solution encompasses the use of both high-level control torques (e.g., from gas

jets) using discrete control laws, as well as low-thrust (field-effect electric propulsion) devices with

continuous control laws that can achieve high-precision attitude targeting. Melton [35] examines

the time-optimal problem for a spherically symmetric spacecraft where multiple keep-out cones are

present. Later work [36] shows that the time-optimal solutions do not include any trajectories that

cause the sensor axis to intersect the exclusion boundary either along a finite arc or at a point.

While keep-out cones and allowable sensor paths are easily visualized in physical space, the

permissible paths of the attitude parameters and how their relation to physical space pose an

interesting challenge. Recent work by Tanygin [37] combines a graph-search technique with a

mapping transformation that allows one to determine the minimum angular-length path and to

visualize that along with the alternative feasible solutions. Weiss et al [38] also use a graph-search

13

Page 25: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

algorithm and then implement a controller that follows the minimum-angle path. Although these

methods are interesting, it must be remembered that the minimum-angle path is generally not the

time-optimal solution.

Use of Direct Methods

Unlike the classical approach to optimal control, the so-called direct methods do not make explicit

use of the necessary conditions [see Eqs (6.3)], but instead directly minimize the performance index,

subject to whatever state, control, and/or path constraints are present, plus other constraints that

are peculiar to the method. The more accurate direct methods use nonlinear programming to

calculate values of a finite set of parameters that are being used to model the control.

Direct collocation with nonlinear programming (DCNLP) became popular for use in orbital

trajectory optimization after Enright and Conway [39] demonstrated its efficacy in that type of

problem. DCNLP is characterized as a local method, since the solution is constructed piecewise

between discrete times (nodes) in the maneuver. Between any pair of nodes, each state is modeled

as a polynomial in time. At each node, the state value and its time-derivative are continuous.

An equality constraint is added for each state: the defect (the difference between the state’s time

derivative as calculated from the polynomial model and as calculated from the state equations) at

one or more collocation points between the nodes must equal zero. The result is an implicit solution

to each state equation. Scrivener and Thompson [40] employed DCNLP to solve the time-optimal

reorientation problem, showing that good approximations are possible by minimizing the magnitudes

of the defects but without requiring them to be identically zero.

14

Page 26: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Pseudospectral (PS) methods have grown in popularity, again with the initial applications being

in orbital trajectory optimization problems. Unlike DCNLP, the PS methods solve the collocation

problem globally, using a sum of orthogonal polynomials for each state and control that is valid

over the entire time-span of the motion. The collocation points are the nodes, which are required to

be the locations where the finite polynomial expansion exactly represents the function value (state

or control). In general, many fewer nodes are required for PS solutions (compared to DCNLP),

greatly reducing the computational burden. Fahroo and Ross [41] first developed a practical PS

method based upon Chebyshev polynomials, later implemented in the Dido software package [42]

using Legendre polynomials. Two other software implementations of PS methods, PSOPT [43] and

GPOPS-II [44], have found use in attitude maneuver problems [45,46].

Proulx and Ross [47] apply a Legendre PS method to solve the time-optimal reorientation

problem for an asymmetric spacecraft. Their hybrid method uses a genetic algorithm (GA) to

provide a coarse initial estimate of the states and controls as inputs to the PS algorithm; however,

the GA sometimes finds local minima that are far from optimal. Melton [48] compares two heuristic

algorithms known for their global search performance, particle swarm optimization (PSO) and

bacteria foraging optimization (BFO), for use as first-stage estimators for input to a Legendre PS

method. For either first-stage estimator, the overall computation time is significantly reduced as

compared to using just the PS method. Zhuang and Huang [49] use a hybrid PSO-PS method to

study the problem of time-optimal reorientation for an underactuated spacecraft (e.g., when one

control thruster pair has failed), finding superior computational performance to either the PSO or

PS method used individually.

15

Page 27: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Fleming et al [50] apply a PS method to the time-optimal maneuver for an asymmetric spacecraft

and then demonstrates high-fidelity performance when the control is implemented (in simulation) as

closed-loop. Such implementation is possible, in part, due to the rapid calculation that PS methods

afford. An example of optimal attitude control being implemented in an actual spacecraft is given

by Karpenko et al [51], which describes the first flight demonstration of a time-optimal maneuver,

performed in 2010 onboard NASA’s TRACE Space Telescope.

With the literature review, including the optimal time path unconstrained problem and the

preliminary path constraint problem, it is possible to now provide a formulation and method solution

in the next chapter to further investigate this problem.

16

Page 28: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Chapter 3 |

Problem Formulation and Method of Solution

3.1 Kinematic Formulation

For practical reasons, the dynamics are almost always modeled using Euler’s equations of rigid

body motion

I1ω1 + ω2ω3(I3 − I2) = u1

I2ω2 + ω3ω1(I1 − I3) = u2 (3.1)

I3ω3 + ω1ω2(I2 − I1) = u3

where the Ii are the principal moments of inertia, the ωi are the angular velocities (body rates)

about the principal axes, and the ui are the control torques. Onboard controllers generally use

inputs from sensors that directly measure (or estimate) the angular velocities ωi. Generally, some

additional representation of the spacecraft’s instantaneous attitude is needed, along with a way to

relate the body rates with how the attitude is changing, which is addressed in the next section.

17

Page 29: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Kinematic Formulations

For practical implementation where a controller needs only to regulate a spacecraft’s attitude in

some fixed orientation, it may be reasonable to employ Euler angles [52] to specify instantaneous

attitude; however, for large-angle reorientation maneuvers (so-called slew maneuvers), the transfor-

mation between body rates and Euler rates (time-derivatives of the Euler angles) will likely encounter

a singularity. Two other formulations, Euler parameters and Modified Rodrigues Parameters, avoid

that difficulty and are commonly used in attitude dynamics and control problems.

Euler Parameters (Quaternions)

If a = [a1, a2, a3]T and b = [b1, b2, b3]T are dextral, orthonormal basis vectors that define the

orientations of two coordinate systems A and B, the relationship between them can be defined

using a direction cosine matrix (DCM) CAB such that b = CABa. Each element Cij = bi · aj is the

cosine of the angle between the two corresponding unit vectors. The DCM can be generated via a

sequence of, at most, three simple rotations about unique directions (i.e., the standard Euler-angle

representation). Because a DCM is an orthogonal matrix, there must exist one eigenvector with unit

eigenvalue: CABλ = λ. Geometrically, rotating the set a about the direction λ through an angle

θ will bring system A into alignment with system B. Thus, a single rotation, called the eigenaxis

rotation describes the orientation of B with respect to A, replacing the sequence of Euler-angle

rotations. The information embodied in the set (λ, θ) is more practically represented in the Euler

18

Page 30: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

parameters

ε1 = λ1 sin θ2 (3.2a)

ε2 = λ2 sin θ2 (3.2b)

ε3 = λ3 sin θ2 (3.2c)

ε4 = cos θ2 (3.2d)

The Euler parameters are frequently, and incorrectly, referred to as quaternions. Although the

two are closely related, quaternions obey the algebra of hyperimaginary numbers, a property that has

important benefits for reducing computation in systems where orientations are changing rapidly [53].

In fact, Euler parameters and quaternions embody identical information. The two names are used

interchangeably in the literature, and this dissertation follows that practice. Conversion between

Euler parameters and the related DCM is given by

C =

1− 2(ε22 + ε2

3) 2(ε1ε2 + ε3ε4) 2(ε1ε3 − ε2ε4)

2(ε2ε1 − ε3ε4) 1− 2(ε21 + ε2

3) 2(ε2ε3 + ε1ε4)

2(ε3ε1 + ε2ε4) 2(ε3ε2 − ε1ε4) 1− 2(ε21 + ε2

2)

(3.3)

ε4 = 12 (1 + trC)1/2 for 0 ≤ θ < π (3.4)

19

Page 31: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

ε = 1ε4

C23 − C32

C31 − C13

C12 − C21

if ε4 6= 0 (3.5)

where ε = [ε1, ε2, ε3]T . The case of θ = π presents a practical problem for numerical calculations,

but Markley [54] provides an algorithm to address this. Unlike the kinematic relation between body

rates and Euler rates, the conversion [55] between body rates and Euler-parameter rates does not

contain any singularities

ε1

ε2

ε3

ε4

=

ε4 −ε3 ε2 ε1

ε3 ε4 −ε1 ε2

−ε4 ε1 ε4 ε3

−ε1 −ε2 −ε3 ε4

ω1

ω2

ω3

0

(3.6)

Modified Rodrigues Parameters

A more compact expression for the single-axis rotation simply divides each of the εi; i = 1 . . . 3

by ε4, giving

ρ = λ tan θ2 (3.7)

where ρ is called the Gibbs vector, and its components ρ1, ρ2, ρ3 the Rodrigues parameters [52].

There is still a singularity at θ = π. A modification that moves the singularity to θ = 2π is

σ = λ tan θ4 (3.8)

20

Page 32: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

and the components σ1, σ2, σ3 are known as the Modified Rodrigues Parameters (MRP’s) [56]. The

relations between the MRP’s and the corresponding DCM are

σ = 1ζ(ζ + 2)

C23 − C32

C31 − C13

C12 − C21

(3.9)

C = I + 8σ2 − 4(1− σ2)σ(1 + σ2)2 (3.10)

where I is the identity matrix, σ = |σ|, ζ =√trC + 1 and

σ = CT −Cζ(ζ + 2) (3.11)

And the kinematic differential equation, also singularity-free, is

σ = 14[(1− σ2)I + 2σ + 2σσT

]ω (3.12)

Alternative Kinematic Forms

While these two preceding methods provide elegant and compact means for representing attitude,

they both suffer from a property of vector geometry, namely that a rotation specified by (λ, θ) is

physically equivalent to the pair (−λ, 2π − θ). This is particularly troublesome for attitude position

controllers, where a small rotation angle δ might suffice to correct an attitude error, but instead

the controller commands the larger rotation 2π − δ. This phenomenon, known as unwinding, can

21

Page 33: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

be avoided in one of two ways. Sanyal [57], Lee et al [58] and Bloch et al [59] use a Lie-algebraic

formulation and rotation matrices (a general form of a DCM’s) that does not require specifying

coordinate systems and which is singularity free. They also make use of a geometric integrator,

which preserves the geometry of the flow, leading to greater numerical accuracy than the more

commonly used Runge-Kutta schemes.

Yet another method is to retain the use of Euler parameters or MRP’s for propagating the

attitude kinematics, but specify the desired final state in a form independent of the eigenaxis

direction. Following Melton [35], where only one axis (aligned with a telescope) has a specified final

orientation, one could employ the same method to specify the orientations of two of the body axes,

e.g., b1 and b2. A required final attitude b1 = b1,f , b2 = b2,f becomes b1 · b1,f = 1 and b2 · b2,f = 1.

Using Eq. (3.3) to represent the instantaneous orientation of the bi (denoted by superscript B) and

the desired final orientation of bj,f (denoted by superscript F ) in terms of an inertial frame N

b1 · b1,f = 1 =[1− 2

(εB2

2 + εB32)] [1− 2

(εF2

2 + εF32)]

+[2(εB1 ε

B2 + εB3 ε

B4

)] [2(εF1 ε

F2 + εF3 ε

F4

)](3.13)

+[2(εB1 ε

B3 − εB2 εB4

)] [2(εF1 ε

F3 − εF2 εF4

)]

which is invariant in the direction of the λ rotation. A similar expression can be written for the dot

product b2 · b2,f = 1. Schaub et al [60] present a universal attitude penalty function for use as part

of the performance index (see the next section) that is independent of the attitude representation.

22

Page 34: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

3.2 Particle Swarm Optimization

Particle Swarm Optimization (PSO) is considered a heuristic computational method that mimics

the behavior of swarm of birds or insects as it searches for food. A swarm consists of k particles

each of which represents a possible candidate solution.Each particle consists of a set of n unknown

parameters that define the solution. The particles are initially assigned randomly generated values

within the range of the upper and lower bound B.:

BL,P k ≤ Pk ≤ BU,P k (k = 1, . . . , n) (3.14)

The current value of the i-th particle is called its position P(i), referring to its location in the

n-dimensional solution space. The swarm is represented by the matrix P.

P (i) , [P1(i) . . . Pn(i)]T (i = 1, . . . , N) (3.15)

Here N is the number of particles. Each particle has a velocity (rate of change over the iteration).

Each velocity vector component Vk(i) has bounds that are derived from the limits of position vector

components in Eq. (3.14). The range of the velocity vector components are defined as:

−(BU,P k −BL,P k) ≤ Vk ≤ (BU,P k −BL,P k) (3.16)

BL,V k ≤ Vk ≤ BU,V k (3.17)

23

Page 35: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

In each iteration, the new position of a particle P (j+1)k (i) is determined by adding its velocity

(times one iteration) to its current position:

P(j+1)k = P

(j)k + V

(j)k (j = 1, . . . , NIT ) (3.18)

If an updated position exceeds the bounds of Eq. (3.14), the iterated position is set to that bound.

That is, it is set to the lower bound if a value is smaller than the lower limit, or upper bound if a

value is greater than the upper limit . In these extreme cases the velocity of the iteration is set to 0

as [61]:

P(j+1)k =

BL,Pk

if P(j+1)k < BL,Pk

BL,Pkif P

(j+1)k > BU,Pk

and V(j+1)k (i) = 0.

Each particle is evaluated to determine the corresponding values of the cost function J. Each

particle of the swarm has a particle best position (pBest) recorded throughout its own solution

history in terms of the cost function J.There is also a global best position (gBest) amongst all

particles. The global best position of the swarm is shared amongst all the particles in the swarm [62].

The objective function J (j)(i) for pBest of particle i at the j-th iteration is:

J (j)(i) = min J (1,...,j)(i) (3.19)

where (i=1, . . . , N ) then, pBest is determined as:

pBest(j)(i) = P (l)(i)(l = arg minp=1,...,j J

(p)(i))

(3.20)

24

Page 36: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Similarly, the globally best J among all the swarm is:

J(j)Best(i) = min J (1,...,j)(i) (3.21)

and the gBest is:

gBest(j) = pBest(j)(q)(q = arg mini=1,...,N J

(j)Best(i)

)(3.22)

The velocity vector is calculated as follows :

V(j+1)k (i) = cIV

(j)k (i) + cC

[pBest

(j)k (i)− P (j)

k (i)]

+ cS[gBest

(j)k − P

(j)k (i)

](3.23)

where the coefficients of the various components of the vectors are given by :

cI = 1 + r1(0, 1)2 cC = 1.49445r2(0, 1) cs = 1.49445r3(0, 1) (3.24)

where r1(0,1), r2(0,1), and r3(0,1) are random numbers uniformly distributed between 0 and 1. The

numerical values used are commonly used weightings that were determined experimentally by early

researchers to give the best performance for a wide class of problems. The subscripts I, C and S

stand for inertial, cognitive and social. The value of cI determines how much the new velocity for

the i-th particle continues in the same direction as the current velocity. The value of cC determines

how much the new velocity is directed toward the best position ever reached by that particle. And

the value of cS determines how much the new velocity is directed toward the best posiiton ever

25

Page 37: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

reached by any particle in the swarm.

A well known problem with PSO (and other heuristic methods as well) is that of stagnation,

in which the swarm collects at some point in the n-dimensional solution space and does not move

for many iterations. In order to help avoid stagnation, the PSO algorithm (shown below) contains

a unique modification for this research. An additional step is added after each iteration to check

the progress of the value of J for the global-best particle. If J has not decreased by a specified

percentage over the previous nr iterations (a value chosen by the user), then some specified fraction

of the particles is reset: those particles are assigned random values within the allowed bounds and

the iterative process continues; however, the value of gBest is retained. This has proven to work

very well in preventing stagnation, although it sometimes requires a number of resets to move the

swarm away from the stagnation point.

Algorithm 1 Particle Swarm OptimizationInitialize a population of particles with random values positions and velocities from n dimensionsin the search spacefor Number of Iterations NIT do

for Each particle i doAdapt velocity of the particle using Equation 3.23Update the position of the particle using Equation 3.18Evaluate the Cost Function J((P )i)Update pBest using Equation 3.20Update gBest using Equation3.22

end forend for

26

Page 38: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

3.3 The B-Spline

The kinematic variables (quaternions) can be represented by B-Splines. The particle parameters

of the PSO provide the control points of the B-Splines in the algorithms used in this dissertation.

The B-splines generated will represent the variable α, β and θ as defined by Fig.(4.1) and their

associated derivatives are shown to be used in equations (4.16) and (4.23), that is, the first derivatives

and the second derivatives of the B-splines.

The use of Bezier curves are sufficient approximations for the kinematics variable α, β and θ, but

the more general B-Spline was used in this implementation. Bezier curves use Bernstein polynomials

whose algorithm implementations are much simpler to implement and have a global property where

a single change in a control point affects the entire curve. The Berstein polynomials generate the

basis functions which are then affected by control points. The more general B-Spline has a local

property in that, depending on the degree of the polynomial fit, only the local region is affected

by any changes in a control point and as such only the basis functions around the control point of

interest have to be recalculated. The algorithm used in the dissertation calculates the entire B-Spline

each time a particle is updated. Fig.(3.1) shows an update of the α kinematic spline being updated

by a PSO iteration. Similarly the β and θ kinematic splines would be updated in a similar manner

with the goal of minimizing the tf (the final element of the particle) which is shared amongst all

three kinematic splines.

The α kinematic component shown in Fig.(3.1) is the B-spline and is defined in terms of control

points Pi and coefficients Ni,p. which are determined by the basis functions hence the name B-spline.

27

Page 39: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Figure 3.1: B-Spline Formulation with PSO update.

The α in terms of some parameter τ is

α(τ) =n+1∑i=1

Ni,p(τ)Pi (3.25)

Shene [63] provides the mathematical background to the B-Spline implementation and Melton

provides a Matlab implementation in Appendix E.

28

Page 40: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

3.4 Overall Flowchart

Fig.(3.2) shows a flowchart that implements the methods already described in this dissertation,

that is the workflow between Sections 3-6. The workflow shown in Fig.(3.2) between (Section

3.2)Update Particle connected to Operate on Single Particle connected to (Section 3.3) Generate

B-Spline, represents Fig.(3.1).

α, β, and θ

α β θ

Figure 3.2: Overall Flowchart

29

Page 41: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Chapter 4 |

Application

4.1 Application

This chapter looks at the indirect Particle Swarm Optimization, that is, via inverse dynamics,

and compares it to that of direct Particle Swarm Optimization. With the inverse dynamics method

the PSO is applied to the kinematics as opposed to the control torques. This chapter, originally

presented at the AAS/AIAA Astrodynamics Specialist Conference in Vail Colorado, 2015 [64],

has been expanded for completeness. Use of MRPs in [65] made it possible to convert between

the kinematic variables (MRPs) and the angular velocity components, however,quaternions and

not MRPs are the standard kinematic representation used in satellite attitude control systems.

Conversion between quaternion and angular velocity components is accomplished analytically,avoiding

numerical matrix inversion proposed by the the author in [65]. Although this now permits the use

of quaternions in the inverse dynamic formulation, the additional constraint of quaternion normality

(ε21 + ε2

2 + ε23 + ε2

4 = 1) must be exactly incorporated, as explained later in this chapter. The inversion

method has previously been applied to the kinematics using Modified Rodrigues Parameters (MRPs)

by Spiller et al, [65] however the formulation used here makes use of quaternions. In the inverse

dynamics solution, each candidate solution consists of a history of a rotation axis vector and an

associated rotation which is then converted to a quaternion history q(t) and its associated final

30

Page 42: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

time tf . The rotation axis vector orientation prescribed by α and β and an associated rotation θ are

approximated by a set of basis splines (B-splines) such that the constraints at the initial and final

times are exactly satisfied. A PSO is then employed to determine coefficients of the B-splines such

that a rotational path satisfies the path and torque magnitude constraints, and which minimizes

tf . The inverse dynamics can then evaluate the body rates and required torque history from the

kinematics and Euler’s equations of motion.

A major consequence of the inverse dynamics is that no integration is required of the governing

equations of motion. The path q(t) and angular velocity ω(t) are found in terms of the B-spline

solutions. As with previous optimization using heuristic methods, the path and control constraints

are included via penalty functions.

4.2 Problem Statement

The physical problem is to minimize the final time tf , so the performance index

J = tf (4.1)

The boundary constraints for the example presented here are

ω1(0) = ω2(0) = ω3(0) = 0

ε1(0) = ε2(0) = ε3(0) = 0, ε4(0) = 1

ω1(tf ) = ω2(tf ) = ω3(tf ) = 0 (4.2)

ε1(tf ) = ε2(tf ) = 0, ε3(tf ) = ε3f ε4(tf ) = ε4f

31

Page 43: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

The control constraints are

Mi ≤Mmax (4.3)

The spacecraft being modeled has one or more sensors that are fixed to the spacecraft bus; these

sensors all have the same central axis for their fields of view and this axis is designated here with

the unit vector σ and referred to as the sensor axis. This axis must be kept at least a minimum

angular distance αx from each of several high-intensity light sources. Denoting the directions to

these sources as σx , where the subscript x can be S (Sun), E (Earth), or M (Moon), the so-called

keep-out constraints are then written as

σ · σx ≤ cos(αx) (4.4)

The dynamic constraints are

M1 = I1ω1 + ω2ω3 (I3 − I2)

M2 = I2ω2 + ω3ω1 (I1 − I3) (4.5)

M3 = I3ω3 + ω1ω2 (I2 − I1)

The kinematic constraints are

ω1

ω2

ω3

0

= 2

ε4 ε3 −ε2 −ε1

−ε3 ε4 ε1 −ε2

ε2 −ε1 ε4 −ε3

ε1 ε2 ε3 ε4

ε1

ε2

ε3

ε4

(4.6)

ω = 2E ε

32

Page 44: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

ω = 2Eε+ 2Eε (4.7)

4.3 Penalty Functions

Regardless of how the problem is formulated (direct or inverse-dynamics), various types of

constraints have been presented in the previous section and these will be formally stated in this

section as a general optimal control problem constraint and formulated as a penalty function. That

is if any type of constraint is violated in will incure a penalty in the cost function. As stated, the

satellite must reach a specified orientation at the final time of the maneuver and its body rates

(angular velocity components) must be zero; these are equality constraints. Similarly, there are

limits on the control-torque magnitudes and restrictions on how close a particular satellite axis can

be to a bright optical source; these are inequality constraints. In each case, the constraint can be

handled by use of a penalty function. In all cases, the constraints can be written in terms of the

vector of unknowns x (which corresponds to the elements of each particle in the swarm).

For equality constraints of the form

gi(x) = 0 (4.8)

the penalty function is

Gi(x) = keq,i |gi(x)| (4.9)

33

Page 45: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

For inequality constraints of the form

hj(x) ≤ 0 (4.10)

the penalty function is

Hj(x) = kineq,j max {0, hj(x)} (4.11)

where the keq,i and kineq,j are weights whose values determine the relative importance the corre-

sponding constraints.

The resulting modified cost function is then

J = tf +Neq∑i=1

Gi +Nineq∑j=1

Hj (4.12)

where Neq and Nineq are the number of equality and inequality constraints, respectively.

Penalty functions are relatively easy to implement, but they do not permit rigorous enforcement of

constraints. Choosing appropriate values of the weighting factors requires some trial and error: if

the weighting is too small, the penalty has little effect on the solution and the constraint may be

violated by a large amount; if the weighting is too large, the penalty dominates the value of the cost

function, resulting in a solution that satisfies that constraint, but which gives a large value of tf

(the true quantity that needs to be minimized).

34

Page 46: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

4.4 Inverse Dynamics Formulation

In the inverse-dynamics formulation, it is required that the quaternion trajectory be consistent

with quaternion properties, in that all four quaternions are not independent of one another. That is

ε21 + ε2

2 + ε23 + ε2

4 = 1 (4.13)

Enforcing this constraint in a direct-dynamics formulation, where the kinematic and dynamic

equation of motion are being numerically integrated, is relatively straight forward: the quaternion

is simply re-normalized during each integration step via the assignment statement The following

formulation ensures that this property is satisfied.

εi = εiε21+ε22+ε23+ε24

(i = 1, . . . , 4) (4.14)

which removes any accumulating numerical error in the εi. But in the inverse-dynamics formulation,

such a re-normalization is not possible because each εi is modeled by a time-varying function (e.g a

spline) over the entire time span of the physical motion. A geometric interpretation of the quaternion

makes it possible to incorporate the normality constraint exactly. The body-fixed axes have an

orientation with respect to the inertial axes that can be represented by a single rotation of the body

axes about an axis defined the unit vector λ, with rotation angle (in a right handed sense) of θ, as

seen in Fig. (4.1). This so called λ rotation has the well known relationship with the quaternion

elements.

ε1 = λ1 sin θ2

35

Page 47: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

ε2 = λ2 sin θ2

ε3 = λ3 sin θ2 (4.15)

ε4 = cos θ2

While the λ rotation form exactly satisfies the normality constraint, it still uses 4 parameters

(λ1, λ2, λ3, θ). A further geometric transformation reduces the number of parameters to 3 and exactly

satisfies the normality constraint Eq.(4.16) where α, β, θ are defined as in Eq.(4.1).

λ1 = cos(β) cos(α)

λ2 = cos(β) sin(α) (4.16)

λ3 = sin(β)

where α, β, and θ are defined in Fig. (4.1). The problem to be considered is a rest-to-rest

maneuver, consisting of a rotation about an initial axis through an angle with boundary conditions.

In the numerical calculations, time is scaled by the factor√I/Mmax and the control torques are

scaled by the factor Mmax.

Without loss of generality, σ is assumed to lie along the body-fixed b1-axis and its orientation

with respect to the inertial frame is then determined as [52]

σ1 = 1− 2(ε22 + ε2

3)

σ2 = 2(ε1ε2 + ε3ε4) (4.17)

σ3 = 2(ε3ε1 − ε2ε4)

It is further assumed that the reorientation maneuver can occur quickly enough that the spacecraft’s

36

Page 48: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

\U+03B#1

for

upper

case

delta

\U+09B#4

don't

use

#

symbol

Figure 4.1: Particle Swarm Variables.

orbital position remains essentially unchanged, and that therefore, the inertial directions to the

high-intensity sources also remain constant during the slew maneuver.

4.5 Solution Method

The first method used is the direct PSO. That is each particle consists of the control points of the

B-splines that represent torque profiles as well as a final time tf . In order to determine the body rates

as well as the quaternions, numerical integration is required. This numerical integration significantly

increases computational time as well as the possibility of introducing numerical integration errors.

The complete set of system equations consists of the Euler’s equation of rigid body motion:

ω1 = [M1 − ω2ω3 (I3 − I2)] /I1

ω2 = [M2 − ω3ω1 (I1 − I3)] /I2 (4.18)

ω3 = [M3 − ω1ω2 (I2 − I1)] /I3

37

Page 49: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

and the transformation from the angular velocity components(also called body rates) to the

quaternion rates:

ε1

ε2

ε3

ε4

=

ε4 −ε3 ε2 ε1

ε3 ε4 −ε1 ε2

−ε2 ε1 ε4 ε3

−ε1 −ε2 −ε3 ε4

ω1

ω2

ω3

0

(4.19)

The second method, the inverse-dynamics PSO method (iPSO), has each particle consisting of

the coefficients for the B-splines that represent the kinematics, that is α, β, and θ time histories,

(which in turn are translated to the quaternion time histories) as well as the final time tf . As the

quaternions are established via B-spline representations, the body rates are calculated using Eq.

(4.6) and subsequently the control torques are calculated using Eq. (4.5)

In order to evaluate Eqs.(4.6) and (4.7) in the iPSO method, it is required to calculate both ε

and ε from Eq. (4.15)

εi = λi sin θ2 + θ

2λi cos θ2

ε4 = − θ2 sin θ

2 (4.20)

εi = λi sin θ2 + 2 θ2 λi cos θ

2 + θ2λi cos θ

2 −θ2

4 λi sinθ2

ε4 = − θ2 sin θ

2 −θ2

4 cos θ2 (4.21)

where i = (1,2,3)

38

Page 50: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

From Eq. (4.16)

λ1 = −β sin(β) cos(α)− α cos(β) sin(α)

λ2 = −β sin(β) sin(α) + α cos(α) cos(β) (4.22)

λ3 = β cos(β)

λ1 = −β sin(β) cos(α)− β2 cos(β) cos(α) + 2αβ sin(β) sin(α)− α2 cos(β) cos(α)− α sin(α) cos(β)

λ2 = −β sin(β) sin(α)− β2 cos(β) sin(α)− 2αβ sin(β) cos(α)− α2 cos(β) sin(α) + α cos(α) cos(β)

λ3 = β cos(β)− β2 sin(β)

(4.23)

Direct PSO Unconstrained Motion Results

This case uses the direct-PSO method applied to a problem with no path constraints. The

spacecraft is originally orientated with its body axes parallel to the respective inertial axes and it

must rotate to achieve a final orientation equivalent to an eigenaxis maneuver of 3π4 radians about

the b3 axis (same as the inertial Z axis). The direct PSO results in this section can be compared

to the inverse PSO results in the subsequent section. The direct PSO final results are as follows

at tf ; ε1 = -0.001, ε2 = -0.0155, ε3 = 0.6989, and ε4 = 0.7151, which corresponds to θf = 2.354

rad. compared to the required value of 3π4 an error of 0.13◦. The values for αf = 2.342 rad. and

βf = 1.5693 rad., where βf is required to be π2 corresponding to an error of 0.08◦. The final body

39

Page 51: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Table 4.1: Direct PSO Unconstrained Results

initial(rads) final(rads) required(rads) error(deg)α 0 2.342 0* NAβ 0 1.5693 π/2 0.08◦

θ 0 2.354 3π/4 0.13◦

rates which are required to be at rest are as follows; ω1f=-0.0271 rad/s, ω2f=0.0199 rad/s, and

ω3f=0.0126 rad/s. An interesting result is the final spike for the αf value near tf , this is a result

of βf approaching π2 . At β = π

2 , because of the formulation of Eq.(4.16) α is free to take on any

value and this is indicated as 0* in table 4.1 (having no effect on the body rates or control torques).

The kinematics, body rates and torques are shown in Figs. (4.2) - (4.4). As expected, most of the

motion is about the b3 axis, with some precession seen as small oscillations about b1 and b2. The

principal problem with the direct method is that the final conditions are not met. A summary of

the unconstrained problem results can be seen in tables 4.1 and 4.2.

Indirect PSO Motion Results

Applying the inverse-dynamics method (iPSO), several cases are presented, including problems

with and without path constraints.

Case A: (no keep-out cones) The kinematics and body rates exactly meet the final conditions

as shown in Figs. (4.5) and (4.6), and the torques, shown in Fig. (4.7), approximate the optimal

bang-bang solution. Note that the body rates indicate a slight precessional motion as expected. This

solution used 3000 swarm generations and required 2 hours of CPU time (all cases were computed

using an Intel Core i3, 2.27 Ghz processor.)

40

Page 52: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 0.5 1 1.5 2 2.5 3 3.5 4−3

−2

−1

0

1

2

3

time

Kinematics

αβθ

Figure 4.2: Kinematics for Direct PSO.

Table 4.2: Inverse PSO Unconstrained Results

initial(rads) final(rads) required(rads) error(deg)α 0 0 0* 0β 0 π/2 π/2 0θ 0 3π/4 3π/4 0

Case B: (keep-out cones included as shown in Fig. (4.8)). The iPSO algorithm found a solution

that takes the sensor axis around the Earth cone going the “long way,” which results in a final time

tf = 5, using 3000 swarm generations. This solution meets all the path constraints, but represents a

local-minimum solution. The kinematics, body rates and torques are shown in Figs. (4.9)-(4.11)

respectively.

Case C: (keep-out cones included, same as Case B). This solution also meets the kinematic

41

Page 53: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 0.5 1 1.5 2 2.5 3 3.5 4−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

1.2

1.4Body Rates

time

ω

1

ω2

ω3

Figure 4.3: Body Rates for Direct PSO.

constraints, but reveals a different sensor-axis path that goes between the Earth and Sun cones,

with a final time tf = 4.8. The sensor-axis path is shown in Fig. (4.12), and the kinematics and

body rates in Figs. (4.13) and (4.14), respectively. As seen in Fig. (4.15), the torques violate the

torque-limit constraint. This incomplete solution required 2.5 hours of CPU time, using 3000 swarm

generations. Continuing this computation for an additional 9000 generations (6 hours of additional

CPU time) led to the results shown in Figs. (4.16) - (4.19). This complete solution has final time

tf = 4.3 and satisfies all of the constraints.

42

Page 54: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 0.5 1 1.5 2 2.5 3 3.5 4−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1Torques

time

M

1

M2

M3

Figure 4.4: Torques for Direct PSO.

4.6 Interesting Cases

In Case D we see a path in which the particle swarm cost function is particularly low compared

to other feasible solutions and the result is a PSO solution attempting a path that splits the keep out

cones region minimally. This solution actually appears fairly frequently among all of the simulations

conducted in this research. The reason is that the Earth and Sun cones overlap by only 1.5 deg. A

solution with the sensor axis passing through this narrow intersecting zone results in a small penalty

function value. As a practical matter, this solution would be acceptable since the keep-out cones are

specified by the mission designers to be somewhat larger than necessary to provide a safety margin

43

Page 55: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 0.5 1 1.5 2 2.5 30

0.5

1

1.5

2

2.5

3

3.5Kinematics

time

αβθ

Figure 4.5: Kinematics for Case A.

for the sensors. Increasing the penalty weight for the cone constraints tends to drive the solutions

toward feasible paths that are not minimum-time (for example, a path such as in Case B).

In Case E we see a PSO infeasible solution that is path-feasible but has torque violations and

initially performs a strange loop. With subsequent iterations the loop is eliminated, with the torque

violations getting minimized as more iterations take place. The presence of the unnecessary loop

in the early iterations is a useful reminder that the inverse-dynamics method always produces a

kinematically and dynamically feasible solution, but that the realistic constraints on the path and

control torques must be enforced by additional means. As seen in Fig. (4.22), that even after 12000

iterations the PSO has not found a path that is constrained to an upper time limit on tf = 5 with

44

Page 56: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 0.5 1 1.5 2 2.5 3−0.2

0

0.2

0.4

0.6

0.8

1

1.2

time

Body Rates

ω

1

ω2

ω3

Figure 4.6: Body Rates for Case A.

satisfactory torque requirements. If we relax the PSO to allow an upper limit on tf = 6, then the

PSO swarms in on a solution to tf = 5.8528 as shown in Fig. (4.24), and the resulting torques are

within the limits of ±1DU.

45

Page 57: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 0.5 1 1.5 2 2.5 3−1.5

−1

−0.5

0

0.5

1

1.5Torques

time

M

1

M2

M3

Figure 4.7: Torques for Case A.

46

Page 58: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Figure 4.8: Sensor-Axis Path for Case B.

47

Page 59: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 1 2 3 4 5−0.5

0

0.5

1

1.5

2

2.5

3

3.5Kinematics

time

αβθ

Figure 4.9: Kinematics for Case B.

48

Page 60: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 1 2 3 4 5−3

−2.5

−2

−1.5

−1

−0.5

0

0.5

1

1.5

time

Body Rates

ω

1

ω2

ω3

Figure 4.10: Body Rates for Case B.

49

Page 61: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 1 2 3 4 5−4

−3

−2

−1

0

1

2

3

4

5

6Torques

time

M

1

M2

M3

Figure 4.11: Torques for Case B.

50

Page 62: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Figure 4.12: Sensor-Axis Path for Case C.

51

Page 63: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 1 2 3 4 50

0.5

1

1.5

2

2.5

3

3.5Kinematics

time

αβθ

Figure 4.13: Kinematics for Case C.

52

Page 64: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 1 2 3 4 5−1.5

−1

−0.5

0

0.5

1

1.5

time

Body Rates

ω

1

ω2

ω3

Figure 4.14: Body Rates for Case C.

53

Page 65: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 1 2 3 4 5−3

−2.5

−2

−1.5

−1

−0.5

0

0.5

1

1.5

2Torques

time

M

1

M2

M3

Figure 4.15: Torques for Case C.

54

Page 66: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Figure 4.16: Sensor-Axis Path for Case C (additional 9000 generations).

55

Page 67: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5−0.5

0

0.5

1

1.5

2

2.5Kinematics

time

αβθ

Figure 4.17: Kinematics for Case C. (additional 9000 generations)

56

Page 68: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

1.2

time

Body Rates

ω

1

ω2

ω3

Figure 4.18: Body Rates for Case C. (additional 9000 generations)

57

Page 69: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5−1.5

−1

−0.5

0

0.5

1

1.5Torques

time

M1

M2

M3

Figure 4.19: Torques for Case C. (additional 9000 generations)

58

Page 70: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Figure 4.20: Path for Case D. (Splitting the Keep Out Cones)59

Page 71: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

time0 0.5 1 1.5 2 2.5 3 3.5 4 4.5

-1.5

-1

-0.5

0

0.5

1

1.5Torques

M1

M2

M3

Figure 4.21: Torques for Case D. (Splitting the Keep Out Cones)

60

Page 72: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

3000 Iterations 6000 Iterations

9000 Iterations 12000 Iterations

Figure 4.22: Path for Case E. (Looping Path)

61

Page 73: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

3000 Iterations 6000 Iterations

9000 Iterations 12000 Iterations

Figure 4.23: Torques for Case E.

62

Page 74: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

1.51

0.50

-0.5-1-1

0

1

0.5

1

1.5

-1.5

-1

-0.5

0

2

(a)time

0 1 2 3 4 5 6-1.5

-1

-0.5

0

0.5

1

1.5Torques

M1

M2

M3

(b)

time0 1 2 3 4 5 6

-1

-0.5

0

0.5

1

1.5

2

2.5

3Kinematics

α

β

θ

(c)time

0 1 2 3 4 5 6-1.5

-1

-0.5

0

0.5

1Body Rates

ω1

ω2

ω3

(d)

Figure 4.24: Time relaxation Case E.

63

Page 75: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Table 4.3: Summary of PSO Runs

Num. of Particles Average Run Time No Viol. Minor Viol. Major Viol.30* 2.5 hrs 1/20 19/20 0/20500 68 secs 2/20 16/20 2/201000 134 secs 4/20 14/20 2/201500 197 secs 6/20 12/20 2/20

Table 4.4: Summary of Minor Violations

Num. of Part. Tot. Min. Viol. Torq. Viol. Path Viol. Combined Viol.30 19/20 2long path,0short path 4M and S Cone Split 13500 16/20 1long path,5short path 3M and S Cone Split 71000 14/20 2long path,3short path 3M and S Cone Split 61500 12/20 1long path,2short path 6M and S Cone Split 3

4.7 Summary of PSO

A summary of the PSO runs is given in Table 4.3. The individual run details can be found in

Appendix D. The values in Appendix D that are listed correct to two decimal places are runs that

had no violations, and as such the GG value (which represents the cost function(J ) associated with

the global best gBest value) (3.22) can be divided by 100 to obtain the time-optimal duration. Table

4.4 shows the break up of the minor violations column in Table 4.3. The M and S Cone Split means

that the path violates both the Moon and Sun keep out cones, an example of this scenario is shown

in Case D, Fig.(4.20) and as such is categorized under a path violation. A long path violation results

in a torque violation which is shown in Case E, Fig.(4.22) and Fig.(4.23).

64

Page 76: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

4.8 PSO Verification

Fig.(4.25)(a) is an example of the PSO obtained body rate, while the PSO obtained torque

is shown in Fig.(4.25)(b). The PSO obtained torques are used as inputs into MATLAB® using

the ode45 Runga Kutta integrator to integrate Eq.(3.1) to obtain the body rates. When using an

absolute and relative tolerance of 1E-6 for the ode45 integrator we get body rates at the terminal

boundary orientation of a magnitude of the order 2.7E-3 (instead of the complete stop value of zero).

However when we use absolute and relative tolerance of 1E-12 we have an end condition for the

body rate at a much reduced magnitude of 6E-9. The reproduced integrated body rates for this

case are shown in Fig.(4.25)(c). The body rates as determined by inverse dynamics and by direct

integration of Eulers equations are identical, thus verifying the accuracy of the inverse PSO method.

65

Page 77: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

time0 1 2 3 4 5 6

-1.5

-1

-0.5

0

0.5

1Body Rates

ω1

ω2

ω3

(a)time

0 1 2 3 4 5 6-1.5

-1

-0.5

0

0.5

1

1.5Torques

M1

M2

M3

(b)

time0 1 2 3 4 5 6

-1.5

-1

-0.5

0

0.5

1REPRODUCED body rates

ω 1ω 2ω 3

(c)

Figure 4.25: Reproduction of Body Rates using PSO Torque Values

66

Page 78: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Chapter 5 |

Parallelization

The goal of performing real time computations for this optimal control problem can be aided

by the parallelizing of operations within calculations. Once a process can be performed in parallel

this can be embedded in a control system using parallel processors. The goal is to achieve real

time satellite maneuvers without the aide of ground control. A process that can be performed

in parallel is the PSO. The particle swarm is broken up into approximately even batches and

the expensive computational cost of evaluating the cost function is performed in parallel amongst

different processors. The issue of the global best particle, which is used as part of the velocity vector

amongst all particles, dictates the structure and nature of parallelization. In parallel computing the

concept of synchronization is an important concept and this needs to be considered when exchanging

values amongst particles.

The initial PSO calculation was conducted in Matlab. For 10000 iterations and 100 particles,

the calculation took 8 hrs on an Intel Core i3 2.27GHz processor. The serial code was converted

to C code in a structure that was suitable for parallel processor operations. For a single processor

operation on the Pennsylvania State University lxcluster.tlt.psu.edu cluster it took 78 seconds to

execute and on the lionxf.cluster.psu.edu it took an average of 58.65 seconds. The complete table

for the lionxf cluster can be seen in Table 5.1.

Table 5.2 shows the result of the aracna.aero.psu.edu cluster, showing just the run-time vs the

67

Page 79: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Table 5.1: lxcluster.tlt.psu.edu

# of processors computerrun time#1

computerrun time#2

computerrun time#3

AverageRun

Time (ART)

gBestrun#1

gBestrun#2

gBestrun#3

1 58.65 58.58 58.98 58.74 495 58831 9152 32.40 32.52 32.44 32.45 2850 49.29 48.414 16.25 16.40 16.22 16.29 59122 42.29 2625.24

Table 5.2: arcaca.aero.psu cluster

# of proc. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15ART 131.04 74.91 50.43 37.28 30.21 24.89 21.65 19.21 17.03 15.69 14.26 13.44 12.46 11.53 10.90

number of processors. Fig. (5.1) shows the corresponding graph which is consistent with Amdahl’s

law which shows the diminishing return for the increase in the number of processors. Both Table

5.1 and Table 5.3 show the random nature of a PSO solution and that many runs are required to

provide an good approximate initial solution.

The C code that implements the parallel code can be found in Appendix F. A conceptual design

for a parallelized attitude control system is shown in Fig (5.2) and resides in the GPUs of the

accelerator subsystem.The controller is part of the entire attitude control system shown in Fig. (5.3).

The controller and thrusters can be found in both in Fig. (5.2)and (5.3).

Table 5.3: iPSO 30 Particles

#Run 1 2 3 4 5 6 7 8 9 10GG 994 1180 1626 493.6 646 598 1124 749 576 1130

#Run 11 12 13 14 15 16 17 18 19 20GG 765 4186 3316 1619 1549 3382 563 869 3709 2279

68

Page 80: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0

20

40

60

80

100

120

140

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Ru

n T

ime

(sec

)

# of processors

Run Time vs # of Processors

Figure 5.1: Run Time vs Number of Processors

Figure 5.2: Controller implementation of Parallelization

69

Page 81: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Figure 5.3: Rigid Body Attitude System

70

Page 82: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Chapter 6 |

Pseudospectral Solutions

6.1 Optimal Control Theory

In the classical formulation, one seeks to minimize a performance index

J =∫ tf

t0g(x,u, t)dt (6.1)

subject to the constraints given by Eq. (3.1) and (usually) either Eq. (4.19) or (3.12), and where

x are the states (usually the angular velocities and orientation parameters) and u are the control

torques. The form of g depends upon the physical goal, i.e., if it is a minimum-time problem, then

g = 1.

The Hamiltonian consists of the integrand of J , with the constraint equations adjoined via the

costate vector λ

H = g + λT f(x,u, t) (6.2)

where f is the array of system equations – Eq. (3.1) and either Eq. (4.19) or (3.12). The necessary

conditions for the extremal solution are

x = ∂H∂λ

= f(x,u, t)

λ = −∂H∂x

=[∂f∂x

]Tλ (6.3)

71

Page 83: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

H(x∗,u∗,λ∗) ≤ H(x∗,u,λ∗)

where (∗) denotes the optimal solution. Eqs. (6.3) constitute a two-point boundary-value problem

for which there is generally no analytic solution; numerical techniques using shooting methods

(sometimes preceded by a nonlinear programming step to estimate the costates) are required when

the indirect method is used.

In all solutions, the condition for optimality Eqs. (6.4)is such that

∂H∂u

= 0 (6.4)

6.2 Pseudospectral

In this time-optimal attitude control problem we use a pseudospectral (PS) method to refine the

solution provided by the PSO. A brief overview of PS will follow. The pseudospectral discretization

of the nonlinear problem such that the cost function is the discretized form of a Bolza cost function

is

J [XN , UN , τ0, τf ] = E(x0, xNτ0, τf ) + τf − τ0

2

N∑k=0

F (xk, uk)wk (6.5)

The Legendre pseudospectral method is derived by interpolating functions on Legendre-Gauss-

Lobatto (LGL) quadrature nodes. The time bounds of the original cost function equation [τ0, τf ] are

converted to a range from [−1, 1] using the affine transformation found in

τ(t) = (τf − τ0)t+ (τf + τ0)2 (6.6)

72

Page 84: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

The interpolating functions are the Lagrange polynomials of order N.

φl(t) = 1N(N + 1)LN(tl)

(t2 − 1)LN(t)t− tl

(6.7)

The state variables and controls are discretized as equation (6.8) and (6.9) respectively.

x(τ(t)) ≈ xN(τ(t)) =N∑l=0

xlφl(t) (6.8)

u(τ(t)) ≈ uN(τ(t)) =N∑l=0

ulφl(t) (6.9)

The dynamic, terminal and path constraints are discretized as

τf − τ0

2 f(xk, uk)−N∑k=0

Dklxl = 0 dynamic (6.10)

where D is the differentiation matrix that allows rapid calculation of the state derivatives at the

nodes,

e(x0, xN , τ0, τf ) = 0 terminal (6.11)

h(xk, uk) ≤ 0 path (6.12)

The continuous problem is thus transformed into a nonlinear programming problem (NLP) with

unknowns Xi and Ui (the states and controls at the nodes). A Legendre PS method has been

implemented in commercial software DIDO which employs a gradient-based method to solve the

73

Page 85: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

NLP. An important feature of PS method is their ability to reconstruct the costates once an optimal

solution is obtained. These costates values can then be used to calculate the Hamiltonian and

demonstrate graphically that the solution meets the necessary conditions.

6.3 Pseudospectral Results

A key motivation in the present work is to find an approximate solution that satisfies the

kinematic constraints and which could serve as a good starting point for a gradient based method,

leading to less computational time overall.

We see that a PS method improves the quality of the solution with the aid of a good starting

point, that is one given by the PSO. Fig. (6.1) shows the time-optimal sensor path generated by

the DIDO software [66], and Fig. (6.2) shows the corresponding body rates, Euler parameters and

control torques for this maneuver. This solution required approximately 12 hours of CPU time using

Dido Version 7.20. Appendix-C provides a script used by DIDO to implement the optimal control

problem.

A different case was tried with the same cone directions but with a smaller cone angle without

an initial PSO guess Case F . This can be seen in Fig. (6.3).The kinematic results are given in Fig

(6.4).

It can be seen that the maneuver time is shorter with ts = 2.98 seconds and the control torque

looks closer to the bang-bang solution of an unconstrained problem. We will next use a guess given

by the PSO initial guess to the Dido software. Theses result will be considered Case G. This path is

seen in Fig (6.5). We can see in this path that the maneuver has gone in the alternate direction

74

Page 86: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Figure 6.1: Constrained time-optimal path of the sensor axis

around the sun cone and has reduced the maneuver time to 2.80 seconds. The convergence and as

such the run-time of the solution was also improved.

The kinematic results are given in Fig.(6.6).

75

Page 87: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5−2

0

2Angular Velocity

time

ωi

ω1

ω2

ω3

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5−1

0

1

2Euler Parameters

time

ε i

ε1

ε2

ε3

ε4

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5−1

0

1

Control Torques

time

Mi

M1

M2

M3

Figure 6.2: Solutions Generated by DIDO

The unconstrained time-optimal problem has a constant H given by (6.4). With that in mind

we see that this is not the case for a path constrained problem as it can be seen in Fig.(6.7) and

Fig.(6.8). It can be seen from the Hamiltonian value that the solution has improved in Case G from

Case F. Dido uses a covector mapping procedure to extract the Hamiltonian Values and the costate

vectors λ introduced in (6.2).

76

Page 88: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

1.51

0.50

-0.510.5

0-0.5

-1-1.5

1

0.5

0

-0.5

-1

Figure 6.3: Case F without PSO guess

77

Page 89: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

time0 0.5 1 1.5 2 2.5 3

wi

-2

0

2Angular Velocity

w1w2w3

time0 0.5 1 1.5 2 2.5 3

qi

-2

0

2Euler Parameters

01

02

03

04

time0 0.5 1 1.5 2 2.5 3

Mi

-1

0

1Control Torques

m1m2m3

Figure 6.4: Case F without PSO guess

78

Page 90: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

1.51

0.50

-0.510.5

0-0.5

-1

-1

1

-1.5

0.5

0

-0.5

Figure 6.5: Case G with PSO guess

79

Page 91: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

time0 0.5 1 1.5 2 2.5 3

wi

-1

0

1

2Angular Velocity

w1w2w3

time0 0.5 1 1.5 2 2.5 3

qi

-0.5

0

0.5

1Euler Parameters

01

02

03

04

time0 0.5 1 1.5 2 2.5 3

Mi

-1

0

1Control Torques

M1M2M3

Figure 6.6: Case G with PSO guess

80

Page 92: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

time0 0.5 1 1.5 2 2.5 3

Ham

ilton

ian

Val

ue

-1.05

-1

-0.95

-0.9

-0.85Hamiltonian Evolution

H

time0 0.5 1 1.5 2 2.5 3

cost

ates

-3

-2

-1

0

1Costates

6w

1

6w

2

6w

3

6q1

6q2

6q3

6q4

Figure 6.7: Case F without PSO guess

81

Page 93: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

time0 0.5 1 1.5 2 2.5 3

Ham

ilton

ian

Val

ue

-1.01

-1

-0.99

-0.98

-0.97Hamiltonian Evolution

H

time0 0.5 1 1.5 2 2.5 3

cost

ates

-1.5

-1

-0.5

0

0.5

1Costates

6w

1

6w

2

6w

3

6q1

6q2

6q3

6q4

Figure 6.8: Case G with PSO guess

82

Page 94: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Chapter 7 |

Conclusions and Recommendations

7.1 Conclusion

The study has examined the use of the PSO method for both the direct method and inverse

dynamics method. The PSO solutions are potentially of important use as initial solutions for further

gradient based methods. It was seen that the inversion method produced much more favorable

results without the use of numerical integration. The direct method produced final results that

violated the boundary conditions slightly. The inversion method did not have this problem but did

have violation of torque constraints. However by increasing the number of generations it could be

seen that these violations were then nearly eliminated, furthermore the final time tf was reduced as

well.

This study looked into use of these solutions as initial conditions into pseudospectral optimization

to determine if performance is increased. It was determined that these solutions indeed improved the

quality of the solution and were conducted in less computing time with at least a 10% improvement.

Also parallelization of the PSO was examined, showing that the computation times where significantly

reduced. One of the biggest motivations for this study was to achieve methods that would eventually

allow RTOC (Real Time Optimial Control). This could allow the satellite or spacecraft to operate

autonomously and allowing the attitude control system to be non-reliant on the Ground Support

83

Page 95: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

System.

7.2 Recommendations for Future Work

Future studies can look into methods that can reduce the swarm particle candidates to limited

regions in the solution space based on past learnt optimized control paths. This can be implemented

with some neural network method [67], where past simulations and lessons learned may give a pattern

of where to target the particle swarm population. A development of a scheme to make the swarming

more robust is an area of further research. The use of Bezier curves instead of B-Splines is an area

of investigation to see if there is an improvement in speed. The parallelization was successfully

implemented, with significant speed up. The implementation of these computer algorithms into

dedicated components such as GPUs or FPGAs would be of interest for future work. This use of

dedicated components would be a step in realizing the research into flight hardware and as such

would be able to confirm and quantify significant further speed up. A more difficult problem to would

involve flexible structure spacecraft. Added modes and degrees of freedom of this problem would

involve many more unknown parameters and a parallelized method would certainly be required.

84

Page 96: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Appendix A|

Particle Swarm Code

A.1 Matlab Code

%% Particle Swarm Optimization

% Inverse Dynamics Using a Quaternion Formulation

% Ko Basu July 24th 2016

clc;

clear all;

close all;

format long

global P J JBest PBest GBest GG N_particles N_elements V BLv BUv BLp BUp

global N_iterations t0 tf x0 N_kin_vals q1targ q2targ q3targ q4targ

global k1 k3 korder

global caS caE caM beta_S beta_E beta_M k_cones

global alpha0 alphaf beta0 betaf theta0 thetaf

time0=cputime;

85

Page 97: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

%%%%%%%%%%%

% Optimal Control Problem Constraints

%%%%%%%%%%%

%Boundary Conditions

t0 = 0;

q1targ = 0.0;

q2targ = 0.0;

q3targ = sin(pi/4);

q4targ = cos(pi/4);

alpha0 = 0;

alphaf = 0;

beta0 = 0;

betaf = pi/2;

theta0 = 0.0;

thetaf = 3*pi/4.

%Path Constraints

alpha_S = 47*pi/180;

alpha_E = 33*pi/180;

alpha_M = 23*pi/180;

caS = cos(alpha_S);

caE = cos(alpha_E);

caM = cos(alpha_M);

86

Page 98: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

beta_S = [0.5, sqrt(3)/2, 0];

beta_E = [0, 0, −1];

beta_M = [0.1795, 0.3109, 0.9333];

%Particle Swarm Variables

N_kin_vals = 6;

N_elements = 3*N_kin_vals + 1;

N_particles = 30;

N_iterations = 3000;

tL = 1.0;

tU = 5.0;

GGStar = zeros(N_iterations,1);

%%%%%%%%%%%%%%

% Initialize the random population

%%%%%%%%%%%%%%

BLalpha = −pi;

BUalpha = pi;

BLbeta = −pi/2;

BUbeta = pi/2;

BLtheta = −pi;

BUtheta = pi;

P = zeros(N_particles, N_elements);

P(:,1:N_kin_vals) = BLalpha*ones(N_particles,N_kin_vals) ...

87

Page 99: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

+ 2*(BUalpha−BLalpha)*rand(N_particles,N_kin_vals);

P(:,N_kin_vals+1:2*N_kin_vals) = BLbeta*ones(N_particles,N_kin_vals) ...

+ 2*(BUbeta−BLbeta)*rand(N_particles,N_kin_vals);

P(:,2*N_kin_vals+1:3*N_kin_vals) = BLtheta*ones(N_particles,N_kin_vals) ...

+ 2*(BUtheta−BLtheta)*rand(N_particles,N_kin_vals);

P(:,N_elements) = tL + (tU−tL) * rand(N_particles,1);

PBest = zeros(N_particles,N_elements);

J = 50*ones(N_particles,1); JBest = zeros(N_particles,1);

V = zeros(N_particles,N_elements);

%% set lower and upper bounds on unknowns (particle elements)

%% changed to set separate lower and upper bounds for alpha, beta, theta

ones_row = ones(1,N_kin_vals);

BLp = [BLalpha*ones_row,BLbeta*ones_row,BLtheta*ones_row, tL];

BUp = [BUalpha*ones_row,BUbeta*ones_row,BUtheta*ones_row, tU];

k1 = 100;

k3 = 100;

k_cones = 100000;

%% determine velocity bounds

BUv = BUp − BLp;

BLv = −BUv;

for i = 1:N_particles

88

Page 100: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

JBest(i) = inf;

end

GG = inf;

x0 = [0 0 0 0 0 0 1];

%% Output Diagnostics

jshow = 20

reset_count = 0;

for j = 1:N_iterations

if (mod(j,jshow) == 0)

fprintf('iteration = %i\n',j)

end

%%%%%%%%%%%

% PSO Implementation

%%%%%%%%%%%

EvaliPSOJ_v3;

EvalPGBest;

UpdateV(j);

UpdateP;

GGstar(j) = GG;

%PSO reset implementation

reset_count = reset_count + 1;

if (j >= 0.1*N_iterations && reset_count >= 20)

89

Page 101: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

sum_G = 0.0;

for kk=j−9:j

sum_G = sum_G + GGstar(kk);

end

avg_G = sum_G/10;

if abs(avg_G − GG)/GG < 0.01

N_fraction = 0.5*N_particles;

P(1:N_fraction,1:N_kin_vals) = ...

BLalpha*ones(N_fraction,N_kin_vals) ...

+ 2*(BUalpha−BLalpha)*rand(N_fraction,N_kin_vals);

P(1:N_fraction,N_kin_vals+1:2*N_kin_vals) = ...

BLbeta*ones(N_fraction,N_kin_vals) ...

+ 2*(BUbeta−BLbeta)*rand(N_fraction,N_kin_vals);

P(1:N_fraction,2*N_kin_vals+1:3*N_kin_vals) = ...

BLtheta*ones(N_fraction,N_kin_vals) ...

+ 2*(BUtheta−BLtheta)*rand(N_fraction,N_kin_vals);

P(1:N_fraction,N_elements) = tL + (tU−tL)*rand(N_fraction,1);

fprintf('***** reset %i of %i particles\n', N_fraction, N_particles)

reset_count = 0;

end

end

end

%%%%%%%%%%%

% PSO Output Results

90

Page 102: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

%%%%%%%%%%%

timef = cputime;

run_time = timef − time0

save 'results_3000_iter_6elem_v3code_k1100k3100k_cones100000_tU5_run2'

genkin_Bsplines_v2

%% EvalPGBest

% EvalP&GBest determines the best position visited by particle i % up through the current iteration

% R.G Melton

function EvalPGBest()

global P J JBest PBest GG GBest N_particles

for i = 1:N_particles

if J(i) < JBest(i)

PBest(i,:) = P(i,:);

JBest(i) = J(i);

end

end

for i = 1:N_particles

if J(i) < GG

GG = J(i);

fprintf('GG = %10.6f \n', GG)

GBest = P(i,:);

91

Page 103: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

end

end

%% UpdateP

% UpdateP updates the position vector

% R.G Melton

function UpdateP()

global P N_particles N_elements V BLp BUp

for i =1:N_particles

P(i,:) = P(i,:) + V(i,:);

for k = 1:N_elements

if P(i,k) < BLp(k)

P(i,k) = BLp(k);

V(i,k) = 0;

end

if P(i,k) > BUp(k)

P(i,k) = BUp(k);

V(i,k) = 0;

end

end

end

92

Page 104: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

%% UpdateV

% updates the velocity vector V

% R.G Melton

function UpdateV(j_iter)

global P PBest GBest N_particles N_elements V BLv BUv

global N_iterations

for i =1:N_particles

% unused alternatives to velocity updates

% c_I = (1 + rand)/2;

% c_C = 0.01 + 1.49445*rand*j_iter/N_iterations;

% c_S = 0.01 + 1.49445*rand*j_iter/N_iterations;

% c_I decreases linearly with j

% c_S & c_C are stationary

c_I_max = 1.0;

c_I_min = 0.1;

c_I = c_I_max − (c_I_max − c_I_min)*j_iter/N_iterations;

c_C = 1.49445*rand;

c_S = 1.49445*rand;

V(i,:) = c_I*V(i,:) + c_C*(PBest(i,:) − P(i,:)) + c_S*(GBest − P(i,:));

for k = 1:N_elements

93

Page 105: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

if V(i,k) < BLv(k)

V(i,k) = BLv(k);

end

if V(i,k) > BUv(k)

V(i,k) = BUv(k);

end

end

end

94

Page 106: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Appendix B|

Inversion Dynamics Code and Cost Function

B.1 Matlab Code

%% J−Eval

% Inversion Dynamics and Cost Function

% Ko Basu July 24th 2016

global P J N_particles N_elements N_kin_vals

global k1 k3 t0 tf

global alphasp betasp thetasp korder

global alpha0 alphaf beta0 betaf theta0 thetaf

%%%%%%%%%%%%%%%%%%%%%%%

%%%%% added global vars for keep−out cone constraints

global caS caE caM beta_S beta_E beta_M k_cones

for i=1:N_particles

tf = P(i,N_elements);

n_timesteps = 25;

95

Page 107: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

%%%%%%%%%%%%%%%%%%%%%%%%

% Building Knot Vector

%

% knots = [t0,t0, t0, t0:tf/(N_torq_vals+1):tf, tf, tf, tf];

% eg knots = [0 0 0 0 0 1 2 3 4 5 5 5 5 5] if tf=5;

%(produces N_torq_vals + 8) knots

% knot sequence for clamped spline

korder = 4; % Hence Cubic Polynimial

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% changed definition of n

% 4 of the ctrl pts are determined by b.c.

% (first 2 and last 2 for each spline)

% So make n = N_kin_vals −1 + 4 = N_kin_vals + 3

% This will now use all of the values calc by the PSO

n = N_kin_vals + 3;

knots = zeros(1,n+korder+1);

for j = 1:korder

knots(j) = t0;

end

for j = korder+1 : n+1

knots(j) = (j−korder)/(n−korder+2)*tf;

end

for j = n+2 : n+korder+1

knots(j) = tf;

end

96

Page 108: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

%%%%%%%%%%%%%%%%%%%%%%%

% Building ControlVector

alpha_vals = [alpha0, alpha0, P(i,1:N_kin_vals), alphaf, alphaf];

beta_vals = [beta0, beta0, P(i,N_kin_vals+1:2*N_kin_vals), betaf, betaf];

theta_vals = [theta0, theta0,P(i,2*N_kin_vals+1:3*N_kin_vals), thetaf, thetaf];

% Making B−Splines

alphasp = spmak(knots, alpha_vals);

betasp = spmak(knots, beta_vals);

thetasp = spmak(knots, theta_vals);

% Making 1st derivative of B−Splines

alphaspd = fnder(alphasp,1);

betaspd = fnder(betasp,1);

thetaspd = fnder(thetasp,1);

% Making 2nd derivative of B−Splines

alphaspdd = fnder(alphasp,2);

betaspdd = fnder(betasp,2);

thetaspdd = fnder(thetasp,2);

tmatrix = linspace(0,tf,n_timesteps);

con1 = 0;

97

Page 109: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

con2 = 0;

con3 = 0;

pen_cones = 0;

MMax =1;

I1 = 1; I2 = 1; I3 = 1;

for k = 1 : n_timesteps

t = tmatrix(k);

alpha = fnval(alphasp,t);

beta = fnval(betasp,t);

theta = fnval (thetasp,t);

alphad = fnval(alphaspd,t);

betad = fnval(betaspd,t);

thetad = fnval (thetaspd,t);

alphadd = fnval(alphaspdd,t);

betadd = fnval(betaspdd,t);

thetadd = fnval (thetaspdd,t);

sa = sin(alpha);

ca = cos(alpha);

sb = sin(beta);

cb = cos(beta);

98

Page 110: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

lambda1 = cb*ca;

lambda2 = cb*sa;

lambda3 = sb;

lambda1d = − betad*sb*ca − alphad*cb*sa;

lambda2d = − betad*sb*sa + alphad*cb*ca;

lambda3d = betad*cb;

%%%%%%%%%%%%%%%%%

% Inversion Formulation

lambda1dd = − betadd*sb*ca − betad^2*cb*ca...

+betad*sb*alphad*sa + betad*sb*alphad*sa...

−alphadd*cb*sa − alphad^2*cb*ca;

lambda2dd = − betadd*sb*sa − betad^2*cb*sa...

−betad*sb*alphad*ca − betad*sb*alphad*ca...

+alphadd*cb*ca − alphad^2*sa*cb;

lambda3dd = betadd*cb − betad^2 * sb;

st2 = sin(theta/2);

ct2 = cos(theta/2);

e1 = lambda1 * st2;

99

Page 111: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

e2 = lambda2 * st2;

e3 = lambda3 * st2;

e4 = ct2;

e1d = lambda1d * st2 + thetad/2*lambda1*ct2;

e2d = lambda2d * st2 + thetad/2*lambda2*ct2;

e3d = lambda3d * st2 + thetad/2*lambda3*ct2;

e4d = −thetad/2*st2;

e1dd = lambda1dd * st2 + thetadd/2*lambda1*ct2 ...

+ 2*lambda1d*thetad/2*ct2−(thetad/2)^2*lambda1*st2;

e2dd = lambda2dd * st2 + thetadd/2*lambda2*ct2 ...

+ 2*lambda2d*thetad/2*ct2−(thetad/2)^2*lambda2*st2;

e3dd = lambda3dd * st2 + thetadd/2*lambda3*ct2 ...

+ 2*lambda3d*thetad/2*ct2−(thetad/2)^2*lambda3*st2;

e4dd = −thetadd/2*st2 − (thetad/2)^2*ct2;

E = [e4 e3 −e2 −e1;

−e3 e4 e1 −e2;

e2 −e1 e4 −e3;

e1 e2 e3 e4];

ed = [e1d;e2d;e3d;e4d];

100

Page 112: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Ed = [e4d e3d −e2d −e1d;

−e3d e4d e1d −e2d;

e2d −e1d e4d −e3d;

e1d e2d e3d e4d];

edd = [e1dd;e2dd;e3dd;e4dd];

w = 2 * E * ed;

wd = 2 * Ed*ed + 2 * E * edd;

M1= I1 * wd(1) + w(2)* w(3) * (I3−I2);

M2= I2 * wd(2) + w(3)* w(1) * (I1−I3);

M3= I3 * wd(3) + w(1)* w(2) * (I2−I1);

con1 = con1 + max(0,abs(M1)−MMax);

con2 = con2 + max(0,abs(M2)−MMax);

con3 = con3 + max(0,abs(M3)−MMax);

sigma = [1−2*(e2^2 + e3^2), 2*(e1*e2 + e3*e4), 2*(e3*e1 − e2*e4)];

c_S = dot(sigma, beta_S);

c_E = dot(sigma, beta_E);

c_M = dot(sigma, beta_M);

pen_cones = pen_cones + max(0, c_S−caS) + max(0,c_E−caE) + max(0,c_M−caM);

101

Page 113: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

end

%%%%%%%%%%%%%%%%%%%%%%

% J Cost Function

J_constraints = k1*(con1 + con2 + con3) + k_cones*pen_cones;

J_time = k3*abs(tf);

J(i) = J_constraints + J_time;

end

return

102

Page 114: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Appendix C|

Pseudospectral

C.1 Matlab Code

%% Psuedospectral Optimal Control (Dido File)

% By Ko Basu

% November 15th 2016

clear all

close all

clc

%==============================================================

%%%%%%%%%%%

% Define the problem function files:

%%%%%%%%%%%

conoptslew.cost = 'ConSlewCost';

conoptslew.dynamics = 'ConSlewDynamics';

conoptslew.events = 'ConSlewEvents';

conoptslew.path = 'ConSlewPath';

103

Page 115: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

%%%%%%%%%%%

% Set up the problem bounds in SCALED units

%%%%%%%%%%%

tfMax = 20;

bounds.lower.time = [0 eps];

bounds.upper.time = [0 tfMax];

w1o = 0; w2o = 0; w3o = 0;

q1o = 0; q2o = 0; q3o = 0; q4o = 1;

w1f = 0.0; w2f = 0.0; w3f = 0.0;

%% define final orientation

theta = 3*pi/4;

lambda = [0; 0; 1];

q1f = lambda(1)*sin(theta/2.);

q2f = lambda(2)*sin(theta/2.);

q3f = lambda(3)*sin(theta/2.);

q4f = cos(theta/2.);

bounds.lower.states = [−pi; −pi; −pi; −1; −1; −1; −1];

bounds.upper.states = [pi; pi; pi; 1; 1; 1; 1];

104

Page 116: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

bounds.lower.controls = [−1; −1; −1];

bounds.upper.controls = [1; 1; 1];

bounds.lower.events = [w1o; w2o; w3o; q1o; q2o; q3o; q4o; w1f; w2f; w3f; q1f; q2f; q3f; q4f];

bounds.upper.events = bounds.lower.events;

alpha_S = 17*pi/180; % min angle between sensor and Sun line

alpha_M = 17*pi/180; % min angle between sensor and Moon line

alpha_neg_z = 33*pi/180; % min angle between sensor and neg. z−axis

bounds.lower.path = [alpha_S; alpha_M; alpha_neg_z];

bounds.upper.path = [pi; pi; pi];

%%%%%%%%%%%

% Tell DIDO the bounds on the problem

%%%%%%%%%%%

conoptslew.bounds = bounds;

%%%%%%%%%%%

% Select the number of nodes for the spectral algorithm

%%%%%%%%%%%

algorithm.nodes = [50];

%%%%%%%%%%%

% call DIDO:

%%%%%%%%%%%

105

Page 117: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

%−−−−−−−−−−−−

% generate guess

−−−−−−−−−−−−

d = [1 1 2];

d = d/sqrt(dot(d,d));

alpha = 1;

alpha1 = alpha*d(1);

alpha2 = alpha*d(2);

alpha3 = alpha*d(3);

delta_theta = pi;

delta_t = 2*pi;

M1_0 = 0;

M1_c = 0;

M1_f = 0;

M2_0 = −0.1;

M2_c = 0.01;

M2_f = 0;

M3_0 = 0;

M3_c = 0.1;

M3_f = −0.01;

%%

%% Here is where you could insert your own guesses for the controls, states, and node−times

%%

% algorithm.guess.controls = [M1_0 M1_c M1_f; M2_0 M2_c M2_f; M3_0 M3_c M3_f];

106

Page 118: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

% algorithm.guess.states = [0 0 0; 0 −0.1 0; 0 0.1 0;

% 0 0 0; 0 −1/sqrt(2) 0; 0 0 1/sqrt(2); 1 1/sqrt(2) 1/sqrt(2)];

% algorithm.guess.time = [0 delta_t/2 delta_t];

%%

startTimeGuess = cputime;

display('begin DIDO')

%% Use the following call to start DIDO if you are providing initial guesses

% in the algorithm structure

[cost, primal, dual] = dido(conoptslew, algorithm);

%%

% Otherwise, use this call

%[cost, primal, dual] = dido(conoptslew);

display('finished DIDO')

GuessRunTime = cputime − startTimeGuess

%%%%%%%%%%%

%−−− save data −−−−

%%%%%%%%%%%

save 'rrun_50nodes'

107

Page 119: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Appendix D|

iPSO Runs

D.1 PSU run tables

Table D.1: (30 Particles, 3000 Iterations)

Run# GG Comment1 2279 short2 3709 between moon and sun cone3 869 short4 563 short5 3383 infeasible M & S cone6 1549 short7 1619 short8 3316 long path containing a loop9 4186 infeasible M & S cone10 765 short11 1130 short12 576 short13 749 short14 1124 short15 598 short16 646 short17 493.6 short18 1626 long path19 1180 infeasible M & S cone20 994 short

108

Page 120: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Table D.2: (500 Particles, 3000 Iterations)

Run# GG Comment1 57766 infeasible2 2628 between moon and sun cone cone3 495.91 short4 2353 short5 472.39 long path6 499.93 between moon and sun cone7 457.86 short8 1049 short loop9 1113 short10 2289 short11 554 short12 989 short13 2657 short14 466.61 short15 823 short16 57848 infeasible17 2288 short18 436.23 short19 489.19 between moon and sun cone20 60783 infeasible

109

Page 121: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Table D.3: (1000 Particles, 3000 Iterations)

Run# GG Comment1 425.11 short2 1191 short cone3 1060 short4 2053 short5 935 long path6 496.06 between moon and sun cone7 533 short8 1313 short loop9 431.94 short10 560 short11 476.42 between moon and sun cone12 30777 infeasible13 13762 short14 2120 long path15 840 between moon and sun cone16 57825 infeasible17 1470 short18 415.71 short19 2733 short20 670 short

110

Page 122: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Table D.4: (1500 Particles, 3000 Iterations)

Run# GG Comment1 2629 short2 57851 infeasible cone3 447.97 between moon and sun cone4 475.09 between moon and sun cone5 1101 short6 1342 long path7 494.37 between moon and sun cone8 6618 short loop9 422.94 short10 482.55 between moon and sun cone11 473.31 short12 57792 infeasible13 772 short14 437.41 short15 436.09 short16 1977 short17 491.36 between moon and sun cone18 42407 short19 494.16 between moon and sun cone20 1140 short

111

Page 123: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Appendix E|

BSpline Implementation

E.1 BSplines by Shene

B-splines are defined in terms of control points Pi and coefficients Ni,p. The basic definition for

a function Z in terms of some parameter τ is

Z(τ) =n+1∑i=1

Ni,p(τ)Pi

The n+ 1 control points are 2-dimensional, with the 1-axis usually corresponding to time t (or

some other independent variable), and the 2-axis corresponding to some dependent variable, such as

a kinematic variable or a control input. Note that t and τ are not the same; this distinction leads to

a complication later when we need to compute derivatives of Z.

The parameter p defines the order of the spline, which is composed of a linear combination

of polynomials in τ , with the highest-power given by p. Construction of the spline begins with

a knot-string composed of non-descending values of τ : τ1, τ2, . . . , τm+1, where m = n + p + 1. In

most treatments of B-splines, the knot-string is defined to lie on the domain [0, 1]; however, larger

upper values are possible so long as numerical values for the higher powers in the polynomials do

not become a problem. For inverse-dynamics problems, where the initial and final values of the

kinematic variables are fixed, it is useful to employ a clamped B-spline, which requires a special

112

Page 124: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

structure of the knot-string. In this case, the values of the knots are given by

τi =

0, 1 ≤ i ≤ p+ 1

(i−p−1n−p+1

)tf , p+ 2 ≤ i ≤ n+ 1

tf , n+ 2 ≤ i ≤ m+ 1

For a clamped B-spline, making the ordinate values of the first two control points equal, and doing

the same for the last two control points, forces the first derivative of the ordinate variable to be

zero at the end points. (This is not required in every problem, but for the rest-to-rest time-optimal

reorientation problem, we know that the initial and final derivatives of the kinematic variables are

all zero; this will also make the body rates zero at the end points.)

Shene gives a useful algorithm for calculating the values of the coefficients for a given value of τ

and given control points Pi. The following triangle algorithm is taken from Shene, with the indices

modified to start at 1 rather than 0.

Triangle Algorithm:

Shene notes that this algorithm is not efficient; however, in practice, it is sufficiently fast.

Computing derivatives of Z(τ) with respect to τ is fairly straightforward, but remember that τ

and t are different! For the derivative dZ/dτ , one forms a new knot-string τ (1) by deleting the first

113

Page 125: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Algorithm 2 B-SplineInput: n, p,m, u, and m+1 clamped knots [ τ1, ..., τm+1 ]

Output: Coefficients N1,p(τ), N2,p(τ), . . . , Nn+1,p(τ) in N [1], N [2], . . . , N [n+ 1]

Initialize N [1 . . . n+ 1] to 0;if τ = τ1 then // rule out special cases

N [1] = 1.0;return

elseif τ = τm+1 then

N[n+1] = 1.0;return

end ifend if// now τ is between τ1 and τm+1Let τ be in knot-span [τk, τk+1);N [k] := 1.0 // degree 0 coefficientfor d :=1 to p do // degree d goes from 1 to p

N [k − d] = τk+1−ττk+1−τ(k−d)+1

N [(k − d) + 1]; // right (south-west corner) term onlyfor i := k − d+ 1 to k − 1 do // compute internal terms

N [i] := τ−τi

τi+d−τiN [i] + τi+d+1−τ

τi+d+1−τi+1N [i+ 1];

end forN [k] = τ−τk

τk+d−τkN [k]; // left (north-west corner) term only

end for// array N [1 . . . n+ 1] has the coefficients.

and last knots from the original string, resulting in

τ (1) = (τ2, . . . , τm)

One also forms a new set of n control points Qi defined by

Qi = p

τ(1)i+p − τ

(1)i

(Pi+1 − Pi), i = 1 . . . n (E.1)

The derivative with respect to τ isdZdτ

=n∑i=1

Ni,p−1(τ)Qi (E.2)

114

Page 126: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

where the coefficients Ni,p−1 are computed using the knot-string τ (1) and the value p− 1 in place of

p in the triangle algorithm.

For the second-derivative, d2Z/dτ 2, the above steps are repeated, with a new knot-string τ (2)

formed by deleting the first and last knots in the string τ (1), resulting in a new knot-string

τ (2) = (τ (1)2 , . . . , τ

(1)m−1)

and a new set of control points

Ri = p− 1τ

(2)i+p−1 − τ

(2)i

(Qi+1 −Qi), i = 1 . . . n− 1

and the second-derivative with respect to τ is then

d2Zdτ 2 =

n−1∑i=1

Ni,p−2(τ)Ri (E.3)

where the coefficients Ni,p−2 are computed using the knot-string τ (2) and the value p− 2 in place of

p in the triangle algorithm.

Recall that each spline Z consists of two coordinates. Let the first coordinate g represent time

t, and let the second coordinate f represent the variable being modeled (for example, a kinematic

variable). The spline curve Z(τ) can now be written as Z = (g(τ), f(τ)) or equivalently Z = (x, y)

where x = g(τ) is the actual time t, plotted on the abscissa axis, and y = f(τ) is the variable being

modeled, plotted on the ordinate axis. To determine the derivatives of Z with respect to time t, use

the rules for differentiation:dy

dt= df

dt= df/dτ

dg/dτ

and the values of df/dτ and dg/dτ are the components of the derivative dZ/dτ calculated using Eq

115

Page 127: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

(E.2), i.e., dZ/dτ is the vector [dg/dτ, df/dτ ]

Calculation of the second-derivative again requires application of the rules for differentiation:

d2y

dt2= d

dt

(dy

dt

)= d

dt

(df/dτ

dg/dτ

)= d

(df/dτ

dg/dτ

)dτ

dt

=dgdτ

d2fdτ2 − df

dτd2gdτ2(

dgdτ

)2dτdg

=dgdτ

d2fdτ2 − df

dτd2gdτ2(

dgdτ

)3 (E.4)

and the second-derivatives with respect to τ are calculated using Eq. (E.3), i.e. d2Z/dτ 2 =

[d2g/dτ 2, d2f/dτ 2].

E.2 Matlab Code

%% B_Spline Implementation

% By Robert Melton

% May 10th 2016

function [f,f_dot,f_ddot,tx] = B_spline(CP,knots,t)

% inputs are the control points (CP), knots, time

% outputs are the approxiimated function's value f, and it's derivatives

% f_dot, f_ddot

%% CP is a 2D array, with each row containing 2 elements (time, f)

[nctrl,~] = size (CP);

n = nctrl−1;

116

Page 128: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

nknots = length(knots);

knots1 = knots(2:end−1);

knots2 = knots1(2:end−1);

m = nknots−1;

p = m−n−1;

n1 = n−1;

n2 = n−2;

m1 = m−2;

m2 = m−4;

Q = zeros(n,2);

R = zeros(n1,2);

for i=1:n

Q(i,:) = p/(knots1(i+p) − knots1(i))*(CP(i+1,:) − CP(i,:));

end

for i=1:n1;

R(i,:) = (p−1)/(knots2(i+p−1) − knots2(i))*(Q(i+1,:) − Q(i,:));

end

N = bspline_triangle(n,m,t,knots);

N1 = bspline_triangle(n1,m1,t,knots1);

N2 = bspline_triangle(n2,m2,t,knots2);

Y_approx = N'*CP; % dot product of N with each column of P

Y_dot_approx = N1'*Q;

Y_ddot_approx = N2'*R;

f = Y_approx(1,2);

tx = Y_approx(1,1);

117

Page 129: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

f1 = Y_dot_approx(1,2);

g1 = Y_dot_approx(1,1);

f_dot = f1/g1;

f2 = Y_ddot_approx(1,2);

g2 = Y_ddot_approx(1,1);

f_ddot = (f2*g1 − g2*f1)/g1^3;

end

function N = bspline_triangle(n,m,t,knots)

% implements the triangular form of B−spline generation

%

p = m − n − 1;

N = zeros(n+1,1);

%%% special cases %%%

if t == knots(1)

N(1) = 1.0;

return

else if t == knots(m+1)

N(n+1) = 1.0;

return

end

%%%%%%%%%%%%%%%%%%%%%

%%% determine which knots bound t %%%

k = 1;

118

Page 130: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

for jj = 1:m

if (t < knots(jj+1))

%% if(knots(jj) <= t) && (t < knots(jj+1))

k = jj;

break

end

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%

N(k) = 1.0;

for d = 1:p

N(k−d) = (knots(k+1) − t)/(knots(k+1) − knots(k−d+1))*N(k−d+1); % right (south−west

... corner) term only

for i = k−d+1:k−1

N(i) = (t−knots(i))/(knots(i+d) − knots(i))*N(i)+

(knots(i+d+1) − t)/(knots(i+d+1) − knots(i+1))*N(i+1);% computer internal terms

end

N(k) = (t−knots(k))/(knots(k+d) − knots(k))*N(k); % (north−west corner) term only

end

end

119

Page 131: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Appendix F|

Parallelization Code

F.1 C++ Code

//PSO Pa r a l l e l i z a t i o n C++ Implementation

//by Ko Basu

//Dec 14 th 2016

#inc lude <s td i o . h>

#inc lude <s t d l i b . h>

#inc lude <iostream>

#inc lude <math . h>

#inc lude <c f l o a t >

#inc lude <s t d l i b . h>

#inc lude <omp . h>

#inc lude <sys / time . h>

#inc lude <cs t r i ng >

#inc lude <g s l / g s l_bsp l i n e . h>

120

Page 132: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

#de f i n e PI 3.14159265358979323846

//Time Optimal Search Space

#de f i n e tL 1

#de f i n e tU 5

//Penalty Weightings f o r Cost Function

#de f i n e k1 1000

#de f i n e k2 100

#de f i n e k3 10

#de f i n e k_cones 100000

//Mass Moment o f I n e r t i a s

#de f i n e I1 1

#de f i n e I2 1

#de f i n e I3 1

us ing namespace std ;

// Pa r t i c l e (C implementation Var iab l e s )

s t r u c t Pa r t i c l e

{

f l o a t ∗ e lements ;

f l o a t ∗PBest ;

121

Page 133: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

f l o a t J ;

f l o a t JBest ;

f l o a t ∗V;

} ;

//Function De f i n i t i o n s used in Main Function

void EvalJ ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements , i n t num_kin_vals , i n t

nBreak , i n t k , double ∗bounds , i n t dt ) ;

void d i s p l a yPa r t i c l e ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements ) ;

void EvalPGBest ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements , f l o a t &GG, f l o a t

∗GBest ) ;

void updateV ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements , f l o a t GG, f l o a t ∗

GBest , \

f l o a t ∗BLv , f l o a t ∗BUv, i n t i t e r , i n t t o t a l_ i t e r ) ;

void updateP ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements , f l o a t GG, f l o a t ∗

GBest , \

f l o a t ∗BLp, f l o a t ∗BUp) ;

void c t r lPt sGenera te ( Pa r t i c l e ∗a , i n t num_kin_vals , double ∗bounds , double ∗ c t r l P t s )

;

void bSpl ineGenerate ( i n t nBreak , i n t k , gs l_bspl ine_workspace ∗∗bw, gs l_vector ∗∗B,\

double ∗ c t r lP t s , i n t nCtrlPts , double lBound , double uBound) ;

void bSpl ineEval ( double x , i n t nDeriv , double ∗ r e su l t , gs l_bspl ine_workspace ∗bw,\

gs l_vector ∗B, double ∗ c t r lP t s , i n t nCtr lPts ) ;

122

Page 134: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

void swapPart i c l e ( Pa r t i c l e &a , Pa r t i c l e &b , i n t num_elements ) {

Pa r t i c l e temp ;

temp . e lements=new f l o a t [ num_elements ] ;

temp . PBest=new f l o a t [ num_elements ] ;

temp .V=new f l o a t [ num_elements ] ;

f o r ( i n t i =0; i<num_elements ; i++){

temp . e lements [ i ]=b . e lements [ i ] ;

temp . PBest [ i ]=b . PBest [ i ] ;

temp .V[ i ]=b .V[ i ] ;

b . e lements [ i ]=a . e lements [ i ] ;

b . PBest [ i ]=a . PBest [ i ] ;

b .V[ i ]=a .V[ i ] ;

a . e lements [ i ]=temp . e lements [ i ] ;

a . PBest [ i ]=temp . PBest [ i ] ;

a .V[ i ]=temp .V[ i ] ;

}

temp . J=b . J ;

temp . JBest=b . JBest ;

b . J=a . J ;

b . JBest=a . JBest ;

123

Page 135: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

a . J=temp . J ;

a . JBest=temp . JBest ;

}

// s o r t i n g p a r t i c l e s f o r r e s e t t i n g opera t i on o f PSO

void s o r t P a r t i c l e s ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements ) {

f o r ( i n t i = 0 ; i < ( num_partic les − 1 ) ; i++)

{

f o r ( i n t j = 0 ; j < ( num_partic les − i − 1) ; j++)

{

i f ( a [ j ] . J > a [ j +1] . J ) /∗ For dec r ea s ing order use < ∗/

{

swapPart i c l e ( a [ j +1] , a [ j ] , num_elements ) ;

}

}

}

}

// Main Function

i n t main ( )

{

s t r u c t t imeva l sTime , eTime ;

124

Page 136: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

// PSO Cha r a c t e r i s t i c s

i n t N_part ic l e s =2000 , N_elements , N_iterat ions =3000 ,N_kin_vals=6;

cout <<" \n # of P a r t i c l e s "<<N_part ic l e s ;

gett imeofday(&sTime ,NULL) ;

N_elements = 3∗N_kin_vals+1;

f l o a t GG=FLT_MAX;

f l o a t ∗GBest ;

GBest = new f l o a t [ N_elements ] ;

P a r t i c l e ∗pSwarm ;

pSwarm=new Pa r t i c l e [ N_part ic l e s ] ;

i f (pSwarm==NULL)

{

cout <<" \n Error cannot a l l o c a t e memory" ;

}

f o r ( i n t i =0; i<N_part ic l e s ; i++)

{

pSwarm [ i ] . e lements=new f l o a t [ N_elements ] ;

pSwarm [ i ] . PBest=new f l o a t [ N_elements ] ;

125

Page 137: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

pSwarm [ i ] .V=new f l o a t [ N_elements ] ;

}

f l o a t ∗BLp ;

f l o a t ∗BUp;

f l o a t ∗BLv,∗BUv;

BLp = new f l o a t [ N_elements ] ;

BUp = new f l o a t [ N_elements ] ;

BLv = new f l o a t [ N_elements ] ;

BUv = new f l o a t [ N_elements ] ;

f o r ( i n t i =0; i<N_elements−1; i++)

{

i f ( i <6)

{

BLp [ i ]=−PI ;

BUp[ i ]=PI ;

BUv[ i ]=BUp[ i ]−BLp [ i ] ;

BLv [ i ]=−BUv[ i ] ;

}

e l s e i f ( i <12)

{

BLp [ i ]=−PI /2 ;

126

Page 138: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

BUp[ i ]=PI /2 ;

BUv[ i ]=BUp[ i ]−BLp [ i ] ;

BLv [ i ]=−BUv[ i ] ;

}

e l s e

{

BLp [ i ]=−PI ;

BUp[ i ]=PI ;

BUv[ i ]=BUp[ i ]−BLp [ i ] ;

BLv [ i ]=−BUv[ i ] ;

}

}

BLp [ N_elements−1]=tL ;

BUp[ N_elements−1]=tU ;

BUv[ N_elements−1]=tU−tL ;

BLv [ N_elements−1]=−BUv[ N_elements−1] ;

srand ( time (NULL) ) ;

// { I n i t i a l Or i t en ta t i on (0 , 0 , 0 ) , F ina l Or i enta t i on (PI /2 ,0 ,3∗PI /4) }

double b [ ]= {0 ,0 ,0 , PI /2 ,0 ,3∗PI /4} ;

// Pa r t i c l e Random I n i t i a l i z a t i o n

127

Page 139: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

f o r ( i n t i =0; i<N_part ic l e s ; i++)

{

// Implementing Equation ( 3 . 1 5 )

f o r ( i n t j =0; j<N_elements ; j++)

{

pSwarm [ i ] . e lements [ j ]=−PI + 2∗PI ∗( rand ( ) %10001) ∗0 . 0001 ;

}

pSwarm [ i ] . e lements [ N_elements−1]= tL + (tU−tL ) ∗( rand ( ) %10001) ∗0 . 0001 ;

pSwarm [ i ] . JBest= FLT_MAX;

pSwarm [ i ] . J= FLT_MAX;

}

f o r ( i n t i =0; i<N_iterat ions ; i++, dispCnt++, resetCnt++)

{

EvalJ (pSwarm , N_part ic les , N_elements , N_kin_vals , 8 , 4 , b , 2 5 ) ;

EvalPGBest (pSwarm , N_part ic les , N_elements , GG, GBest ) ;

updateV (pSwarm , N_part ic les , N_elements , GG, GBest , BLv , BUv, i ,

N_iterat ions ) ;

updateP (pSwarm , N_part ic les , N_elements , GG, GBest , BLp, BUp) ;

128

Page 140: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

i f ( dispCnt==100){

cout<<" \nGG: "<<GG<<" \tGGAvg : "<<GGAvg/ resetCnt<<" \ t I t e r : "<<i<<endl ;

dispCnt=0;

}

// PSO Reset

GGAvg+=GG;

i f ( resetCnt >20)

{

GGAvg/=resetCnt ;

i f ( f abs (GGAvg−GG) <0.1)

{

// cout<<"\nResett ing : "<<GGAvg−GG;

// s o r t P a r t i c l e s (pSwarm , N_part ic les , N_elements ) ;

f o r ( i n t j =0; j<N_part ic l e s /2 ; j++)

{

f o r ( i n t k=0; k<N_elements−1; k++)

{

pSwarm [ j ] . e lements [ k]=−PI + 2∗PI ∗( rand ( ) %10001) ∗0 . 0001 ;

129

Page 141: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

}

pSwarm [ j ] . e lements [ N_elements−1]= tL + (tU−tL ) ∗( rand ( ) %10001)

∗0 . 0001 ;

pSwarm [ j ] . JBest= FLT_MAX;

pSwarm [ j ] . J= FLT_MAX;

}

}

GGAvg=0;

resetCnt=0;

}

}

//Used to c a l c u l a t e runtime

gett imeofday(&eTime ,NULL) ;

cout<<" \n\nGBEST\n" ;

f o r ( i n t i =0; i<N_elements ; i++)

{

cout<<GBest [ i ]<<" " ;

}

cout<<" \n\n" ;

130

Page 142: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

//Output B−Sp l ine Coordinates

double ∗ptr=new double [ ( N_kin_vals+4) ∗ 3 ] ;

i n t y=0,z=0;

// Ctr l po in t s f o r alpha

ptr [ y++]=b [ 0 ] ;

ptr [ y++]=b [ 0 ] ;

f o r ( z=0; z<N_kin_vals ; z++)

{

ptr [ y++]=GBest [ z ] ;

}

ptr [ y++]=b [ 1 ] ;

ptr [ y++]=b [ 1 ] ;

// Ctr l po in t s f o r beta

ptr [ y++]=b [ 2 ] ;

ptr [ y++]=b [ 2 ] ;

f o r ( ; z<N_kin_vals ∗2 ; z++)

{

ptr [ y++]=GBest [ z ] ;

131

Page 143: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

}

ptr [ y++]=b [ 3 ] ;

ptr [ y++]=b [ 3 ] ;

// Ctr l po in t s f o r alpha

ptr [ y++]=b [ 4 ] ;

ptr [ y++]=b [ 4 ] ;

f o r ( ; z<N_kin_vals ∗3 ; z++)

{

ptr [ y++]=GBest [ z ] ;

}

ptr [ y++]=b [ 5 ] ;

ptr [ y++]=b [ 5 ] ;

gs l_bspl ine_workspace ∗ a lphaSpl ine , ∗ betaSpl ine , ∗ th e taSp l i n e ;

g s l_vector ∗aVec ;

double r e s [ 3 ] ;

bSpl ineGenerate (8 , 4 , &alphaSpl ine , &aVec , ptr , 10 , 0 , GBest [ N_elements−1]) ;

bSpl ineGenerate (8 , 4 , &betaSpl ine , &aVec , ptr+10, 10 , 0 , GBest [ N_elements−1]) ;

bSpl ineGenerate (8 , 4 , &thetaSp l ine , &aVec , ptr+20, 10 , 0 , GBest [ N_elements−1]) ;

132

Page 144: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

f o r ( double x i =0; xi<=GBest [ N_elements−1] ; x i +=0.1)

{

bSpl ineEval ( xi , 2 , res , a lphaSpl ine , aVec , ptr , 1 0 ) ;

p r i n t f ( " \n%f %f " , xi , r e s [ 0 ] ) ;

bSpl ineEval ( xi , 2 , res , betaSpl ine , aVec , ptr +10 ,10) ;

p r i n t f ( " %f " , r e s [ 0 ] ) ;

bSpl ineEval ( xi , 2 , res , the taSp l ine , aVec , ptr +20 ,10) ;

p r i n t f ( " %f " , r e s [ 0 ] ) ;

}

g s l_bsp l i n e_f r e e ( a lphaSp l ine ) ;

g s l_bsp l i n e_f r e e ( be taSp l ine ) ;

g s l_bsp l i n e_f r e e ( the taSp l i n e ) ;

g s l_vector_f ree ( aVec ) ;

d e l e t e [ ] ptr ;

// Dea l l o ca t i on r ou t i n e s

f o r ( i n t i =0; i<N_part ic l e s ; i++)

{

133

Page 145: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

de l e t e [ ] pSwarm [ i ] . e lements ;

d e l e t e [ ] pSwarm [ i ] . PBest ;

d e l e t e [ ] pSwarm [ i ] .V;

}

d e l e t e [ ] pSwarm ;

d e l e t e [ ] GBest ;

d e l e t e [ ] BLp ;

d e l e t e [ ] BUp;

d e l e t e [ ] BLv ;

d e l e t e [ ] BUv;

std : : cout <<" \n\nRuntime : "<< ( eTime . tv_sec−sTime . tv_sec )+\

( eTime . tv_usec−sTime . tv_usec ) /1e6<<" seconds " ;

s td : : cout<<" \n" ;

r e turn 0 ;

}

// d i sp l ay pa r t c l e e lements ( alpha , beta , theta c on t r o l po ints , f i n a l time )

void d i s p l a yPa r t i c l e ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements )

{

134

Page 146: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

i n t i , j ;

f o r ( i =0; i<num_partic les ; i++)

{

cout<<" \n\n\ nPa r t i c l e "<<i<<" \n" ;

cout<<" \nKin Vals : " ;

f o r ( j =0; j<num_elements−1; j++)

{

cout<<a [ i ] . e lements [ j ]<<" " ;

}

cout<<" \nTime : "<<a [ i ] . e lements [ j ] ;

cout<<" \nJ : "<<a [ i ] . J ;

cout<<" \nJBest : "<<a [ i ] . JBest ;

}

}

// Update Pa r t i c l e Personal Best and Global Best

void EvalPGBest ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements , f l o a t &GG, f l o a t

∗GBest )

{

f o r ( i n t i =0; i<num_partic les ; i++)

{

i f ( a [ i ] . J < a [ i ] . JBest )

{

f o r ( i n t j =0; j<num_elements ; j++)

{

135

Page 147: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

// Implementing Equation ( 3 . 2 0 )

a [ i ] . PBest [ j ] = a [ i ] . e lements [ j ] ;

}

a [ i ] . JBest = a [ i ] . J ;

}

i f ( a [ i ] . J < GG)

{

f o r ( i n t j =0; j<num_elements ; j++)

{

// Implementing Equation ( 3 . 2 2 )

GBest [ j ] = a [ i ] . e lements [ j ] ;

}

GG = a [ i ] . J ;

}

}

}

// Update Ve loc i ty Vector

void updateV ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements , f l o a t GG, f l o a t ∗

GBest , \

f l o a t ∗BLv , f l o a t ∗BUv, i n t i t e r , i n t t o t a l_ i t e r )

{

// Implementing Equation ( 3 . 2 4 )

f l o a t c I =1−(1−0.1)∗ i t e r / t o t a l_ i t e r ;

f l o a t cC=1.49445∗( rand ( ) %10001) ∗0 . 0001 ;

136

Page 148: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

f l o a t cS=1.49445∗( rand ( ) %10001) ∗0 . 0001 ;

f o r ( i n t i =0; i<num_partic les ; i++)

{

f o r ( i n t j =0; j<num_elements ; j++)

{

// Implementing Equation ( 3 . 2 3 )

a [ i ] .V[ j ] =c I ∗a [ i ] .V[ j ]+cC∗( a [ i ] . PBest [ j ]−a [ i ] . e lements [ j ] )+cS ∗(GBest [ j

]−a [ i ] . e lements [ j ] ) ;

}

f o r ( i n t j =0; j<num_elements ; j++)

{

i f ( a [ i ] .V[ j ] < BLv [ j ] )

a [ i ] .V[ j ]=BLv [ j ] ;

i f ( a [ i ] .V[ j ] > BUv[ j ] )

a [ i ] .V[ j ]=BUv[ j ] ;

}

}

}

//Update Pa r t i c l e ( Previous + Ve loc i ty )

void updateP ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements , f l o a t GG, f l o a t ∗

137

Page 149: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

GBest , \

f l o a t ∗BLp, f l o a t ∗BUp)

{

f o r ( i n t i =0; i<num_partic les ; i++)

{

f o r ( i n t j =0; j<num_elements ; j++)

{

a [ i ] . e lements [ j ] =a [ i ] . e lements [ j ]+a [ i ] .V[ j ] ;

}

f o r ( i n t j =0; j<num_elements ; j++)

{

i f ( a [ i ] . e lements [ j ] < BLp [ j ] )

{

a [ i ] . e lements [ j ]=BLp [ j ] ;

a [ i ] .V[ j ]=0;

}

i f ( a [ i ] . e lements [ j ] > BUp[ j ] )

{

a [ i ] . e lements [ j ]=BUp[ j ] ;

a [ i ] .V[ j ]=0;

}

}

138

Page 150: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

}

}

//Create an array conta in ing con t r o l po int va lue s and re tu rn s the po in t e r to

i t .

void c t r lPt sGenera te ( Pa r t i c l e ∗a , i n t num_kin_vals , double ∗bounds , double ∗ptr )

{

i n t i =0, j =0;

// Ctr l po in t s f o r alpha

ptr [ i++]=bounds [ 0 ] ;

ptr [ i++]=bounds [ 0 ] ;

f o r ( j =0; j<num_kin_vals ; j++)

{

ptr [ i++]=a−>elements [ j ] ;

}

ptr [ i++]=bounds [ 1 ] ;

ptr [ i++]=bounds [ 1 ] ;

// Ctr l po in t s f o r beta

ptr [ i++]=bounds [ 2 ] ;

139

Page 151: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

ptr [ i++]=bounds [ 2 ] ;

f o r ( ; j<num_kin_vals ∗2 ; j++)

{

ptr [ i++]=a−>elements [ j ] ;

}

ptr [ i++]=bounds [ 3 ] ;

ptr [ i++]=bounds [ 3 ] ;

// Ctr l po in t s f o r theta

ptr [ i++]=bounds [ 4 ] ;

ptr [ i++]=bounds [ 4 ] ;

f o r ( ; j<num_kin_vals ∗3 ; j++)

{

ptr [ i++]=a−>elements [ j ] ;

}

ptr [ i++]=bounds [ 5 ] ;

ptr [ i ]=bounds [ 5 ] ;

}

void EvalJ ( Pa r t i c l e ∗a , i n t num_particles , i n t num_elements , i n t num_kin_vals , i n t

140

Page 152: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

nBreak , i n t k , double ∗bounds , i n t nTSteps )

{

// i n t t i d ;

// PARALLELIZATION

#pragma omp p a r a l l e l f o r

f o r ( i n t zz=0; zz<num_partic les ; zz++)

{

double ∗ a r rCt r lPt s=new double [ ( num_kin_vals+4) ∗ 3 ] ; // Ctr l po in t s f o r a l l 3

s p l i n e s

gs l_bspl ine_workspace ∗ a lphaSpl ine , ∗ betaSpl ine , ∗ th e taSp l i n e ;

g s l_vector ∗aVec ,∗ bVec ,∗ cVec ;

double x i ;

double alphaRes [ 3 ] , betaRes [ 3 ] , thetaRes [ 3 ] ;

// Dea l l o ca t e prev ious c on t r o l vec to r f i r s t

c t r lPt sGenera te ( a+zz , num_kin_vals , bounds , a r rCt r lPt s ) ;

bSpl ineGenerate ( nBreak , k , &alphaSpl ine , &aVec , ar rCtr lPts , 10 , 0 , a [ zz ] .

e lements [ num_elements−1]) ;

bSpl ineGenerate ( nBreak , k , &betaSpl ine , &bVec , a r rCt r lPt s +10, 10 , 0 , a [ zz ] .

e lements [ num_elements−1]) ;

141

Page 153: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

bSpl ineGenerate ( nBreak , k , &thetaSp l ine , &cVec , a r rCt r lPt s +20, 10 , 0 , a [ zz ] .

e lements [ num_elements−1]) ;

double con1=0,con2=0,con3=0,pen_cones=0,MMax=1;

//Cone Axes Or i enta t i on (Keep Out Cones )

double beta_S [3 ]= {0 . 5 , pow ( 3 , 0 . 5 ) /2 ,0} ;

double beta_E [3 ]= {0 ,0 ,−1};

double beta_M[3]= {0 . 1795 , 0 . 3 109 , 0 . 9 333} ;

//Cone Angles (Keep Out Cones )

double caS=cos (47∗PI /180) , caE=cos (33∗PI /180) ,caM=cos (23∗PI /180) ;

double dt=a [ zz ] . e lements [ num_elements−1]/( nTSteps−1) ;

f o r ( x i =0; xi<=a [ zz ] . e lements [ num_elements−1] ; x i+=dt )

{

bSpl ineEval ( xi , 2 , alphaRes , a lphaSpl ine , aVec , ar rCtr lPts , 1 0 ) ;

bSpl ineEval ( xi , 2 , betaRes , betaSpl ine , aVec , a r rCt r lPt s +10 ,10) ;

bSpl ineEval ( xi , 2 , thetaRes , the taSp l ine , aVec , a r rCt r lPt s +20 ,10) ;

double sa , ca , sb , cb ;

double lambda1 , lambda2 , lambda3 ;

double lambda1d , lambda2d , lambda3d ;

double lambda1dd , lambda2dd , lambda3dd ;

142

Page 154: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

double st2 , ct2 ;

double e1 , e2 , e3 , e4 ;

double e1d , e2d , e3d , e4d ;

double e1dd , e2dd , e3dd , e4dd ;

double E [ 4 ] [ 4 ] ;

double Ed [ 4 ] [ 4 ] ;

sa = s i n ( alphaRes [ 0 ] ) ;

ca = cos ( alphaRes [ 0 ] ) ;

sb = s i n ( betaRes [ 0 ] ) ;

cb = cos ( betaRes [ 0 ] ) ;

// INVERSION DYNAMICS

lambda1 = cb∗ ca ;

lambda2 = cb∗ sa ;

lambda3 = sb ;

lambda1d = −betaRes [ 1 ] ∗ sb∗ ca − alphaRes [ 1 ] ∗ cb∗ sa ;

lambda2d = − betaRes [ 1 ] ∗ sb∗ sa + alphaRes [ 1 ] ∗ cb∗ ca ;

lambda3d = betaRes [ 1 ] ∗ cb ;

lambda1dd = − betaRes [ 2 ] ∗ sb∗ ca − pow( betaRes [ 1 ] , 2 ) ∗cb∗ ca\

143

Page 155: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

+betaRes [ 1 ] ∗ sb∗alphaRes [ 1 ] ∗ sa + betaRes [ 1 ] ∗ sb∗alphaRes [ 1 ] ∗ sa

\

−alphaRes [ 2 ] ∗ cb∗ sa − pow( alphaRes [ 1 ] , 2 ) ∗cb∗ ca ;

lambda2dd = − betaRes [ 2 ] ∗ sb∗ sa − pow( betaRes [ 1 ] , 2 ) ∗cb∗ sa \

−betaRes [ 1 ] ∗ sb∗alphaRes [ 1 ] ∗ ca − betaRes [ 1 ] ∗ sb∗alphaRes [ 1 ] ∗ ca

\

+alphaRes [ 2 ] ∗ cb∗ ca − pow( alphaRes [ 1 ] , 2 ) ∗ sa ∗cb ;

lambda3dd = betaRes [ 2 ] ∗ cb − pow( betaRes [ 1 ] , 2 ) ∗ sb ;

s t2 = s i n ( thetaRes [ 0 ] / 2 ) ;

ct2 = cos ( thetaRes [ 0 ] / 2 ) ;

e1 = lambda1 ∗ s t2 ;

e2 = lambda2 ∗ s t2 ;

e3 = lambda3 ∗ s t2 ;

e4 = ct2 ;

e1d = lambda1d ∗ s t2 + thetaRes [ 1 ] / 2∗ lambda1∗ ct2 ;

e2d = lambda2d ∗ s t2 + thetaRes [ 1 ] / 2∗ lambda2∗ ct2 ;

e3d = lambda3d ∗ s t2 + thetaRes [ 1 ] / 2∗ lambda3∗ ct2 ;

e4d = −thetaRes [ 1 ] / 2∗ s t2 ;

e1dd = lambda1dd ∗ s t2 + thetaRes [ 2 ] / 2∗ lambda1∗ ct2

+ 2∗ lambda1d∗ thetaRes [ 1 ] / 2∗ ct2−pow( ( thetaRes [ 1 ] / 2 ) ,2 ) ∗ lambda1∗ s t2

144

Page 156: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

;

e2dd = lambda2dd ∗ s t2 + thetaRes [ 2 ] / 2∗ lambda2∗ ct2 \

+ 2∗ lambda2d∗ thetaRes [ 1 ] / 2∗ ct2−pow( ( thetaRes [ 1 ] / 2 ) ,2 ) ∗ lambda2∗ s t2

;

e3dd = lambda3dd ∗ s t2 + thetaRes [ 2 ] / 2∗ lambda3∗ ct2 \

+ 2∗ lambda3d∗ thetaRes [ 1 ] / 2∗ ct2−pow( ( thetaRes [ 1 ] / 2 ) ,2 ) ∗ lambda3∗ s t2

;

e4dd = −thetaRes [ 2 ] / 2∗ s t2 − pow( ( thetaRes [ 1 ] / 2 ) ,2 ) ∗ ct2 ;

E [ 0 ] [ 0 ] = e4 ;

E [ 0 ] [ 1 ] = e3 ;

E [ 0 ] [ 2 ] = −e2 ;

E [ 0 ] [ 3 ] = −e1 ;

E [ 1 ] [ 0 ] = −e3 ;

E [ 1 ] [ 1 ] = e4 ;

E [ 1 ] [ 2 ] = e1 ;

E [ 1 ] [ 3 ] = −e2 ;

E [ 2 ] [ 0 ] = e2 ;

E [ 2 ] [ 1 ] = −e1 ;

E [ 2 ] [ 2 ] = e4 ;

145

Page 157: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

E [ 2 ] [ 3 ] = −e3 ;

E [ 3 ] [ 0 ] = e1 ;

E [ 3 ] [ 1 ] = e2 ;

E [ 3 ] [ 2 ] = e3 ;

E [ 3 ] [ 3 ] = e4 ;

double ed [ ] = {e1d , e2d , e3d , e4d } ;

Ed [ 0 ] [ 0 ] = e4d ;

Ed [ 0 ] [ 1 ] = e3d ;

Ed [ 0 ] [ 2 ] = −e2d ;

Ed [ 0 ] [ 3 ] = −e1d ;

Ed [ 1 ] [ 0 ] = −e3d ;

Ed [ 1 ] [ 1 ] = e4d ;

Ed [ 1 ] [ 2 ] = e1d ;

Ed [ 1 ] [ 3 ] = −e2d ;

Ed [ 2 ] [ 0 ] = e2d ;

Ed [ 2 ] [ 1 ] = −e1d ;

Ed [ 2 ] [ 2 ] = e4d ;

Ed [ 2 ] [ 3 ] = −e3d ;

146

Page 158: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

Ed [ 3 ] [ 0 ] = e1d ;

Ed [ 3 ] [ 1 ] = e2d ;

Ed [ 3 ] [ 2 ] = e3d ;

Ed [ 3 ] [ 3 ] = e4d ;

double edd [ ] = {e1dd , e2dd , e3dd , e4dd } ;

double w[4 ]= {0 ,0 , 0 , 0} ;

f o r ( i n t i i =0; i i <4; i i ++)

{

f o r ( i n t j j =0; j j <4; j j++)

{

w[ i i ]+=( E[ i i ] [ j j ]∗ ed [ j j ] ) ;

}

w[ i i ]∗=2;

}

double wd[4 ]= {0 , 0 , 0 , 0} ;

f o r ( i n t i i =0; i i <4; i i ++)

{

f o r ( i n t j j =0; j j <4; j j++)

{

wd [ i i ]=wd [ i i ]+2∗( Ed [ i i ] [ j j ]∗ ed [ j j ] ) +2∗E[ i i ] [ j j ]∗ edd [ j j ] ;

147

Page 159: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

}

}

double M1= I1 ∗ wd [ 0 ] + w[ 1 ] ∗ w[ 2 ] ∗ ( I3−I2 ) ;

double M2= I2 ∗ wd [ 1 ] + w[ 2 ] ∗ w[ 0 ] ∗ ( I1−I3 ) ;

double M3= I3 ∗ wd [ 2 ] + w[ 0 ] ∗ w[ 1 ] ∗ ( I2−I1 ) ;

con1 = con1 + fmax (0 , f abs (M1)−MMax) ;

con2 = con2 + fmax (0 , f abs (M2)−MMax) ;

con3 = con3 + fmax (0 , f abs (M3)−MMax) ;

double sigma [3 ]= {1−2∗(pow( e2 , 2 ) + pow( e3 , 2 ) ) , 2∗( e1∗ e2 + e3∗ e4 ) , 2∗(

e3∗ e1 − e2∗ e4 ) } ;

double c_S = sigma [ 0 ] ∗ beta_S [0 ]+ sigma [ 1 ] ∗ beta_S [1 ]+ sigma [ 2 ] ∗ beta_S [ 2 ] ;

double c_E = sigma [ 0 ] ∗ beta_E [0]+ sigma [ 1 ] ∗ beta_E [1]+ sigma [ 2 ] ∗ beta_E [ 2 ] ;

double c_M = sigma [ 0 ] ∗ beta_M[0]+ sigma [ 1 ] ∗ beta_M[1]+ sigma [ 2 ] ∗ beta_M [ 2 ] ;

pen_cones = pen_cones + fmax (0 , c_S−caS ) + fmax (0 ,c_E−caE ) + fmax (0 ,c_M−

caM) ;

}

double J_const ra int s = k1 ∗( con1 + con2 + con3 )+ k_cones∗pen_cones ;

double J_time = k3∗ f abs ( a [ zz ] . e lements [ num_elements−1]) ;

148

Page 160: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

// PENALTY FUNCTION

a [ zz ] . J = J_const ra int s + J_time ;

// Memory Dea l l o ca t e

g s l_bsp l i n e_f r e e ( a lphaSp l ine ) ;

g s l_bsp l i n e_f r e e ( be taSp l ine ) ;

g s l_bsp l i n e_f r e e ( the taSp l i n e ) ;

g s l_vector_f ree ( aVec ) ;

g s l_vector_f ree ( bVec ) ;

g s l_vector_f ree ( cVec ) ;

d e l e t e [ ] a r rCt r lPt s ;

}

}

void bSpl ineGenerate ( i n t nBreak , i n t k , gs l_bspl ine_workspace ∗∗bw, gs l_vector ∗∗B,

double ∗ c t r lP t s , i n t nCtrlPts , double lBound , double uBound)

{

}

void bSpl ineEval ( double x , i n t nDeriv , double ∗ r e su l t , gs l_bspl ine_workspace ∗bw,

gs l_vector ∗B, double ∗ c t r lP t s , i n t nCtr lPts )

{

149

Page 161: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

i n t i , j ;

gs l_matrix ∗X = gsl_matr ix_al loc ( nCtrlPts , nDeriv+1) ;

//Zero a l l va lue s o f r e s u l t . Length o f r e s u l t = Order o f d e r i v a t e s + 1 f o r eva l

o f s p l i n e

f o r ( i =0; i<nDeriv+1; i++)

{

r e s u l t [ i ]=0;

}

gs l_bsp l ine_eva l (x ,B,bw) ;

//Evaluate b−s p l i n e at x

f o r ( i =0; i<nCtr lPts ; i++)

{

r e s u l t [0]+= c t r lP t s [ i ]∗ gs l_vector_get (B, i ) ;

}

//Evaluate d e r i v a t e s

gs l_bsp l ine_der iv_eva l (x , nDeriv ,X,bw) ;

f o r ( i =1; i<nDeriv+1; i++)

{

f o r ( j =0; j<nCtr lPts ; j++)

150

Page 162: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

{

r e s u l t [ i ]+=c t r lP t s [ j ]∗ gsl_matrix_get (X, j , i ) ;

}

}

gs l_matr ix_free (X) ;

}

151

Page 163: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

References

[1] Bedrossian, N., S. Bhatt, M. Lammers, L. Nguyen, and Y. Zhang (2007) “First everflight demonstration of zero propellant manueverTM attitude control concept,” in Guidance,Navigation, and Control Conference, vol. AIAA-2007-6734,(Hilton Head, South Carolina), pp.1–12.

[2] Karpenko, M., S. Bhatt, N. Bedrossian, A. Fleming, and I. Ross (2012) “First flightresults on time-optimal spacecraft slews,” Journal of Guidance, Control, and Dynamics, 35(2),pp. 367–376.

[3] Aeronautics, N. and S. Administration (1998-2010), “TRACE,” .URL http://www.swift.gsfc.nasa.gov

[4] Center, G. S. F. (2004-2016), “The Swift Gamma-Ray Burst Mission,” .URL http://www.swift.gsfc.nasa.gov

[5] Basu, K. and R. G. Melton (2015) “Survey of Optimal Rigid Body Attitude Maneuvers,”Advances in the Astronautical Sciences, 411, pp. 1–11.

[6] Scrivener, S. L. and R. C. Thompson (1994) “Survey of time-optimal attitude maneuvers,”Journal of Guidance, Control, and Dynamics, 17(2), pp. 225–233.

[7] Dixon, M., T. Edelbaum, J. Potter, and W. Vandervelde (1970) “Fuel optimalreorientation of axisymmetric spacecraft,” Journal of Spacecraft and Rockets, 7(11), pp. 1345–1351.

[8] D’Amario, L. and G. Stubbs (1979) “A New Single-Rotation-Axis Autopilot for RapidSpacecraft Attitude Maneuvers,” Journal of Guidance and Control, 2(4), pp. 339–346.

[9] Bilimoria, K. D. and B. Wie (1993) “Time-Optimal Three-Axis Reorientation of a RigidSpacecraft,” Journal of Guidance, Control, and Dynamics, 16(3), pp. 446–452.

[10] Seywald, H. and R. R. Kumar (1993) “Singular control in minimum time spacecraftreorientation,” Journal of Guidance, Control, and Dynamics, 16(4), pp. 686–694.

[11] Byers, R. M. (1995) “On singular controls in time optimal rigid body reorientation,” Advancesin the Astronautical Sciences, 89, pp. 603 – 603.

[12] Byers, R. (1996) “Time Optimal Attitude Control of Asymmetric Rigid Spacecraft,” Journalof Vibration and Control, 2(1), pp. 17–32.

[13] Shen, H. and P. Tsiotras (1999) “Time-optimal control of axisymmetric rigid spacecraftusing two controls,” Journal of Guidance, Control, and Dynamics, 22(5), pp. 682–694.

152

Page 164: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

[14] Tsiotras, P. and J. M. Longuski (1995) “New parameterization of the attitude kinematics,”Journal of the Astronautical Sciences, 43(3), pp. 243 – 262.

[15] Bai, X. and J. L. Junkins (2009) “New results for time-optimal three-axis reorientation of arigid spacecraft,” Journal of Guidance, Control, and Dynamics, 32(4), pp. 1071–1076.

[16] Molodenkov, A. and Y. G. Sapunkov (2012) “A new class of analytic solutions in theoptimal turn problem for a spherically symmetric body,” Mechanics of Solids, 47(2), pp.167–177.

[17] Li, S., S. Ding, and Q. Li (2010) “Global set stabilization of the spacecraft attitude controlproblem based on quaternion,” International Journal of Robust and Nonlinear Control, 20(1),pp. 84–105.

[18] Crassidis, J. L. and F. L. Markley (1996) “Sliding mode control using modified Rodriguesparameters,” Journal of Guidance, Control, and Dynamics, 19(6), pp. 1381–1383.

[19] Crassidis, J. L., F. L. Markley, T. C. Anthony, and S. F. Andrews (1997) “Nonlinearpredictive control of spacecraft,” Journal of Guidance, Control, and Dynamics, 20(6), pp.1096–1103.

[20] Sharma, R. and A. Tewari (2004) “Optimal nonlinear tracking of spacecraft attitudemaneuvers,” Control Systems Technology, IEEE Transactions on, 12(5), pp. 677–682.

[21] Kim, K.-S. and Y. Kim (2003) “Robust backstepping control for slew maneuver using nonlineartracking function,” Control Systems Technology, IEEE Transactions on, 11(6), pp. 822–829.

[22] Krstic, M. and P. Tsiotras (1999) “Inverse optimal stabilization of a rigid spacecraft,”Automatic Control, IEEE Transactions on, 44(5), pp. 1042–1049.

[23] Ioslovich, I. (2003) “Arbitrary fuel-optimal attitude maneuvering of a non-symmetric spacevehicle in a vehicle-fixed coordinate frame,” Automatica, 39(3), pp. 557–562.

[24] Ioslovich, I., M. Borshchevsky, and P.-O. Gutman (2009) “Long time missions and thefuel-optimal attitude maneuvering in a swinging mode,” Mathematical Programming, 120(1),pp. 49–66.

[25] Liu, S.-W. and T. Singh (1997) “Fuel/time optimal control of spacecraft maneuvers,” Journalof Guidance, Control, and Dynamics, 20(2), pp. 394–397.

[26] Spindler, K. (1996) “Optimal attitude control of a rigid body,” Applied Mathematics andOptimization, 34(1), pp. 79–90.

[27] Biggs, J. D. and N. Horri (2012) “Optimal geometric motion planning for a spin-stabilizedspacecraft,” Systems & Control Letters, 61(4), pp. 609–616.

153

Page 165: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

[28] Tewari, A. (2002) “Optimal nonlinear spacecraft attitude control through Hamilton-Jacobiformulation,” The Journal of the Astronautical Sciences, 50(1), pp. 99–112.

[29] Tsiotras, P. (1997) “Optimal Regulation and Passivity Results for Axisymmetric RigidBodies Using Two Controls,” Journal of Guidance, Control, and Dynamics, 20(3), pp. 457–463.

[30] Mazenc, F. and M. R. Akella (2014) “Quaternion-based stabilization of attitude dynamicssubject to pointwise delay in the input,” in Proceedings of the American Control Conference,pp. 4877 – 4882.

[31] Bryson, A. E. and Y.-C. Ho (1975) Applied Optimal Control: Optimization, Estimation andControl, Hemisphere Publishing Corp., New York, pp. 100-119.

[32] Hablani, H. B. (1999) “Attitude commands avoiding bright objects and maintaining com-munication with ground station,” Journal of Guidance, Control, and Dynamics, 22(6), pp.759–767.

[33] Spindler, K. (2002) “Attitude maneuvers which avoid a forbidden direction,” Journal ofDynamical and Control Systems, 8(1), pp. 1–22.

[34] Mengali, G. and A. A. Quarta (2004) “Spacecraft control with constrained fast reorientationand accurate pointing,” Aeronautical Journal, 108(1080), pp. 85–91.

[35] Melton, R. G. (2010) “Constrained Time-Optimal Slewing Maneuvers for Rigid Spacecraft,”Advances in the Astronautical Sciences, 135, pp. 107–126.

[36] Melton, R. (2010) “Boundary Points and Arcs in Constrained, Time-Optimal SatelliteReorientation Maneuvers,” in AIAA/AAS Astrodynamics Specialist Conference, AIAA, paperAIAA 2010-8376.

[37] Tanygin, S. (2014) “Three-Axis Constrained Attitude Pathfinding and Visualization: Chartinga Course on Higher-Dimensional Maps,” in AIAA/AAS Astrodynamics Specialist Conference,AIAA/AAS, paper AIAA 2014-4101.

[38] Weiss, A., F. Leve, M. Baldwin, J. R. Forbes, and I. Kolmanovsky (2014) “Spacecraftconstrained attitude control using positively invariant constraint admissible sets on SO (3)×R3,”in American Control Conference (ACC), 2014, IEEE, pp. 4955–4960.

[39] Enright, P. J. and B. A. Conway (1991) “Optimal Finite-Thrust Spacecraft TrajectoriesUsing Collocation and Nonlinear Programming,” Journal of Guidance, Control, and Dynamics,14(5), pp. 981–985.

[40] Scrivener, S. L. and R. C. Thompson (1994) “Time-Optimal Reorientation of a RigidSpacecraft Using Collocation and Nonlinear Programming,” Advances in the AstronauticalSciences, 85, pp. 1905–1924.

154

Page 166: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

[41] Fahroo, F. and I. M. Ross (2002) “Direct Trajectory Optimization by a Chebyshev Pseu-dospectral Method,” Journal of Guidance, Control, and Dynamics, 25(1), pp. 160–166.

[42] Ross, I. M. (2007) A Beginner’s Guide to DIDO: A MATLAB Application Package for SolvingOptimal Control Problems, Elissar Global, Carmel, CA, rept. TR-711.

[43] Becerra, V. M. (2011) PSOPT: Optimal Control Solver User Manual, http://www.psopt.org.

[44] Patterson, M. A. and A. V. Rao (2014) GPOPS-II, Ver. 2.0, A General-Purpose MATLABSoftware for Solving Multiple-Phase Optimal Control Problems, http://www.gpops2.com.

[45] Caubet, A. and J. D. Biggs (2013) “Optimal Attitude Motion Planner for Large Slew Ma-neuvers Using a Shape-Based Method,” in AIAA Guidance, Navigation and Control Conference.

[46] Shang, M., T. Zhang, and J. Song (2013) “Optimal torque control constraint rigid spacecraftattitude maneuver with constraints,” in Control and Decision Conference (CCDC), 2013 25thChinese, IEEE, pp. 363–367.

[47] Proulx, R. J. and I. M. Ross (2002) “Time-Optimal Reorientation of Asymmetric RigidBodies,” Advances in the Astronautical Sciences, 109, part II, pp. 1207–1227.

[48] Melton, R. G. (2014) “Hybrid methods for determining time-optimal, constrained spacecraftreorientation maneuvers,” Acta Astronautica, 94(1), pp. 294–301.

[49] Zhuang, Y. and H. Huang (2014) “Time-optimal trajectory planning for underactuatedspacecraft using a hybrid particle swarm optimization algorithm,” Acta Astronautica, 94(2), pp.690 – 698.URL http://dx.doi.org/10.1016/j.actaastro.2013.06.023

[50] Fleming, A., P. Sekhavat, and I. M. Ross (2010) “Minimum-time reorientation of a rigidbody,” Journal of Guidance, Control, and Dynamics, 33(1), pp. 160–170.

[51] Karpenko, M., S. Bhatt, N. Bedrossian, and I. M. Ross (2014) “Flight Implementation ofShortest-Time Maneuvers for Imaging Satellites,” Journal of Guidance, Control, and Dynamics,pp. 1–11.

[52] Kane, T. R., P. W. Likins, and D. A. Levinson (1983) Spacecraft Dynamics, McGraw-Hill,New York, ch. 1.

[53] Wertz, J. R. (ed.) (1978) Spacecraft Attitude Determination and Control, Kluwer AcademicPublishers, Dordrecht, The Netherlands, app. D.

[54] Markley, F. (2008) “Unit quaternion from rotation matrix,” Journal of Guidance, Control,and Dynamics, 31(2), pp. 440 – 442.

[55] Wie, B. (1998) Space Vehicle Dynamics and Control, American Institute of Aeronautics andAstronautics, ch. 5.

155

Page 167: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

[56] Schaub, H. and J. L. Junkins (2009) Analytical Mechanics for Spacecraft Systems, 2nd ed.,American Institute of Aerosnautics and Astronautics, Reston, VA, ch. 3.

[57] Sanyal, A., A. Fosbury, N. Chaturvedi, and D. S. Bernstein (2009) “Inertia-freespacecraft attitude trajectory tracking with internal-model-based disturbance rejection andalmost global stabilization,” in American Control Conference, 2009. ACC’09., IEEE, pp. 4830–4835.

[58] Lee, T., M. Leok, and N. H. McClamroch (2008) “Time optimal attitude control for arigid body,” in American Control Conference, 2008, IEEE, pp. 5210–5215.

[59] Bloch, A. M., I. I. Hussein, M. Leok, and A. K. Sanyal (2009) “Geometric structure-preserving optimal control of a rigid body,” Journal of Dynamical and Control Systems, 15(3),pp. 307–330.

[60] Schaub, H., J. Junkins, and R. Robinett (1997) “New Penalty Functions and OptimalControl Formulation for Spacecraft Attitude Control Problems,” Journal of Guidance, Control,and Dynamics, 20(3), pp. 428 – 434.

[61] Pontani, M. and B. A. Conway (2010) “Particle Swarm Optimization Applied to SpaceTrajectories,” Journal of Guidance, Control, and Dynamics, 33, pp. 1429 – 1441.

[62] Kennedy, J. and R. Eberhart (1995) “Particle Swarm Optimization,” in Proceedings ofICNN’95 - International Conference on Neural Networks, vol. 4, pp. 1942 – 1948.

[63] Shene, D. C.-K. (1997-2004), “CS3621 Introduction to Computing with Geometry Notes,” .URL http://www.cs.mtu.edu/ shene/COURSES/cs3621/NOTES/

[64] Basu, K. and R. G. Melton (2015) “Time-Optimal Reorientation via Inverse Dynamics: AQuaternion and Particle Swarm Formulation,” Advances in the Astronautical Sciences, 762, pp.1–14.

[65] Spiller, D., L. Ansalone, and F. Curti (2015) “Particle Swarm Optimization for Time-Optimal Spacecraft Reorientation with Keep-Out Cones,” Journal of Guidance, Control, andDynamics, 39(2), pp. 312–325.

[66] Ross, I. M. (2004) “User manual for DIDO: A MATLAB application package for solvingoptimal control problems,” Tomlab Optimization, Sweden.

[67] Basu, K., R. G. Melton, and S. Aguasvivas-Manzano (2017) “Time-Optimal Reorienta-tion using Neural Network and Particle Swarm Formulation,” Advances in the AstronauticalSciences, 816, pp. 1–20.

156

Page 168: RIGID BODY SATELLITE TIME-OPTIMAL ATTITUDE CONTROL …

VitaKaushik Basu

EDUCATIONBA/MA Mathematics, West Chester University of Pennsylvania 2009ME Aerospace Engineering, Pennsylvania State University 2010Teaching Certificate, Pennsylvania State University 2016

PUBLICATIONS AND TECHNICAL PRESENTATIONSBasu,K.(FA), Fisher,Z., Bresler,J., Bender,B., Cowan,S., Young,L., and Newhart,T. A New

Beginning: Human Class Mars EDL; RASCAL-NIANET 2015 Forum @NASA/KSC, June 15-17,2015

Paik,G. and Basu,K. Thermal Modelling of Avionics Vault on Jupiter Orbiter ; TWAS 2015(Thermal and Fluids Analysis Workshop) @NASA/GSFC, August 3-7, 2015

Basu,K. and Melton,R.G. Survey of Optimal Rigid-Body Attitude Maneuvers; AAS/AIAA 15-411@ Williamsburg, Virginia. January 11-15, 2015

Basu,K. and Melton,R.G. Time-Optimal Reorientation via Inverse Dynamics: A Quaternionand Particle Swarm Formulaton; AAS/AIAA 15-762 @ Vail, Colorado, August 9-13, 2015

Marcucci,E.C., Hays,L., Holstein-Rathlou,C., Keane,J.T., Becerra,P., Basu,K. Davis,B., Fox,V.,Herman,J., Hughes,A., Mendez Ramos,E., Nelessen,A., Neveu,M., Parrish,N., Scheinberg,A., Wro-bel,J.S. Argus: An Io observer mission concept study from the 2014 NASA/JPL Planetary ScienceSummer School; LPI 2015(Lunar Planetary Institute) @The Woodlands, Texas. March 16-20.

Basu,K., Shaw,M. and Melton,R.G. Satellite Attitude Control Technology; DST 2017 (Directorateof Science and Technology) Summer Symposium @ CIA/Langley, Virginia June 5-6, 2017

Spiller,D. and Basu,K. Optimal Passive Formation Reconfiguration using Attitude Control andPerturbing Forces; IWSCFF 17-37 (International Workshop on Satellite Constellations and FormationFlying) @ UC Boulder, Colorado. June 21-24, 2017

Basu,K., Melton,R.G. and Aguasvivas-Manzano,S. Time-Optimal Reorientation using NeuralNetwork and Particle Swarm Formulation; AAS/AIAA 17-816 @ Stevenson, Washington August21-24, 2017

Spiller.D, and Basu,K. On the Optimal Passive Formation Reconfiguration by using AttitudeControl; Journal Acta Astronautica @ AA-2017-1167,Elsevier Dec, 2017