I’m starting out with RigidBodyDynamics.jl and can successfully create and sim models in its environment. I’d like to try RigidBodySim.jl, mostly for the interface to DifferentialEquations.jl for its problem types and solvers. However, Pkg.adding RigidBodySim creates a window full of warnings and errors. I attempted to simulate my working RigidBodyDynamics model in an ODEProblem just in case the warnings and errors were benign but with no such luck.
It appears RigidBodySim hasnt recieved any updates in ~3 years. Is it still the best interface for RigidBodyDynamics to DifferentialEquations, and if so am I just doing something wrong to get it working?
(rbd) pkg> status
Status `C:\Users\jonda\Documents\julia\rbd\Project.toml`
⌃ [0c46a032] DifferentialEquations v6.18.0
⌅ [6ad125db] MeshCatMechanisms v0.7.1
[295af30f] Revise v3.5.5
[366cf18f] RigidBodyDynamics v2.4.0
[e61f16d8] RigidBodySim v1.3.0
[37e2e46d] LinearAlgebra
Info Packages marked with ⌃ and ⌅ have new versions available, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated`
(rbd) pkg>
using LinearAlgebra,RigidBodyDynamics,DifferentialEquations
# create the world frame
N = RigidBody{Float64}("N")
bodywheel = Mechanism(N; gravity = zeros(3))
# create the N to B joint
G1 = Joint("G1", QuaternionFloating{Float64}())
# create the body
j_body = SpatialInertia(
frame_after(G1),
com = zeros(3),
moment_about_com = 1000 * I(3),
mass = 1000
)
B = RigidBody(j_body)
# create the B to W joint
G2 = Joint("G2", Revolute{Float64}([0,0,1]))
# create the wheel
j_wheel = SpatialInertia(
frame_after(G2),
com = zeros(3),
moment_about_com = 10 * I(3),
mass = 10
)
W = RigidBody(j_body)
# attach all the components
attach!(bodywheel,N,B,G1)
attach!(bodywheel,B,W,G2)
#sim
state = MechanismState(bodywheel)
result = DynamicsResult(bodywheel)
dynamics = Dynamics(bodywheel)
set_configuration!(state, G1, [0,0,0,1,0,0,0]) # [q,r]
set_velocity!(state, G1, [0,0,pi/12,0,0,0]) # [ω,v]
set_configuration!(state, G2, 0) # θ
set_velocity!(state, G2, pi/4) #ω
function simple_control!(torques::AbstractVector, t, state::MechanismState)
torques[velocity_range(state, G1)] .= -1000 * velocity(state,G1)
end
#works
ts, qs, vs = simulate(state, 10., simple_control!, Δt = .1);
#try simming with RigidBodySim
#does not work
prob = ODEProblem(dynamics,state,(0,10))
sol = solve(prob,Tsit5())
Can’t post the full REPL response, it was something like 600k characters. Here are the highlights I see:
ERROR: LoadError: UndefVarError: `prepare_alg` not defined
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
@ Base .\Base.jl:31
[2] top-level scope
@ C:\Users\jonda\.julia\packages\SteadyStateDiffEq\gjuOi\src\solve.jl:1
[3] include(mod::Module, _path::String)
@ Base .\Base.jl:457
[4] include(x::String)
@ SteadyStateDiffEq C:\Users\jonda\.julia\packages\SteadyStateDiffEq\gjuOi\src\SteadyStateDiffEq.jl:1
[5] top-level scope
@ C:\Users\jonda\.julia\packages\SteadyStateDiffEq\gjuOi\src\SteadyStateDiffEq.jl:12
[6] include
@ .\Base.jl:457 [inlined]
[7] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
@ Base .\loading.jl:2010
[8] top-level scope
@ stdin:2
in expression starting at C:\Users\jonda\.julia\packages\SteadyStateDiffEq\gjuOi\src\solve.jl:1
in expression starting at C:\Users\jonda\.julia\packages\SteadyStateDiffEq\gjuOi\src\SteadyStateDiffEq.jl:1
in expression starting at stdin:2
ERROR: LoadError: Failed to precompile SteadyStateDiffEq [9672c7b4-1e72-59bd-8a11-6ac3964bc41f] to "C:\\Users\\jonda\\.julia\\compiled\\v1.9\\SteadyStateDiffEq\\jl_C95D.tmp".
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base .\loading.jl:2260
[3] compilecache
@ .\loading.jl:2127 [inlined]
[4] _require(pkg::Base.PkgId, env::String)
@ Base .\loading.jl:1770
[5] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1625
[6] macro expansion
@ .\loading.jl:1613 [inlined]
[7] macro expansion
@ .\lock.jl:267 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1576
[9] include
@ .\Base.jl:457 [inlined]
[10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
@ Base .\loading.jl:2010
[11] top-level scope
@ stdin:2
in expression starting at C:\Users\jonda\.julia\packages\DifferentialEquations\el96s\src\DifferentialEquations.jl:1
in expression starting at stdin:2
ERROR: Failed to precompile DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa] to "C:\\Users\\jonda\\.julia\\compiled\\v1.9\\DifferentialEquations\\jl_BBEA.tmp".
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base .\loading.jl:2260
[3] compilecache
@ .\loading.jl:2127 [inlined]
[4] _require(pkg::Base.PkgId, env::String)
@ Base .\loading.jl:1770
[5] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1625
[6] macro expansion
@ .\loading.jl:1613 [inlined]
[7] macro expansion
@ .\lock.jl:267 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1576
[9] top-level scope
@ C:\Users\jonda\Documents\julia\rbd\rbd.jl:1
in expression starting at C:\Users\jonda\Documents\julia\rbd\rbd.jl:1
These warnings are probably 90% of the REPL message
(rbd) pkg> instantiate
Precompiling project...
✗ MeshCatMechanisms
✗ SteadyStateDiffEq
✗ RigidBodySim
✗ DifferentialEquations
42 dependencies successfully precompiled in 104 seconds. 218 already precompiled. 1 skipped during auto due to previous errors.
4 dependencies errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the packages
20 dependencies had warnings during precompilation:
┌ StatsFuns [4c63d2b9-4356-54db-8cca-17b64c39e42c]
│ WARNING: Method definition (::Type{Base.MPFR.BigFloat})(Base.Irrational{:twoπ}) in module IrrationalConstants at irrationals.jl:215 overwritten in module StatsFuns on the same line (check for duplicate calls to `include`).
│ ** incremental compilation may be fatally broken for this module **
│
│ WARNING: Method definition kwcall(Any, Type{Base.MPFR.BigFloat}, Base.Irrational{:twoπ}) in module IrrationalConstants at irrationals.jl:215 overwritten in module StatsFuns on the same line (check for duplicate calls to `include`).
│ ** incremental compilation may be fatally broken for this module **
│
│ WARNING: Method definition (::Type{Float64})(Base.Irrational{:twoπ}) in module IrrationalConstants at irrationals.jl:224 overwritten in module StatsFuns on the same line (check for duplicate calls to `include`).
│ ** incremental compilation may be fatally broken for this module **
│
│ WARNING: Method definition (::Type{Float32})(Base.Irrational{:twoπ}) in module IrrationalConstants at irrationals.jl:225 overwritten in module StatsFuns on the same line (check for duplicate calls to `include`).
│ ** incremental compilation may be fatally broken for this module **
│
│ WARNING: Method definition (::Type{Base.MPFR.BigFloat})(Base.Irrational{:fourπ}) in module IrrationalConstants at irrationals.jl:215 overwritten in module StatsFuns on the same line (check for duplicate calls to `include`).
│ ** incremental compilation may be fatally broken for this module **
│
│ WARNING: Method definition kwcall(Any, Type{Base.MPFR.BigFloat}, Base.Irrational{:fourπ}) in module IrrationalConstants at irrationals.jl:215 overwritten in module StatsFuns on the same line (check for duplicate calls to `include`).
│ ** incremental compilation may be fatally broken for this module **
│
│ WARNING: Method definition (::Type{Float64})(Base.Irrational{:fourπ}) in module IrrationalConstants at irrationals.jl:224 overwritten in module StatsFuns on the same line (check for duplicate calls to `include`).
│ ** incremental compilation may be fatally broken for this module **
Error: Error during loading of extension AdaptStaticArraysExt of Adapt, use `Base.retry_load_extensions()` to retry.
│ │ exception =
│ │ 1-element ExceptionStack:
│ │ Failed to precompile AdaptStaticArraysExt [e1699a77-9e31-5da8-bb3e-0a796f95f0a0] to "C:\\Users\\jonda\\.julia\\compiled\\v1.9\\AdaptStaticArraysExt\\jl_7870.tmp".
│ │ Stacktrace:
│ │ [1] error(s::String)
│ │ @ Base .\error.jl:35
│ │ [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
│ │ @ Base .\loading.jl:2260
│ │ [3] compilecache
│ │ @ .\loading.jl:2127 [inlined]
│ │ [4] _require(pkg::Base.PkgId, env::Nothing)
│ │ @ Base .\loading.jl:1770
│ │ [5] _require_prelocked(uuidkey::Base.PkgId, env::Nothing)
│ │ @ Base .\loading.jl:1625
│ │ [6] _require_prelocked(uuidkey::Base.PkgId)
│ │ @ Base .\loading.jl:1623
│ │ [7] run_extension_callbacks(extid::Base.ExtensionId)
│ │ @ Base .\loading.jl:1198
│ │ [8] run_extension_callbacks(pkgid::Base.PkgId)
│ │ @ Base .\loading.jl:1255
│ │ [9] run_package_callbacks(modkey::Base.PkgId)
│ │ @ Base .\loading.jl:1083
│ │ [10] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, ocachepath::String, sourcepath::String, depmods::Vector{Any})
│ │ @ Base .\loading.jl:1363
│ │ [11] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
│ │ @ Base .\loading.jl:1459
│ │ [12] _require(pkg::Base.PkgId, env::String)
│ │ @ Base .\loading.jl:1748
│ │ [13] _require_prelocked(uuidkey::Base.PkgId, env::String)
│ │ @ Base .\loading.jl:1625
│ │ [14] macro expansion
│ │ @ .\loading.jl:1613 [inlined]
│ │ [15] macro expansion
│ │ @ .\lock.jl:267 [inlined]
│ │ [16] require(into::Module, mod::Symbol)
│ │ @ Base .\loading.jl:1576
│ │ [17] include
│ │ @ .\Base.jl:457 [inlined]
│ │ [18] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
│ │ @ Base .\loading.jl:2010
│ │ [19] top-level scope
│ │ @ stdin:2
│ │ [20] eval
│ │ @ .\boot.jl:370 [inlined]
│ │ [21] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
│ │ @ Base .\loading.jl:1864
│ │ [22] include_string
│ │ @ .\loading.jl:1874 [inlined]
│ │ [23] exec_options(opts::Base.JLOptions)
│ │ @ Base .\client.jl:305
│ │ [24] _start()
│ │ @ Base .\client.jl:522
│ └ @ Base loading.jl:1204