-
Notifications
You must be signed in to change notification settings - Fork 0
Add tutorials on free times #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
To make the doc locally: julia> pkg="Tutorials"
"Tutorials"
julia> using Pkg; Pkg.activate("docs/"); Pkg.develop(path=pwd()); include("docs/make.jl"); Pkg.rm(pkg) To visualise: shell> open docs/build/index.html |
@ocots After our discussion yesterday, I added a theoretical part on the double integrator example, but I’m not sure if I should keep all of it in the tutorial ? |
using OptimalControl
using NLPModelsIpopt
using BenchmarkTools
using DataFrames
using Plots
using Printf
const x₁₀ = -42272.67 # initial position x
const x₂₀ = 0 # initial position y
const x₃₀ = 0 # initial velocity in x
const x₄₀ = -5696.72 # initial velocity in y
const μ = 5.1658620912*1e12 # gravitational parameter
const γ_max = 0.05 # maximal thrust norm
const r_f = 1.0 # target orbit radius (final distance to origin)
function min_orbit_tf()
@def ocp begin
tf ∈ R, variable
t ∈ [0, tf], time
x ∈ R⁴, state
u ∈ R², control
u₁(t)^2 + u₂(t)^2 ≤ γ_max^2
x(0) == [x₁₀, x₂₀, x₃₀, x₄₀]
x₁(tf)^2 + x₂(tf)^2 == r_f^2
0.05 ≤ tf ≤ Inf
ẋ(t) == [
x₃(t),
x₄(t),
-μ * x₁(t) / ((x₁(t)^2 + x₂(t)^2)^(3/2)) + u₁(t),
-μ * x₂(t) / ((x₁(t)^2 + x₂(t)^2)^(3/2)) + u₂(t)
]
tf → min
end
return ocp
end
nothing # hide Direct resolution with minimal orbital time :We now solve the problem using a direct method, with automatic treatment of the free initial time.
When I define my problem as you can see here, I get an error when calling min_orbit_tf() because x is undefined, and I don't understand why. |
@YouriRenoud @yeetsin12 Réunion à 14h salle TP C20X aujourd'hui. |
@YouriRenoud Have a look at my comments. |
…irect method for orbit example
@YouriRenoud @yeetsin12 just for the record, take a look at https://control-toolbox.org/Kepler.jl/stable (more adapted set of coordinates - aka Gauss coordinates) |
I prefer to keep cartesian coordinates here to keep it simple but we can put a link to the Kepler application. |
@ocots i fixed the problem of non convergence for indirect orbital problem, and improved the structure of the tutorial a little bit, i think i will start working on another tutorial "intermediate time constraints" unless there is more modifications to be made. |
hi @yeetsin12 so it converges? |
@jbcaillau yes it converges |
@yeetsin12 we can make a point tomorrow at 2pm and I will finalise this PR with you. If you want to start another, feel free. Go the issue, create a branch, make a first commit and push. Then, new PR and let's go! You don't need write access since you already have it. |
@yeetsin12 Can you come in my office at 2pm? |
@ocots i will be there at 2 pm, is the office in F325? |
@ocots for today's reunion, will it be at 4pm? |
@yeetsin12 Attention, vérifie que tous les packages utiles sont dans le fichier |
@yeetsin12 attention, un peu plus haut dans la PR tu trouveras des commentaires qui viennent de messages directement sur le code. Je ne sais pas si tu les vois. |
@ocots non, j'arrive pas à trouver les messages sur le code, c'est dans la partie "files changed"? |
@ocots En tout cas, il me reste de modifier le dernier tutoriel de orbital final time, car j'arrive pas à supprimer la partie du code sur "augmented dynamics" ça donne des erreurs en compilation. |
No description provided.