Latest attempt at jump. Does not work yet.

This commit is contained in:
Connor
2021-08-30 23:28:36 -06:00
parent 850f05ce38
commit 5daf007e5b
11 changed files with 452 additions and 117 deletions

View File

@@ -1,4 +1,4 @@
export oe_to_rθh, rθh_to_xyz, oe_to_xyz, xyz_to_oe
export oe_to_rθh, rθh_to_xyz, oe_to_xyz, xyz_to_oe, conv_T
function oe_to_rθh(oe::Vector,μ::Real) :: Vector
@@ -68,3 +68,45 @@ function xyz_to_oe(cart_vec::Vector,μ::Real)
return [a,e,i,Ω,ω,ν]
end
function conv_T(Tr::Vector{Float64},
::Vector{Float64},
Th::Vector{Float64},
init_state::Vector{Float64},
m::Float64,
craft::Sc,
time::Float64,
μ::Float64)
Txs = Float64[]
Tys = Float64[]
Tzs = Float64[]
state = init_state
for i in 1:length(Tr)
mag, α, β = Tr[i], [i], Th[i]
if mag > 1 || mag < 0
throw(ErrorException("ΔV input is too high: $mag"))
elseif α > π || α < -π
throw(ErrorException("α angle is incorrect: $α"))
elseif β > π/2 || β < -π/2
throw(ErrorException("β angle is incorrect: "))
end
thrust_rθh = mag * [cos(β)*sin(α), cos(β)*cos(α), sin(β)]
_,_,i,Ω,ω,ν = xyz_to_oe(state, μ)
θ = ω+ν
,,ci,si,, = cos(Ω),sin(Ω),cos(i),sin(i),cos(θ),sin(θ)
DCM = [*-*ci* -*-*ci* *si;
*+*ci* -*+*ci* -*si;
si* si* ci]
ΔV = DCM*thrust_rθh
Tx, Ty, Tz = max_ΔV(craft.duty_cycle, craft.num_thrusters, craft.max_thrust, time, 0., m) * ΔV
x, y, z, dx, dy, dz = state
state = prop_one_simple(Tx, Ty, Tz, x, y, z, dx, dy, dz, time/length(Tr), μ)
push!(Txs, Tx)
push!(Tys, Ty)
push!(Tzs, Tz)
end
return Txs, Tys, Tzs
end