Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Sep 19, 2024
1 parent edf0204 commit 7704240
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ end
include("test_PlanarMechanics.jl")
end

@testset "urdf" begin
@info "Testing urdf"
include("test_urdf.jl")
end


# ==============================================================================
## Add spring to make a harmonic oscillator ====================================
Expand Down
22 changes: 22 additions & 0 deletions test/test_urdf.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Test
using ModelingToolkit, Multibody, LightXML, Graphs, MetaGraphsNext, JuliaFormatter
cd(@__DIR__)
# URDF = Base.get_extension(Multibody, :URDF)

urdf2multibody(joinpath(dirname(pathof(Multibody)), "..", "test", "urdf", "doublependulum.urdf"), extras=false, out="doublependulum.jl", modelname="DoublePendulum")

include("doublependulum.jl")



using ModelingToolkit, Multibody, JuliaSimCompiler, OrdinaryDiffEq#, Plots
import ModelingToolkit: t_nounits as t, D_nounits as D
W(args...; kwargs...) = Multibody.world
@named model = DoublePendulum()
model = complete(model)
ssys = structural_simplify(IRSystem(model))
prob = ODEProblem(ssys, [], (0.0, 10.0))
sol = solve(prob, Tsit5())
@test SciMLBase.successful_retcode(sol)
@test !iszero(sol.u[end])
# plot(sol) |> display

0 comments on commit 7704240

Please sign in to comment.