项目作者: arlk

项目描述 :
Safe Control for Nonlinear Systems
高级语言: Julia
项目地址: git://github.com/arlk/SafeFeedbackMotionPlanning.jl.git
创建时间: 2020-04-01T03:16:52Z
项目社区:https://github.com/arlk/SafeFeedbackMotionPlanning.jl

开源协议:

下载


SafeFeedbackMotionPlanning

This package is under active development

Design safe controllers for nonlinear systems in the presence of disturbances. The controllers ensure that the system state remains in a tunable safe tube around the desired state. Find out more about it in our paper:

  1. @article{lakshmanan2020safe,
  2. title={Safe Feedback Motion Planning: A Contraction Theory and $\mathcal{L}_1$-Adaptive Control Based Approach},
  3. author={Lakshmanan, Arun and Gahlawat, Aditya and Hovakimyan, Naira},
  4. journal={arXiv preprint arXiv:2004.01142},
  5. year={2020}
  6. }

Problem Formulation

Consider a system of the form

  1. ẋ = f(x) + B(x)u

where x(t), f(x) ∈ ℝⁿ, u(t) ∈ ℝᵐ, and B(x) ∈ ℝⁿˣᵐ, that is facing disturbances h(t,x) ∈ ℝᵐ (either/both state and time dependent) that is matched with the control channel:

  1. ẋ = f(x) + B(x)(u + h(t,x))

Given a desired state-control trajectory pair (x*,u*) (feasible under the nominal system) that the actual system is required to follow, design a controller u(t) such that the states remain inside a tube Ω(ρ, x*(t)) = {ℝⁿ : ||y - x*(t)|| ≤ ρ} of some user defined width ρ > 0.

In this package you can design controllers to do exactly this! A more in-depth review of the control architecture can be found in the paper.

Usage

Installation

  1. julia> ] add https://github.com/arlk/SafeFeedbackMotionPlanning.jl

Example

  1. using SafeFeedbackMotionPlanning
  2. using DifferentialEquations
  3. using Plots
  4. using LinearAlgebra
  5. # Define system matrices or functions
  6. f(x) = [-x[1] + 2*x[2];
  7. -0.25*x[2]^3 - 3*x[1] + 4*x[2]]
  8. B = [0.5, -2.0]
  9. # Simulation time span
  10. tspan = (0., 5.)
  11. # Intial condition of the system
  12. x0 = [1.0, -1.0]
  13. # Define desired regulation point or trajectories (as functions)
  14. xs = [0.0, 0.0]
  15. us = 0.0
  16. # Dual of the control contraction metric matrix (or as a function if state-dependent)
  17. W = [4.25828 -0.93423; -0.93423 3.76692]
  18. λ = 1.74
  19. # Uncertainty unknown to the controller
  20. h(t, x) = -2*sin(2*t) -0.01*x'*x
  21. # Upper bound on the norm of the uncertainty
  22. # for any x ∈ Ω(ρ = √2) and t ≥ 0 (see paper for more details).
  23. Δh = 2.1
  24. ω = 90
  25. Γ = 4e7
  26. # Construct objects using the parameters you just defined
  27. sys_p = sys_params(f, B)
  28. ccm_p = ccm_params(xs, us, λ, W)
  29. l1_p = l1_params(ω, Γ, Δh)
  30. # CCM only system without perturbations
  31. nom_sys = nominal_system(sys_p, ccm_p)
  32. nom_sol = solve(nom_sys, x0, tspan, Tsit5(), progress = true, progress_steps = 1)
  33. # CCM only system with perturbations
  34. ptb_sys = nominal_system(sys_p, ccm_p, h)
  35. ptb_sol = solve(ptb_sys, x0, tspan, Tsit5(), progress = true, progress_steps = 1)
  36. # L1 Reference sysem with perturbations AKA (non-implementable) ideal
  37. # performance of the L1 system with full knowledge of the uncertainty
  38. ref_sys = reference_system(sys_p, ccm_p, ω, h)
  39. ref_sol = solve(ref_sys, x0, tspan, Tsit5(), progress = true, progress_steps = 1)
  40. # L1 + CCM system with perturbations
  41. l1_sys = l1_system(sys_p, ccm_p, l1_p, h)
  42. l1_sol = solve(l1_sys, x0, tspan, Rosenbrock23(), progress = true, progress_steps = 1, saveat = 0.01)
  43. l = @layout [a b; c d]
  44. p1 = plot(nom_sol, vars=[(0,1),(0,2)], title="Ideal CCM performance", legend=:none)
  45. p2 = plot(ptb_sol, vars=[(0,1),(0,2)], title="CCM with perturbations", legend=:none)
  46. p3 = plot(ref_sol, vars=[(0,1),(0,2)], title="Ideal L1+CCM with perturbations\n (non-implementable)", legend=:none)
  47. p4 = plot(l1_sol, vars=[(0,1),(0,2)], title="L1+CCM with perturbations", legend=:none)
  48. plot(p1, p2, p3, p4, layout=l)

TODO

  • CCM metric search using SumofSquares.jl
  • Automatically computing ω and Γ from the tube bounds