Skip to content

Commit

Permalink
add control-design tutorial (#114)
Browse files Browse the repository at this point in the history
* add control-design tutorial

* add WIP linearization to quadrotor

* add swingup

improve energy formulation

* add lqr to quad

rename subsys

remove broken example

* add LQR example to quadrotor

* avoid singularity in linearization

* up tutorial

* compute fewer senstivity functions (compile time is very high)

* up docs manifest

* improve state selection

* tweak initial operating point

* disable part of tutorial waiting for fix in JSC
  • Loading branch information
baggepinnen authored Sep 26, 2024
1 parent 1fac8e3 commit a635266
Show file tree
Hide file tree
Showing 8 changed files with 618 additions and 80 deletions.
140 changes: 126 additions & 14 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

julia_version = "1.10.5"
manifest_format = "2.0"
project_hash = "06f3e6980a6e6c68713c93d9095c9cb5de3db7cf"
project_hash = "08003e42b5c1441ed313cb0f744985213930fbba"

[[deps.ADTypes]]
git-tree-sha1 = "5a5eafb8344b81b8c2237f8a6f6b3602b3f6180e"
git-tree-sha1 = "eea5d80188827b35333801ef97a40c2ed653b081"
uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
version = "1.8.1"
version = "1.9.0"
weakdeps = ["ChainRulesCore", "EnzymeCore"]

[deps.ADTypes.extensions]
Expand Down Expand Up @@ -331,6 +331,36 @@ deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.1.1+0"

[[deps.ComponentArrays]]
deps = ["ArrayInterface", "ChainRulesCore", "ForwardDiff", "Functors", "LinearAlgebra", "PackageExtensionCompat", "StaticArrayInterface", "StaticArraysCore"]
git-tree-sha1 = "bc391f0c19fa242fb6f71794b949e256cfa3772c"
uuid = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
version = "0.15.17"

[deps.ComponentArrays.extensions]
ComponentArraysAdaptExt = "Adapt"
ComponentArraysConstructionBaseExt = "ConstructionBase"
ComponentArraysGPUArraysExt = "GPUArrays"
ComponentArraysOptimisersExt = "Optimisers"
ComponentArraysRecursiveArrayToolsExt = "RecursiveArrayTools"
ComponentArraysReverseDiffExt = "ReverseDiff"
ComponentArraysSciMLBaseExt = "SciMLBase"
ComponentArraysTrackerExt = "Tracker"
ComponentArraysTruncatedStacktracesExt = "TruncatedStacktraces"
ComponentArraysZygoteExt = "Zygote"

[deps.ComponentArrays.weakdeps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[[deps.CompositeTypes]]
git-tree-sha1 = "bce26c3dab336582805503bed209faab1c279768"
uuid = "b152e2b5-7a66-4b01-a709-34e65c35f657"
Expand Down Expand Up @@ -372,6 +402,25 @@ git-tree-sha1 = "439e35b0b36e2e5881738abc8857bd92ad6ff9a8"
uuid = "d38c429a-6771-53c6-b99e-75d170b6e991"
version = "0.6.3"

[[deps.ControlSystemsBase]]
deps = ["DSP", "ForwardDiff", "IterTools", "LaTeXStrings", "LinearAlgebra", "MacroTools", "MatrixEquations", "MatrixPencils", "Polyester", "Polynomials", "PrecompileTools", "Printf", "Random", "RecipesBase", "SparseArrays", "StaticArraysCore", "UUIDs"]
git-tree-sha1 = "163d11b7aee72d66c3e2e91f2aa48bb709f8439f"
uuid = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
version = "1.10.3"

[deps.ControlSystemsBase.extensions]
ControlSystemsBaseImplicitDifferentiationExt = ["ImplicitDifferentiation", "ComponentArrays"]

[deps.ControlSystemsBase.weakdeps]
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
ImplicitDifferentiation = "57b37032-215b-411a-8a7c-41a003a55207"

[[deps.ControlSystemsMTK]]
deps = ["ControlSystemsBase", "DataInterpolations", "LinearAlgebra", "ModelingToolkit", "ModelingToolkitStandardLibrary", "MonteCarloMeasurements", "RobustAndOptimalControl", "Symbolics", "UnPack"]
git-tree-sha1 = "0a2169c781c3aadca3e38c424401f9b838c778c7"
uuid = "687d7614-c7e5-45fc-bfc3-9ee385575c88"
version = "2.2.1"

[[deps.CoordinateTransformations]]
deps = ["LinearAlgebra", "StaticArrays"]
git-tree-sha1 = "f9d7112bfff8a19a3a4ea4e03a8e6a91fe8456bf"
Expand All @@ -389,6 +438,12 @@ git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15"
uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
version = "4.1.1"

[[deps.DSP]]
deps = ["Compat", "FFTW", "IterTools", "LinearAlgebra", "Polynomials", "Random", "Reexport", "SpecialFunctions", "Statistics"]
git-tree-sha1 = "f7f4319567fe769debfcf7f8c03d8da1dd4e2fb0"
uuid = "717857b8-e6f2-59f4-9121-6e50c889abd2"
version = "0.7.9"

[[deps.DataAPI]]
git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
Expand Down Expand Up @@ -446,6 +501,12 @@ git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae"
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
version = "1.9.1"

[[deps.DescriptorSystems]]
deps = ["LinearAlgebra", "MatrixEquations", "MatrixPencils", "Polynomials", "Random"]
git-tree-sha1 = "1e32ab7adb1aae200e3f9c18decb3508af3dc33c"
uuid = "a81e2ce2-54d1-11eb-2c75-db236b00f339"
version = "1.4.4"

[[deps.DiffEqBase]]
deps = ["ArrayInterface", "ConcreteStructs", "DataStructures", "DocStringExtensions", "EnumX", "EnzymeCore", "FastBroadcast", "FastClosures", "ForwardDiff", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "Logging", "Markdown", "MuladdMacro", "Parameters", "PreallocationTools", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SciMLStructures", "Setfield", "Static", "StaticArraysCore", "Statistics", "Tricks", "TruncatedStacktraces"]
git-tree-sha1 = "fa7d580038451a8df4434ef5b079ac9b2d486194"
Expand Down Expand Up @@ -568,9 +629,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[deps.Distributions]]
deps = ["AliasTables", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"]
git-tree-sha1 = "e6c693a0e4394f8fda0e51a5bdf5aef26f8235e9"
git-tree-sha1 = "d7477ecdafb813ddee2ae727afa94e9dcb5f3fb0"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
version = "0.25.111"
version = "0.25.112"

[deps.Distributions.extensions]
DistributionsChainRulesCoreExt = "ChainRulesCore"
Expand Down Expand Up @@ -1176,9 +1237,9 @@ version = "0.1.5"

[[deps.JpegTurbo_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "c84a835e1a09b289ffcd2271bf2a337bbdda6637"
git-tree-sha1 = "25ee0be4d43d0269027024d75a24c24d6c6e590c"
uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8"
version = "3.0.3+0"
version = "3.0.4+0"

[[deps.JuliaFormatter]]
deps = ["CSTParser", "CommonMark", "DataStructures", "Glob", "PrecompileTools", "TOML", "Tokenize"]
Expand Down Expand Up @@ -1428,6 +1489,18 @@ version = "7.3.0"
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[[deps.LinearMaps]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "ee79c3208e55786de58f8dcccca098ced79f743f"
uuid = "7a12625a-238d-50fd-b39a-03d52299707e"
version = "3.11.3"
weakdeps = ["ChainRulesCore", "SparseArrays", "Statistics"]

[deps.LinearMaps.extensions]
LinearMapsChainRulesCoreExt = "ChainRulesCore"
LinearMapsSparseArraysExt = "SparseArrays"
LinearMapsStatisticsExt = "Statistics"

[[deps.LinearSolve]]
deps = ["ArrayInterface", "ChainRulesCore", "ConcreteStructs", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "LazyArrays", "Libdl", "LinearAlgebra", "MKL_jll", "Markdown", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "StaticArraysCore", "UnPack"]
git-tree-sha1 = "6c5e4555ac2bc449a28604e184f759d18fc08420"
Expand Down Expand Up @@ -1556,6 +1629,18 @@ git-tree-sha1 = "e1641f32ae592e415e3dbae7f4a188b5316d4b62"
uuid = "0a4f8689-d25c-4efe-a92b-7142dfc1aa53"
version = "0.6.1"

[[deps.MatrixEquations]]
deps = ["LinearAlgebra", "LinearMaps"]
git-tree-sha1 = "f765b4eda3ea9be8e644b9127809ca5151f3d9ea"
uuid = "99c1a7ee-ab34-5fd5-8076-27c950a045f4"
version = "2.4.2"

[[deps.MatrixPencils]]
deps = ["LinearAlgebra", "Polynomials", "Random"]
git-tree-sha1 = "c00a086f4f1df792c77dc1bd674357044aa08d74"
uuid = "48965c70-4690-11ea-1f13-43a2532b2fa8"
version = "1.8.0"

[[deps.MaybeInplace]]
deps = ["ArrayInterface", "LinearAlgebra", "MacroTools"]
git-tree-sha1 = "54e2fdc38130c05b42be423e90da3bade29b74bd"
Expand Down Expand Up @@ -1618,8 +1703,6 @@ version = "9.41.0"
[[deps.ModelingToolkitStandardLibrary]]
deps = ["ChainRulesCore", "DiffEqBase", "IfElse", "LinearAlgebra", "ModelingToolkit", "Symbolics"]
git-tree-sha1 = "21a278835793f475f8e9ccc0756bb38515473cf1"
repo-rev = "main"
repo-url = "https://github.com/SciML/ModelingToolkitStandardLibrary.jl.git"
uuid = "16a59e39-deab-5bd0-87e4-056b12336739"
version = "2.14.0"

Expand All @@ -1629,6 +1712,16 @@ git-tree-sha1 = "b76ea40b5c0f45790ae09492712dd326208c28b2"
uuid = "66fc600b-dfda-50eb-8b99-91cfa97b1301"
version = "1.1.7"

[[deps.MonteCarloMeasurements]]
deps = ["Distributed", "Distributions", "ForwardDiff", "GenericSchur", "LinearAlgebra", "MacroTools", "Random", "RecipesBase", "Requires", "SLEEFPirates", "StaticArrays", "Statistics", "StatsBase", "Test"]
git-tree-sha1 = "36ccc5e09dbba9aea61d78cd7bc46c5113e6ad84"
uuid = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
version = "1.2.1"
weakdeps = ["Makie"]

[deps.MonteCarloMeasurements.extensions]
MakieExt = "Makie"

[[deps.MosaicViews]]
deps = ["MappedArrays", "OffsetArrays", "PaddedViews", "StackViews"]
git-tree-sha1 = "7b86a5d4d70a9f5cdf2dacb3cbe6d251d1a61dbe"
Expand All @@ -1646,7 +1739,7 @@ version = "0.2.4"

[[deps.Multibody]]
deps = ["CoordinateTransformations", "DataInterpolations", "FileIO", "JuliaSimCompiler", "LinearAlgebra", "MeshIO", "ModelingToolkit", "ModelingToolkitStandardLibrary", "Rotations", "SparseArrays", "StaticArrays"]
path = ".."
git-tree-sha1 = "3d0ca08b6fb8ef5190bf112746dba6becc6cda5f"
uuid = "e1cad5d1-98ef-44f9-a79a-9ca4547f95b9"
version = "0.3.0"

Expand Down Expand Up @@ -2130,6 +2223,19 @@ git-tree-sha1 = "77b3d3605fc1cd0b42d95eba87dfcd2bf67d5ff6"
uuid = "647866c9-e3ac-4575-94e7-e3d426903924"
version = "0.1.2"

[[deps.Polynomials]]
deps = ["LinearAlgebra", "RecipesBase", "Requires", "Setfield", "SparseArrays"]
git-tree-sha1 = "1a9cfb2dc2c2f1bd63f1906d72af39a79b49b736"
uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
version = "4.0.11"
weakdeps = ["ChainRulesCore", "FFTW", "MakieCore", "MutableArithmetics"]

[deps.Polynomials.extensions]
PolynomialsChainRulesCoreExt = "ChainRulesCore"
PolynomialsFFTWExt = "FFTW"
PolynomialsMakieCoreExt = "MakieCore"
PolynomialsMutableArithmeticsExt = "MutableArithmetics"

[[deps.PositiveFactorizations]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "17275485f373e6673f7e7f97051f703ed5b15b20"
Expand Down Expand Up @@ -2361,6 +2467,12 @@ git-tree-sha1 = "58cdd8fb2201a6267e1db87ff148dd6c1dbd8ad8"
uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f"
version = "0.5.1+0"

[[deps.RobustAndOptimalControl]]
deps = ["ChainRulesCore", "ComponentArrays", "ControlSystemsBase", "DescriptorSystems", "Distributions", "GenericSchur", "LinearAlgebra", "MatrixEquations", "MatrixPencils", "MonteCarloMeasurements", "Optim", "Printf", "Random", "RecipesBase", "Statistics", "UUIDs", "UnPack"]
git-tree-sha1 = "5ae8bb37ef2d7b9357b5112a43e03bb0365d5cf4"
uuid = "21fd56a4-db03-40ee-82ee-a87907bee541"
version = "0.4.31"

[[deps.Rotations]]
deps = ["LinearAlgebra", "Quaternions", "Random", "StaticArrays"]
git-tree-sha1 = "5680a9276685d392c87407df00d57c9924d9f11e"
Expand Down Expand Up @@ -2693,9 +2805,9 @@ version = "7.2.1+1"

[[deps.SymbolicIndexingInterface]]
deps = ["Accessors", "ArrayInterface", "RuntimeGeneratedFunctions", "StaticArraysCore"]
git-tree-sha1 = "988e04b34a4c3b824fb656f542473df99a4f610d"
git-tree-sha1 = "0225f7c62f5f78db35aae6abb2e5cabe38ce578f"
uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
version = "0.3.30"
version = "0.3.31"

[[deps.SymbolicLimits]]
deps = ["SymbolicUtils"]
Expand Down Expand Up @@ -3087,9 +3199,9 @@ version = "1.2.13+1"

[[deps.Zstd_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "e678132f07ddb5bfa46857f0d7620fb9be675d3b"
git-tree-sha1 = "555d1076590a6cc2fdee2ef1469451f872d8b41b"
uuid = "3161d3a3-bdf6-5164-811a-617609db77b4"
version = "1.5.6+0"
version = "1.5.6+1"

[[deps.eudev_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "gperf_jll"]
Expand Down
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[deps]
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
ControlSystemsMTK = "687d7614-c7e5-45fc-bfc3-9ee385575c88"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
JuliaSimCompiler = "8391cb6b-4921-5777-4e45-fd9aab8cb88d"
Expand All @@ -8,3 +10,4 @@ ModelingToolkitStandardLibrary = "16a59e39-deab-5bd0-87e4-056b12336739"
Multibody = "e1cad5d1-98ef-44f9-a79a-9ca4547f95b9"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
RobustAndOptimalControl = "21fd56a4-db03-40ee-82ee-a87907bee541"
Loading

0 comments on commit a635266

Please sign in to comment.