Skip to content

Commit 807b454

Browse files
committed
situations where a 2d mpr would be needed
1 parent 885cdb3 commit 807b454

File tree

5 files changed

+207
-3
lines changed

5 files changed

+207
-3
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
module LineLineSimulation
2+
3+
using Modia3D
4+
5+
vmatRed = VisualMaterial(color="Red")
6+
vmatGreen = VisualMaterial(color="Green")
7+
vmatBlue = VisualMaterial(color="Blue")
8+
vmatGrey = VisualMaterial(color="Grey", transparency=0.5)
9+
10+
LineLine = Model3D(
11+
boxHeigth = 0.1,
12+
gravField = UniformGravityField(g=9.81, n=[0, 0, -1]),
13+
world = Object3D(feature=Scene(gravityField=:gravField,
14+
visualizeFrames=false,
15+
defaultFrameLength=0.2,
16+
visualizeBoundingBox = true,
17+
enableContactDetection=true,
18+
visualizeContactPoints=false)),
19+
worldFrame = Object3D(parent=:world, feature=Visual(shape=CoordinateSystem(length=0.5))),
20+
ground = Object3D(parent=:world,
21+
translation=:[0.0, 0.0, 0.0],
22+
feature=Solid(shape=Box(lengthX=5.0, lengthY=0.0, lengthZ=0.0),
23+
visualMaterial=vmatGrey,
24+
solidMaterial="Steel",
25+
massProperties = MassProperties(mass = 12000.0),
26+
collision=true)),
27+
frameX = Object3D(parent=:world,
28+
translation=:[0.0, 0.0, 1.0],
29+
rotation=:[0.0, 0*u"°", 0.0], # [-90*u"°", 0.0, -90*u"°"],
30+
feature=Visual(shape=CoordinateSystem(length=0.5))),
31+
capsuleX = Object3D(feature=Solid(shape=Box(lengthX=0.0, lengthY = 0.0, lengthZ = 3.0),
32+
visualMaterial=vmatRed,
33+
solidMaterial="Steel",
34+
massProperties = MassProperties(mass = 1273.39, Ixx = 24.39551415267595, Iyy = 185.24505801647337, Izz = 185.24505801647337, Ixy = 0.0, Ixz = 0.0, Iyz = 0.0),
35+
collision=true)),
36+
jointX = FreeMotion(obj1=:frameX, obj2=:capsuleX,
37+
r=Var(init=Modia.SVector{3,Float64}(0.0, 0.0, 0.0)),
38+
rot=Var(init=Modia.SVector{3,Float64}(0.0, 0.0, 0.0)),
39+
v=Var(init=Modia.SVector{3,Float64}(0.0, 1.0, 0.0)))
40+
)
41+
42+
lineLine = @instantiateModel(LineLine, unitless=true, log=false, logStateSelection=false, logCode=false)
43+
44+
45+
stopTime = 1.0
46+
tolerance = 1e-8
47+
requiredFinalStates = missing
48+
simulate!(lineLine, stopTime=stopTime, tolerance=tolerance, log=true, logStates=false, logEvents=false, requiredFinalStates=requiredFinalStates)
49+
50+
end
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
module LineLineSimulation
2+
3+
using Modia3D
4+
5+
vmatRed = VisualMaterial(color="Red")
6+
vmatGreen = VisualMaterial(color="Green")
7+
vmatBlue = VisualMaterial(color="Blue")
8+
vmatGrey = VisualMaterial(color="Grey", transparency=0.5)
9+
10+
LineLine = Model3D(
11+
boxHeigth = 0.1,
12+
gravField = UniformGravityField(g=9.81, n=[0, 0, -1]),
13+
world = Object3D(feature=Scene(gravityField=:gravField,
14+
visualizeFrames=false,
15+
defaultFrameLength=0.2,
16+
visualizeBoundingBox = true,
17+
enableContactDetection=true,
18+
visualizeContactPoints=false)),
19+
worldFrame = Object3D(parent=:world, feature=Visual(shape=CoordinateSystem(length=0.5))),
20+
ground = Object3D(parent=:world,
21+
translation=:[0.0, 0.0, 0.0],
22+
feature=Solid(shape=Box(lengthX=5.0, lengthY=0.0, lengthZ=0.0),
23+
visualMaterial=vmatGrey,
24+
solidMaterial="Steel",
25+
massProperties = MassProperties(mass = 12000.0),
26+
collision=true)),
27+
frameX = Object3D(parent=:world,
28+
translation=:[0.1, 0.0001, 0.0],
29+
rotation=:[0.0, 0.0, 0.0], # [-90*u"°", 0.0, -90*u"°"],
30+
feature=Visual(shape=CoordinateSystem(length=0.5))),
31+
capsuleX = Object3D(feature=Solid(shape=Box(lengthX=3.0, lengthY = 0.0, lengthZ = 0.0),
32+
visualMaterial=vmatRed,
33+
solidMaterial="Steel",
34+
massProperties = MassProperties(mass = 1273.39, Ixx = 24.39551415267595, Iyy = 185.24505801647337, Izz = 185.24505801647337, Ixy = 0.0, Ixz = 0.0, Iyz = 0.0),
35+
collision=true)),
36+
jointX = FreeMotion(obj1=:frameX, obj2=:capsuleX,
37+
r=Var(init=Modia.SVector{3,Float64}(0.0, 0.0, 0.0)),
38+
rot=Var(init=Modia.SVector{3,Float64}(0.0, 0.0, 0.0)),
39+
v=Var(init=Modia.SVector{3,Float64}(0.0, 1.0, 0.0)))
40+
)
41+
42+
lineLine = @instantiateModel(LineLine, unitless=true, log=false, logStateSelection=false, logCode=false)
43+
44+
45+
stopTime = 0.0
46+
tolerance = 1e-8
47+
requiredFinalStates = missing
48+
simulate!(lineLine, stopTime=stopTime, tolerance=tolerance, log=true, logStates=false, logEvents=false, requiredFinalStates=requiredFinalStates)
49+
50+
end
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
module LineLineSimulation
2+
3+
using Modia3D
4+
5+
vmatRed = VisualMaterial(color="Red")
6+
vmatGreen = VisualMaterial(color="Green")
7+
vmatBlue = VisualMaterial(color="Blue")
8+
vmatGrey = VisualMaterial(color="Grey", transparency=0.5)
9+
10+
LineLine = Model3D(
11+
boxHeigth = 0.1,
12+
gravField = UniformGravityField(g=9.81, n=[0, 0, -1]),
13+
world = Object3D(feature=Scene(gravityField=:gravField,
14+
visualizeFrames=false,
15+
defaultFrameLength=0.2,
16+
visualizeBoundingBox = true,
17+
enableContactDetection=true,
18+
visualizeContactPoints=false)),
19+
worldFrame = Object3D(parent=:world, feature=Visual(shape=CoordinateSystem(length=0.5))),
20+
ground = Object3D(parent=:world,
21+
translation=:[0.0, 0.0, 0.0],
22+
feature=Solid(shape=Box(lengthX=5.0, lengthY=3.0, lengthZ=0.0),
23+
visualMaterial=vmatGrey,
24+
solidMaterial="Steel",
25+
massProperties = MassProperties(mass = 12000.0),
26+
collision=true)),
27+
frameX = Object3D(parent=:world,
28+
translation=:[0.1, 0.1, 0.0],
29+
rotation=:[0.0, 0.0, 0.0], # [-90*u"°", 0.0, -90*u"°"],
30+
feature=Visual(shape=CoordinateSystem(length=0.5))),
31+
capsuleX = Object3D(feature=Solid(shape=Sphere(diameter = 0.0),
32+
visualMaterial=vmatRed,
33+
solidMaterial="Steel",
34+
massProperties = MassProperties(mass = 1273.39, Ixx = 24.39551415267595, Iyy = 185.24505801647337, Izz = 185.24505801647337, Ixy = 0.0, Ixz = 0.0, Iyz = 0.0),
35+
collision=true)),
36+
jointX = FreeMotion(obj1=:frameX, obj2=:capsuleX,
37+
r=Var(init=Modia.SVector{3,Float64}(0.0, 0.0, 0.0)),
38+
rot=Var(init=Modia.SVector{3,Float64}(0.0, 0.0, 0.0)),
39+
v=Var(init=Modia.SVector{3,Float64}(0.0, 1.0, 0.0)))
40+
)
41+
42+
lineLine = @instantiateModel(LineLine, unitless=true, log=false, logStateSelection=false, logCode=false)
43+
44+
45+
stopTime = 0.0
46+
tolerance = 1e-8
47+
requiredFinalStates = missing
48+
simulate!(lineLine, stopTime=stopTime, tolerance=tolerance, log=true, logStates=false, logEvents=false, requiredFinalStates=requiredFinalStates)
49+
50+
end
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
module PlanePlaneSimulation
2+
3+
using Modia3D
4+
5+
vmatRed = VisualMaterial(color="Red")
6+
vmatGreen = VisualMaterial(color="Green")
7+
vmatBlue = VisualMaterial(color="Blue")
8+
vmatGrey = VisualMaterial(color="Grey", transparency=0.5)
9+
10+
PlanePlane = Model3D(
11+
boxHeigth = 0.1,
12+
gravField = UniformGravityField(g=9.81, n=[0, 0, -1]),
13+
world = Object3D(feature=Scene(gravityField=:gravField,
14+
visualizeFrames=false,
15+
defaultFrameLength=0.2,
16+
visualizeBoundingBox = true,
17+
enableContactDetection=true,
18+
visualizeContactPoints=false)),
19+
worldFrame = Object3D(parent=:world, feature=Visual(shape=CoordinateSystem(length=0.5))),
20+
ground = Object3D(parent=:world,
21+
translation=:[0.0, 0.0, 0.0],
22+
feature=Solid(shape=Box(lengthX=5.0, lengthY=3.0, lengthZ=0.0),
23+
visualMaterial=vmatGrey,
24+
solidMaterial="Steel",
25+
massProperties = MassProperties(mass = 12000.0),
26+
collision=true)),
27+
frameX = Object3D(parent=:world,
28+
translation=:[-2.0, -1.0, 0.0],
29+
rotation=:[0.0, 0.0, 0.0], # [-90*u"°", 0.0, -90*u"°"],
30+
feature=Visual(shape=CoordinateSystem(length=0.5))),
31+
capsuleX = Object3D(feature=Solid(shape=Box(lengthX=1.0, lengthY = 0.7, lengthZ = 0.0),
32+
visualMaterial=vmatRed,
33+
solidMaterial="Steel",
34+
massProperties = MassProperties(mass = 1273.39, Ixx = 24.39551415267595, Iyy = 185.24505801647337, Izz = 185.24505801647337, Ixy = 0.0, Ixz = 0.0, Iyz = 0.0),
35+
collision=true)),
36+
jointX = FreeMotion(obj1=:frameX, obj2=:capsuleX,
37+
r=Var(init=Modia.SVector{3,Float64}(0.0, 0.0, 0.0)),
38+
rot=Var(init=Modia.SVector{3,Float64}(0.0, 0.0, 0.0)),
39+
v=Var(init=Modia.SVector{3,Float64}(0.0, 1.0, 0.0)))
40+
)
41+
42+
planePlane = @instantiateModel(PlanePlane, unitless=true, log=false, logStateSelection=false, logCode=false)
43+
44+
45+
stopTime = 0.0
46+
tolerance = 1e-8
47+
requiredFinalStates = missing
48+
simulate!(planePlane, stopTime=stopTime, tolerance=tolerance, log=true, logStates=false, logEvents=false, requiredFinalStates=requiredFinalStates)
49+
50+
end

test/includeTests.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import Test
22

3-
Modia3D.loadPalettes!(solidMaterialPalette = "$(Modia3D.path)/palettes/solidMaterials.json",
3+
Modia3D.loadPalettes!(solidMaterialPalette = "$(Modia3D.path)/palettes/solidMaterials.json",
44
contactPairMaterialPalette = "$(Modia3D.path)/palettes/contactPairMaterials.json",
5-
visualMaterialPalette = "$(Modia3D.path)/palettes/visualMaterials.json")
6-
5+
visualMaterialPalette = "$(Modia3D.path)/palettes/visualMaterials.json")
6+
77
Test.@testset "Basic" begin
88
include(joinpath("Basic", "AllShapes.jl"))
99
include(joinpath("Basic", "PendulumWithBar1.jl"))
@@ -72,6 +72,10 @@ Test.@testset "Collision" begin
7272
include(joinpath("Collision", "BouncingBeams.jl"))
7373
Test.@test_skip include(joinpath("Collision", "CollidingSphereWithBunnies.jl")) # Error on Linux too large
7474
include(joinpath("Collision", "Billard4Balls.jl"))
75+
Test.@test_throws LoadError include(joinpath("Collision", "OrthogonalLinesError.jl")) # orthogonal lines moving until r_abs is NaN
76+
Test.@test_throws LoadError include(joinpath("Collision", "ParallelLinesError.jl")) # MPR 2D not implemented
77+
Test.@test_throws LoadError include(joinpath("Collision", "PlaneVsPlaneEdgesError.jl")) # MPR 2D not implemented
78+
Test.@test_throws LoadError include(joinpath("Collision", "PlaneVSPointError.jl")) # MPR 2D not implemented
7579
end
7680
if testsExtend == completeTests
7781
include(joinpath("Collision", "Billard16Balls.jl")) # long computation time

0 commit comments

Comments
 (0)