diff --git a/docs/src/examples/prescribed_pose.md b/docs/src/examples/prescribed_pose.md index 4a318858..2cd3f0c6 100644 --- a/docs/src/examples/prescribed_pose.md +++ b/docs/src/examples/prescribed_pose.md @@ -30,7 +30,7 @@ using Test t = Multibody.t D = Differential(t) -W(args...; kwargs...) = Multibody.world + n = [1, 0, 0] AB = 146.5 / 1000 @@ -131,7 +131,7 @@ end rod_radius = 0.02 end @components begin - world = W() + world = World() mass = Body(m=ms, r_cm = 0.5DA*normalize([0, 0.2, 0.2*sin(t5)])) excited_suspension = ExcitedWheelAssembly(; rod_radius) prescribed_motion = Pose(; r = [0, 0.1 + 0.1sin(t), 0], R = RotXYZ(0, 0.5sin(t), 0)) diff --git a/docs/src/examples/space.md b/docs/src/examples/space.md index f69ffb12..71d822da 100644 --- a/docs/src/examples/space.md +++ b/docs/src/examples/space.md @@ -23,11 +23,10 @@ using OrdinaryDiffEq t = Multibody.t D = Differential(t) -W(;kwargs...) = Multibody.world @mtkmodel PointGrav begin @components begin - world = W() + world = World() body1 = Body( m=1, I_11=0.1, diff --git a/docs/src/examples/suspension.md b/docs/src/examples/suspension.md index d39b66c2..fd03e3b6 100644 --- a/docs/src/examples/suspension.md +++ b/docs/src/examples/suspension.md @@ -18,7 +18,6 @@ using Test t = Multibody.t D = Differential(t) -W(args...; kwargs...) = Multibody.world n = [1, 0, 0] AB = 146.5 / 1000 @@ -137,7 +136,7 @@ end dir = mirror ? -1 : 1 end @components begin - world = W() + world = World() mass = Body(m=ms, r_cm = 0.5DA*normalize([0, 0.2, 0.2*sin(t5)*dir])) excited_suspension = SuspensionWithExcitation(; suspension.spring=true, mirror, rod_radius) body_upright = Prismatic(n = [0, 1, 0], render = false, state_priority=1000) diff --git a/docs/src/examples/swing.md b/docs/src/examples/swing.md index 955d2872..939672a2 100644 --- a/docs/src/examples/swing.md +++ b/docs/src/examples/swing.md @@ -18,8 +18,6 @@ t = Multibody.t D = Differential(t) world = Multibody.world -W(args...; kwargs...) = Multibody.world - @mtkmodel SwingRope begin @components begin frame_a = Frame() @@ -44,7 +42,7 @@ end w = 0.4 end @components begin - world = W() + world = World() upper_trans1 = FixedTranslation(r=[-w/2, 0, 0]) rope1 = SwingRope(rope.r=[-w/2, h, -w/2]) body = Body(m=6, isroot=true, I_11=0.1, I_22=0.1, I_33=0.1) @@ -91,7 +89,7 @@ Next, we create the full swing assembly w = 0.4 end @components begin - world = W() + world = World() upper_trans1 = FixedTranslation(r=[-w/2, 0, 0]) upper_trans2 = FixedTranslation(r=[ w/2, 0, 0]) rope1 = SwingRope(rope.r=[-w/2, -h, -w/2]) diff --git a/docs/src/examples/wheel.md b/docs/src/examples/wheel.md index 898b3f95..be040d46 100644 --- a/docs/src/examples/wheel.md +++ b/docs/src/examples/wheel.md @@ -31,11 +31,10 @@ using Test t = Multibody.t D = Differential(t) -W(args...; kwargs...) = Multibody.world @mtkmodel WheelInWorld begin @components begin - world = W() + world = World() wheel = RollingWheel( radius = 0.3, m = 2, @@ -104,7 +103,7 @@ The slip velocity is defined such that when the wheel is moving with positive ve ```@example WHEEL @mtkmodel SlipWheelInWorld begin @components begin - world = W() + world = World() wheel = SlippingWheel( radius = 0.3, m = 2, @@ -164,7 +163,7 @@ A [`RollingWheelSet`](@ref) is comprised out of two wheels mounted on a common a wheels = RollingWheelSet(radius=0.1, m_wheel=0.5, I_axis=0.01, I_long=0.02, track=0.5, state_priority=100) bar = FixedTranslation(r = [0.2, 0, 0]) body = Body(m=0.01, state_priority=1) - world = W() + world = World() end @equations begin connect(sine1.output, torque1.tau) @@ -216,7 +215,7 @@ tire_black = [0.1, 0.1, 0.1, 1] g=0 end @components begin - world = W() + world = World() sine1 = Blocks.Sine(frequency=1, amplitude=150) sine2 = Blocks.Sine(frequency=1, amplitude=150, phase=pi/6) diff --git a/examples/JuliaSim_logo.jl b/examples/JuliaSim_logo.jl index b743dcc9..4aa7dd58 100644 --- a/examples/JuliaSim_logo.jl +++ b/examples/JuliaSim_logo.jl @@ -3,7 +3,6 @@ using Multibody, JuliaSimCompiler using OrdinaryDiffEq # Contains the ODE solver we will use using Plots t = Multibody.t -W(args...; kwargs...) = Multibody.world JULIASIM_PURPLE = [87,87,219,255.0f0]./255 # RGBA diff --git a/ext/URDF.jl b/ext/URDF.jl index 2a78d227..a6465912 100644 --- a/ext/URDF.jl +++ b/ext/URDF.jl @@ -310,7 +310,6 @@ function Multibody.urdf2multibody(filename::AbstractString; extras=false, out=no """ using ModelingToolkit, Multibody, JuliaSimCompiler, OrdinaryDiffEq, Plots import ModelingToolkit: t_nounits as t, D_nounits as D - W(args...; kwargs...) = Multibody.world """ else "" @@ -318,7 +317,7 @@ function Multibody.urdf2multibody(filename::AbstractString; extras=false, out=no s = s * """ @mtkmodel $(modelname) begin @components begin - world = W() + world = World() $(join(bodies, "\n")) $(join(joints, "\n")) end diff --git a/test/runtests.jl b/test/runtests.jl index d39e4059..d89e7d94 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -8,7 +8,7 @@ t = Multibody.t D = Differential(t) doplot() = false world = Multibody.world -W(args...; kwargs...) = Multibody.world + @testset "world" begin @info "Testing world" @@ -388,7 +388,7 @@ end @testset "Spring damper system" begin systems = @named begin - world = W() + world = World() body1 = Body(; m = 1, isroot = true, r_cm = [0.0, 0, 0], I_11 = 0.1, I_22 = 0.1, I_33 = 0.1, r_0 = [0.3, -0.2, 0], quat=false) # This is root since there is no joint parallel to the spring leading to this body body2 = Body(; m = 1, isroot = false, r_cm = [0.0, -0.2, 0]) # This is not root since there is a joint parallel to the spring leading to this body @@ -565,7 +565,7 @@ end using LinearAlgebra @mtkmodel PlanarTest begin @components begin - world = W() + world = World() planar = Planar(n=[0,0,1], n_x=[1,0,0]) force = Force() body = Body(m=1) @@ -1054,7 +1054,7 @@ using LinearAlgebra world = Multibody.world @mtkmodel CylinderPend begin @components begin - world = W() + world = World() body = BodyCylinder(r=[1,2,3], diameter=0.1) joint = Revolute() end @@ -1102,7 +1102,7 @@ using LinearAlgebra @info "Testing BodyBox" @mtkmodel BoxPend begin @components begin - world = W() + world = World() body = Multibody.BodyBox(r=[0.1, 1, 0.2], r_shape=[0, 0, 0], width=0.1, height=0.3, inner_width=0.05) joint = Revolute() end @@ -1217,7 +1217,7 @@ sol3 = solve(prob, FBDF(), abstol=1e-8, reltol=1e-8) @mtkmodel TestSphericalSpherical begin @components begin - world = W() + world = World() ss = SphericalSpherical(r_0 = [1, 0, 0], m = 1, kinematic_constraint=false) ss2 = BodyShape(r = [0, 0, 1], m = 1, isroot=true) s = Spherical() @@ -1248,7 +1248,7 @@ sol = solve(prob, Rodas4()) @mtkmodel TestSphericalSpherical begin @components begin - world = W() + world = World() ss = UniversalSpherical(rRod_ia = [1, 0, 0], kinematic_constraint=false, sphere_diameter=0.3) ss2 = BodyShape(r = [0, 0, 1], m = 1, isroot=true) s = Spherical() @@ -1291,7 +1291,7 @@ end # Test cylindrical joint @mtkmodel CylinderTest begin @components begin - world = W() + world = World() cyl = Cylindrical(n = [0, 1, 0]) # spring = Spring(c = 1) body = Body(state_priority=0) @@ -1352,7 +1352,7 @@ import ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica as Transl jr = 0.03, [description = "Radius of revolute joint"] end @components begin - world = W() + world = World() r1 = Revolute(; n, radius=jr, color=jc) r2 = Revolute(; n, radius=jr, color=jc) @@ -1482,7 +1482,7 @@ import ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica as Transl rRod2_ib = BC*normalize([0, 0.2, 0]) end @components begin - world = W() + world = World() r123 = JointRRR(n_a = n, n_b = n, rRod1_ia, rRod2_ib, rod_radius=0.02, rod_color=jc) r2 = Revolute(; n, radius=jr, color=jc) diff --git a/test/test_JointUSR_RRR.jl b/test/test_JointUSR_RRR.jl index 876c7a12..fb6c3506 100644 --- a/test/test_JointUSR_RRR.jl +++ b/test/test_JointUSR_RRR.jl @@ -8,7 +8,7 @@ using LinearAlgebra using JuliaSimCompiler world = Multibody.world -W(args...; kwargs...) = Multibody.world + t = Multibody.t D = Differential(t) @@ -17,7 +17,7 @@ D = Differential(t) # ============================================================================== @mtkmodel TestUSR begin @components begin - world = W() + world = World() j1 = JointUSR(positive_branch=true, use_arrays=false) fixed = FixedTranslation(r=[1,0,0]) b1 = Body(m=1) @@ -48,7 +48,7 @@ sol = solve(prob, FBDF(autodiff=true)) # ============================================================================== @mtkmodel TestRRR begin @components begin - world = W() + world = World() j1 = JointRRR(positive_branch=true) fixed = FixedTranslation(r=[1,0,0]) b1 = Body(m=1) diff --git a/test/test_orientation_getters.jl b/test/test_orientation_getters.jl index de231aad..8a69deae 100644 --- a/test/test_orientation_getters.jl +++ b/test/test_orientation_getters.jl @@ -2,7 +2,7 @@ using Test import ModelingToolkitStandardLibrary.Mechanical.Rotational @mtkmodel FurutaPendulum begin @components begin - world = W() + world = World() shoulder_joint = Revolute(n = [0, 1, 0], isroot = true, axisflange = true) elbow_joint = Revolute(n = [0, 0, 1], isroot = true, axisflange = true, phi0=0.1) upper_arm = BodyShape(; m = 1, isroot = false, r = [0, 0, 0.6], radius=0.04) diff --git a/test/test_urdf.jl b/test/test_urdf.jl index ce467896..71d920fd 100644 --- a/test/test_urdf.jl +++ b/test/test_urdf.jl @@ -11,7 +11,7 @@ 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)) diff --git a/test/test_wheels.jl b/test/test_wheels.jl index 4ecb54da..3e60bc1d 100644 --- a/test/test_wheels.jl +++ b/test/test_wheels.jl @@ -8,7 +8,7 @@ using LinearAlgebra @mtkmodel WheelInWorld begin @components begin # world = World(n=[0,0,-1]) - world = W() + world = World() wheel = RollingWheel(radius = 0.3, m = 2, I_axis = 0.06, I_long = 0.12, x0 = 0.2, @@ -59,7 +59,7 @@ using LinearAlgebra end @components begin # world = World(n=[0,0,-1]) - world = W() + world = World() wheel = RollingWheel(; radius = 0.3, m = 2, I_axis = 0.06, I_long = 0.12, x0 = 0.2, @@ -123,7 +123,7 @@ dd = diff(sol(tv, idxs=worldwheel.wheel.wheeljoint.der_angles[2]).u) # angular a import ModelingToolkitStandardLibrary.Blocks @mtkmodel WheelWithAxis begin @components begin - world = W() + world = World() prismatic = Prismatic(n = [0,1,0]) world_axis = Revolute(n = [0,1,0], iscut=false, state_priority=100, w0=10) # world_axis = RevolutePlanarLoopConstraint(n = [0,1,0]) @@ -168,7 +168,7 @@ end wheels = RollingWheelSet(radius=0.1, m_wheel=0.5, I_axis=0.01, I_long=0.02, track=0.5, state_priority=100) bar = FixedTranslation(r = [0.2, 0, 0]) body = Body(m=0.01, state_priority=1) - world = W() + world = World() end @equations begin connect(sine1.output, torque1.tau) diff --git a/test/test_worldforces.jl b/test/test_worldforces.jl index 454eccd4..d1178fb9 100644 --- a/test/test_worldforces.jl +++ b/test/test_worldforces.jl @@ -5,7 +5,7 @@ using JuliaSimCompiler using OrdinaryDiffEq doplot() = false world = Multibody.world -W(args...; kwargs...) = Multibody.world + t = Multibody.t D = Differential(t) @@ -14,7 +14,7 @@ D = Differential(t) # ============================================================================== @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() forcea = WorldForce(resolve_frame=:frame_b) forceb = WorldForce(resolve_frame=:frame_b) b = Body(m=1, state=true, isroot=true, quat=false, neg_w=false) @@ -46,7 +46,7 @@ sol = solve(prob, Tsit5()) # Tests here pass for any combination of quat and neg_w @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() force = WorldForce() body = Body(m=1, state=true, isroot=true, quat=false, neg_w=false) end @@ -84,7 +84,7 @@ sol = solve(prob, Tsit5()) # ============================================================================== @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() forcea = WorldForce(resolve_frame=:world) forceb = WorldForce(resolve_frame=:world) body = BodyShape(r=[1,0,0], state=true, isroot=true, quat=false, neg_w=true) @@ -124,7 +124,7 @@ sol = solve(prob, Tsit5(), reltol=1e-8) # ============================================================================== @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() forcea = WorldForce(resolve_frame=:frame_b) forceb = WorldForce(resolve_frame=:frame_b) body = BodyShape(r=[1,0,0], state=true, isroot=true, quat=false, neg_w=true) @@ -162,7 +162,7 @@ sol = solve(prob, Tsit5(), reltol=1e-8) # ============================================================================== @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() forcea = WorldForce(resolve_frame=:frame_b) forceb = WorldForce(resolve_frame=:frame_b) body = BodyCylinder(r=[1,0,0], state=true, isroot=true, quat=false, neg_w=true, density=1, diameter=0.1) @@ -202,7 +202,7 @@ sol = solve(prob, Tsit5(), reltol=1e-8) using LinearAlgebra @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() forcea = WorldForce(resolve_frame=:frame_b, radius=0.15, scale=0.2) forceb = WorldForce(resolve_frame=:frame_b, radius=0.15, scale=0.2) b0 = Body(m=1e-32, I_11=1e-32, I_22=1e-32, I_33=1e-32, state_priority=0, radius=0.14, color=[1,0,0,0.5]) @@ -244,7 +244,7 @@ sol = solve(prob, Rodas4(), reltol=1e-8) # ============================================================================== @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() forcea = WorldForce(resolve_frame=:frame_b, radius=0.15, scale=0.2) forceb = WorldForce(resolve_frame=:frame_b, radius=0.15, scale=0.2) b0 = Body(m=1e-32, I_11=1e-32, I_22=1e-32, I_33=1e-32, state_priority=0, radius=0.14, color=[1,0,0,0.5]) @@ -289,7 +289,7 @@ sol = solve(prob, Tsit5(), abstol=1e-8, reltol=1e-8) # ============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() forcea = WorldForce(resolve_frame=:frame_b) forceb = WorldForce(resolve_frame=:frame_b) b0 = Body(m=1, state_priority=0, radius=0.1, color=[0,0,1,0.2]) @@ -325,7 +325,7 @@ reshape(sol(1, idxs = [testwf.forceb.frame_b.f; testwf.forcea.frame_b.f; testwf. @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() forcea = WorldForce(resolve_frame=:frame_b) forceb = WorldForce(resolve_frame=:frame_b) b0 = Body(m=1, state_priority=0, radius=0.1, color=[0,0,1,0.2]) @@ -358,7 +358,7 @@ sol = solve(prob, Tsit5()) @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() forcea = WorldForce(resolve_frame=:frame_b) forceb = WorldForce(resolve_frame=:frame_b) body = Body(m=1, state=true, isroot=true, quat=false, radius=0.05, color=[1,0,0,1]) @@ -392,7 +392,7 @@ sol = solve(prob, Tsit5()) # ============================================================================== @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() forcea = WorldForce(resolve_frame=:frame_b) forceb = WorldForce(resolve_frame=:frame_b) b0 = Body(m=1, state_priority=0) @@ -444,7 +444,7 @@ sol(1, idxs=testwf.b0.w_a) # This works with both quat and Euler @mtkmodel TestWorldForce begin @components begin - world = W() + world = World() freemotion = FreeMotion(state=true, isroot=true, quat=false) forcea = WorldForce(resolve_frame=:frame_b) forceb = WorldForce(resolve_frame=:frame_b)