FlightSims.BehaviouralCloning
— TypeSupervised-learning-based imitation learning algorithm of deterministic policies.
FlightSims.CTLinearIRL
— TypeRefs
[1] F. L. Lewis, D. Vrabie, and K. Vamvoudakis, "Reinforcement Learning and Feedback Control: Using Natural Decision Mehods to Design Optimal Adaptive Controllers," IEEE Control Systems, vol. 32, no. 6, pp.76-105, 2012.
Variables
V̂ ∈ R: the estimate of (state) value function - V̂.basis: Φ - V̂.param: w
FlightSims.CTLinearIRL
— Typed: polynomial degree
FlightSims.CTValueIterationADP
— TypeRefs
[1] T. Bian and Z.-P. Jiang, “Value Iteration, Adaptive Dynamic Programming, and Optimal Control of Nonlinear Systems,” in 2016 IEEE 55th Conference on Decision and Control (CDC), Las Vegas, NV, USA, Dec. 2016, pp. 3375–3380. doi: 10.1109/CDC.2016.7798777. [2] Forked repo of the code implementation by T. Bian, https://github.com/JinraeKim/nonlinear-VI/blob/main/nonlinear_sys.R
Variables
V̂ ∈ R: the estimate of (state) value function - V̂.basis: Φ - V̂.param: w dV̂ ∈ R: the estimate of time derivative of (state) value function - dV̂.basis: Ψ - V̂.param: c (BE CAREFUL; not used)
FlightSims.CTValueIterationADP
— Typen: state dim. m: input dim. d: polynomial degree
FlightSims.GoodarziQuadcopterEnv
— TypeReferences
[1] F. A. Goodarzi, D. Lee, and T. Lee, “Geometric stabilization of a quadrotor UAV with a payload connected by flexible cable,” in 2014 American Control Conference, Jun. 2014, pp. 4925–4930, doi: 10.1109/ACC.2014.6859419.
Variables
p ∈ R^3: inertial position v ∈ R^3: inertial velocity R ∈ so(3): inertial-to-body rotation matrix (R_I2B) ω ∈ R^3: angular rate of body in inertial frame u ∈ R^4: [f, M...] where f ∈ R: total thrust, M ∈ R^3: moment
FlightSims.HelixCommandGenerator
— TypeVariables
pos0 ∈ R^3: initial position dir ∈ S^2 (sphere): a unit vector dir_perp ∈ S^2 (sphere): a unit vector perp. to dir
r > 0: radius ω: angular rate θ: phase c: coefficient for forward direction
Notes
The basis vectors of the plane perpendicular to the dir
is determined by a keyword argument dir_ref=[0, 0, 1]
. For more details, see the source code.
FlightSims.IslamQuadcopterEnv
— TypeReferences
[1] M. Islam, M. Okasha, and M. M. Idres, “Dynamics and control of quadcopter using linear model predictive control approach,” IOP Conf. Ser.: Mater. Sci. Eng., vol. 270, p. 012007, Dec. 2017, doi: 10.1088/1757-899X/270/1/012007.
Variables
u ∈ R^4: square of rotor angular speed
FlightSims.LQR
— TypeInfinite-horizon continuous-time linear quadratic regulator (LQR).
FlightSims.LeeHexacopterEnv
— TypeNotes
- [1] is modified for hexa-x configuration; see [2].
References
[1] T. Lee, M. Leok, and N. H. McClamroch, “Geometric Tracking Control of a Quadrotor UAV on SE(3),” in 49th IEEE Conference on Decision and Control (CDC), Atlanta, GA, Dec. 2010, pp. 5420–5425. doi: 10.1109/CDC.2010.5717652. [2] PX4 Airframes Reference, https://docs.px4.io/master/en/airframes/airframe_reference.html.
Variables
u ∈ R^6: rotor forces
FlightSims.LinearApproximator
— Typen: input dimension d: polynomial degree m: output dimension
FlightSims.PID
— TypeProportional-integral-derivative (PID) controller.
Notes
The derivative term is obtained via second-order filter. For more details, see [1] and singular perturbation theory.
References
[1] J. A. Farrell, M. Polycarpou, M. Sharma, and W. Dong, “Command Filtered Backstepping,” IEEE Transactions on Automatic Control, vol. 54, no. 6, pp. 1391–1395, Jun. 2009, doi: 10.1109/TAC.2009.2015562.
FlightSims.PolynomialBasis
— MethodNotes
with_bias=true
provides polynomials with the degree of from 0 to d
.
with_bias=false
provides polynomials with the degree of d
.
Variables
n ∈ N: length of array, i.e., x ∈ Rⁿ d ∈ N: degree
FlightSims.PowerLoop
— TypeRefs.
[1] E. Kaufmann, A. Loquercio, R. Ranftl, M. Müller, V. Koltun, and D. Scaramuzza, “Deep Drone Acrobatics,” arXiv:2006.05768 [cs], Jun. 2020, Accessed: Jun. 02, 2021. [Online]. Available: http://arxiv.org/abs/2006.05768
Variables
d ∈ R^3: displacement r ∈ R^+: radius
Notes
units: [m], [s]
FlightSims.PseudoInverseAllocator
— TypeMoore-Penrose inverse control allocator.
FlightSims.PseudoInverseAllocator
— TypeVariables
ν: virtual input
Notes
ν = B*u where u: control input
FlightSims.ReferenceModelEnv
— TypeReferences
- Reference model (e.g., xd, vd, ad, addot, adddot)
[1] S. J. Su, Y. Y. Zhu, H. R. Wang, and C. Yun, “A Method to Construct a Reference Model for Model Reference Adaptive Control,” Adv. Mech. Eng., vol. 11, no. 11, pp. 1–9, 2019.
Notes
d: degree of the reference model autodiff: autodiff = true for tracking time-varying command; otherwise for set-point regulation xcmdfunc(t): function of time
FlightSims.ApproximateOptimalInput
— MethodInfer the approximate optimal input.
FlightSims.Command
— MethodNotes
NED coordinate system.
- go straight
norm(v0)(t-t0) + 0.5a*(t-t0)^2 = norm(Δp)
- loop
rθ = V(t-t0-tgostraight)
FlightSims.Dynamics!
— MethodNotes
running_cost: integrand; function of (x, u)
FlightSims.LinearSystem_IntegratorEnv
— MethodLinearSystemEnv + IntegratorEnv
FlightSims.OptimalController
— MethodMinimise J = ∫ (x' Q x + u' R u) from 0 to ∞
FlightSims.State
— MethodEven for scalar integrator, you should put an array of length 1; due to the limitation of in-place method Dynamics!
.
FlightSims.State
— MethodNotes
r
denotes integrand ofinteg
.
FlightSims.State
— MethodCommon state structure of MulticopterEnv
FlightSims.State
— Method∫e: integral of the error ê: the estimate of the error ė̂: the estimate of the error rate
FlightSims.State
— Methodx_i
denotes i
th (time) derivative of x
FlightSims.__Dynamics!
— MethodVariables
State
p ∈ R^3: (inertial) position v ∈ R^3: (inertial) velocity R ∈ so(3): rotation matrix of body frame w.r.t. inertial frame (I to B) ω ∈ R^3: angular rate of body frame w.r.t. inertial frame (I to B)
(Virtual) input
f ∈ R: total thrust M ∈ R^3: moment
FlightSims._namedtuple
— MethodExtended to deal with empty Dict.
FlightSims.approximate_optimal_input
— MethodInfer the approximate optimal input.
FlightSims.circle_shape
— Methodc: centre r: radius h: direction of normal vector
FlightSims.input_to_force_moment
— MethodCommon input to force and moment transformation (default: not applied)
FlightSims.maybe_apply
— MethodNotes
- The basic concept is borrowed from an MRAC example.
- It is modified to be compatible with SimulationLogger.jl.
Limitations
- Conditional method definition is troublesome; see #16.
Instead of it, I decided to merely define a new method with argument __log_indicator__::__LOG_INDICATOR__
, which will provide "empty Dict" in the case of no logging.
FlightSims.min_Ĥ
— MethodMinimise approximate Hamiltonian.
FlightSims.partitionTrainTest
— FunctionpartitionTrainTest(data, at)
Split a dataset into train and test datasets (array).
FlightSims.saturate
— MethodCommon input saturation (default: not applied)
FlightSims.set_data!
— MethodNotes
adp.data contains M+1 data j = 0, 1, ..., M-1
FlightSims.sim
— FunctionNotes
- Currently, only iip (isinplace) method is supported.
Keyword arguments
Tips
- progress (kwarg): if true, it shows the progress bar (in Juno IDE or supports by TerminalLoggers.jl).
FlightSims.update!
— Methods: states (minibatch) ∈ R^nxN a: actions (minibatch) ∈ R^mxN
Examples
for batch in bc.dataloader FlightSims.update!(bc, batch...) end
RecipesBase.plot!
— Methodrender!(multicopter::MulticopterEnv, fig, state)
Variables
fig: figure object, i.e., fig = plot() state: see State(env::MulticopterEnv)
.
Notes
Default configuration: ENU-coordinate system. For airframe references, see https://docs.px4.io/master/en/airframes/airframe_reference.html.