GeneralAstrodynamics.jl
GeneralAstrodynamics.jl copied to clipboard
Bounds Error in `AttitudeFunction`
The Attitude Model Calculations unit test is failing due to a bounds checking error. Using Debugger.jl, and looking at the error message, it appears that the issue is that the parameter vector (which has not really been a vector for the last couple of major ModelingToolkit.jl versions, but to my knowledge vectors are the only way to call ODEFunction instances) is being indexed by another vector.
The issue only occurs when Julia is initialized with --check-bounds yes.
vectorfield = AttitudeFunction()
q = [0, 0, 0, 1]
ω = [0.1, 0.1, 0.1]
x = vcat(q, ω)
J = diagm([0.1, 0.2, 0.3])
L = [0, 0, 0]
f = [0, 0, 0]
p = vcat(vec(J), L, f)
Thanks, Joey! I was also able to reproduce this on just the SciML side with this stripped back example I think:
using ModelingToolkit
import SciMLBase
@independent_variables t
@variables (q(t))[1:2]
@parameters L
δ = Differential(t)
eqs = [
δ(q[1]) ~ 0,
δ(q[2]) ~ L,
]
sys = complete(System(eqs, t; name = :Test); split = false)
AF = ODEFunction{true, SciMLBase.FullSpecialize}(sys; jac = true)
AF([1.0, 2.0], [3.0], NaN)
# Also same error with combined state / params
# AF([1.0, 2.0], [1.0, 2.0, 3.0], NaN)
@icweaver have you filed a ticket to ModelingToolkit? I was planning to myself, but ya beat me to the MWE! I think if you posted this, that would be helpful. If you do, maybe link this issue?
haha, for sure, sorry for the delay, just opened https://github.com/SciML/ModelingToolkit.jl/issues/3965
Oh geez, I was playing around with our project tools and didn't realize it would spam notifications like this. Sorry for the noise
All good, I don't mind! If you find some solid project management tools lmk, I'd love to get more organized here.