From fcd38b34d5319640d69187882c2ba816545697f5 Mon Sep 17 00:00:00 2001 From: Gerhard Hippmann Date: Wed, 22 Nov 2023 09:43:22 +0100 Subject: [PATCH 1/3] Fix position/orientation results - Enable position and orientation result signals for all user-defined Object3Ds, independently of visualisation/animation configuration - Replace orientation result matrix R_abs -> Cardan angles rot123_abs --- docs/src/index.md | 1 + docs/src/internal/Profiling.md | 12 ++--- src/AnimationExport/exportAnimation.jl | 17 ++---- src/Composition/assignObjects.jl | 53 ++++++++++--------- src/Composition/dynamics.jl | 39 +++++++------- src/Composition/handler.jl | 42 ++++++++------- src/Composition/object3D.jl | 27 ++++++---- src/Composition/printObject3D.jl | 2 +- src/Composition/scene.jl | 14 ++--- src/Composition/superObjects.jl | 8 +-- src/ModiaInterface/buildModel3D.jl | 12 ++--- src/renderer/DLR_Visualization/handler.jl | 11 +--- src/renderer/NoRenderer/handler.jl | 3 -- test/Basic/Pendulum.jl | 2 +- test/Collision/NewtonsCradle.jl | 9 +++- test/Robot/ScenarioCollisionOnly.jl | 27 +++------- .../ScenarioSegmentedCollisionOff.jl | 26 ++++----- .../Segmented/ScenarioSegmentedCollisionOn.jl | 26 ++++----- test/Segmented/ScenarioSegmentedOnly.jl | 24 ++++----- test/Segmented/TwoStageRocket3D.jl | 1 + 20 files changed, 164 insertions(+), 192 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index 6ce2339c..50b9ca3b 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -99,6 +99,7 @@ julia -JModia3D_sysimage.so (otherwise) - Add Result Element infrastructure and Result Element ContactResult - Bugfix: Correct parent Object3D torque calculation for Fix Joint with non-zero rotation - Bugfix: Enable AnimationExport in case of no renderer available +- Bugfix: Enable position/orientation result signals independent of visualization/animation configuration ### Version 0.12.1 diff --git a/docs/src/internal/Profiling.md b/docs/src/internal/Profiling.md index d69a06fa..26c94136 100644 --- a/docs/src/internal/Profiling.md +++ b/docs/src/internal/Profiling.md @@ -63,7 +63,7 @@ see next section. ## logTiming Function `simulate!(..., logTiming=true, ...)` has keyword argument `logTiming`. When set to true, -the result of the `@timeit` macro of the [TimerOutputs](https://github.com/KristofferC/TimerOutputs.jl) package is shown. Function `simulate!(..)` and `Modia3D` are instrumented with this timer. +the result of the `@timeit` macro of the [TimerOutputs](https://github.com/KristofferC/TimerOutputs.jl) package is shown. Function `simulate!(..)` and `Modia3D` are instrumented with this timer. Example: ```julia @@ -164,16 +164,16 @@ is the following: 1. `1.363270 seconds` is the time for the first evaluation of `getDerivatives!`. This time is nearly completely used for compilation of this function - + 2. `0.002773 seconds` is the time for the second evaluation of `getDerivatives!`. This time is nearly irrelevant for the timing of `@instantiateModel.` - + 3. `2.540190` seconds is the total time spent in `@instantiateModel`, including the two calls of `getDerivatives!`. This time, together with (1.) shows the following: - `0.47*2.5 = 1.1` seconds are used to process the model, generate `getDerivatives!` and process `getDerivatives!` twice. - `0.53*2.5 = 1.32` seconds are used to compile `getDerivatives!`. - + The meaning of column `Section` is the following: @@ -208,8 +208,8 @@ The meaning of column `Section` is the following: | `Modia3D_2 computeKinematics!` | Time to compute accelerations with qdd = unit vector. | | `Modia3D_2 computeForcesAndResiduals` | Time to compute forces/torques/residuals for M(q)*qdd. | | `Modia3D_3` | Time of `leq_mode == -1`. | -| `Modia3D_3 visualize!` | Time of `for obj in updateVisuElements ... visualize(..)`. | -| `Modia3D_3 exportAnimation` | Time of `for obj in allVisuElements ... push!(objectData, dat)` | +| `Modia3D_3 visualize!` | Time of `for obj in visualObject3Ds ... visualize(..)`. | +| `Modia3D_3 exportAnimation` | Time of `for obj in visualObject3Ds ... push!(objectData, dat)` | | `Modia3D_4 isTerminal` | Time of `exportAnimation` and `closeVisualization` during termination. | diff --git a/src/AnimationExport/exportAnimation.jl b/src/AnimationExport/exportAnimation.jl index 0ecf3061..bcba1d4f 100644 --- a/src/AnimationExport/exportAnimation.jl +++ b/src/AnimationExport/exportAnimation.jl @@ -436,8 +436,8 @@ end function exportAnimation(scene) - allVisuElements = scene.allVisuElements - if scene.exportAnimation && length(allVisuElements) > 0 + visualObject3Ds = scene.visualObject3Ds + if scene.exportAnimation && length(visualObject3Ds) > 0 animationFile = scene.options.animationFile (head,ext) = splitext(animationFile) if ext != ".json" @@ -467,7 +467,7 @@ function exportAnimation(scene) if !isnothing(animation) && length(animation) != 0 iobj = 0 tracks = [] - for obj in allVisuElements + for obj in visualObject3Ds iobj = iobj + 1 (r_obj, R_obj) = printObjectToJSON(object, elements, obj, initPos=animation[1].objectData[iobj].position, initRot=Modia3D.from_q(animation[1].objectData[iobj].quaternion)) if !isnothing(R_obj) @@ -478,7 +478,7 @@ function exportAnimation(scene) animations = [(; name="Simulation", uuid=uuid, tracks)] scene = (; metadata, elements.geometries, elements.materials, elements.shapes, object, animations) else - for obj in allVisuElements + for obj in visualObject3Ds (r_obj, R_obj) = printObjectToJSON(object, elements, obj) end scene = (; metadata, elements.geometries, elements.materials, elements.shapes, object) @@ -491,12 +491,3 @@ function exportAnimation(scene) println("done.") end end - - -function Composition.isVisible(feature::Shapes.Solid{F}, exportAnimation::Bool) where F <: Modia3D.VarFloatType - return exportAnimation && !isnothing(feature.shape) && !isnothing(feature.visualMaterial) -end - -function Composition.isVisible(feature::Shapes.Visual, exportAnimation::Bool) - return exportAnimation && !isnothing(feature.visualMaterial) && !isnothing(feature.shape) -end diff --git a/src/Composition/assignObjects.jl b/src/Composition/assignObjects.jl index c510dc7e..a804728d 100644 --- a/src/Composition/assignObjects.jl +++ b/src/Composition/assignObjects.jl @@ -1,5 +1,6 @@ assignObj(scene, superObjType, obj, actPos) = nothing +# assign obj to superObjType.superObj in case it can collide function assignObj(scene::Scene{F}, superObjType::SuperObjCollision{F}, obj::Object3D{F}, actPos::Int64)::Nothing where F <: Modia3D.VarFloatType if canCollide(obj) push!(superObjType.superObj, obj) @@ -7,6 +8,7 @@ function assignObj(scene::Scene{F}, superObjType::SuperObjCollision{F}, obj::Obj return nothing end +# assign obj to superObjType.superObj in case it has mass function assignObj(scene::Scene{F}, superObjType::SuperObjMass{F}, obj::Object3D{F}, actPos::Int64)::Nothing where F <: Modia3D.VarFloatType if featureHasMass(obj) push!(superObjType.superObj, obj) @@ -14,6 +16,7 @@ function assignObj(scene::Scene{F}, superObjType::SuperObjMass{F}, obj::Object3D return nothing end +# assign obj to superObjType.superObj in case it can be moved function assignObj(scene::Scene{F}, superObjType::SuperObjMovable{F}, obj::Object3D{F}, actPos::Int64)::Nothing where F <: Modia3D.VarFloatType if isMovable(obj) push!(superObjType.superObj, obj) @@ -26,6 +29,7 @@ function assignObj(scene::Scene{F}, superObjType::SuperObjMovable{F}, obj::Objec return nothing end +# assign obj to superObjType.superObj in case it can apply force/torque function assignObj(scene::Scene{F}, superObjType::SuperObjForce{F}, obj::Object3D{F}, actPos::Int64)::Nothing where F <: Modia3D.VarFloatType if canCollide(obj) || hasJoint(obj) || hasForceElement(obj) push!(superObjType.superObj, obj) @@ -33,49 +37,48 @@ function assignObj(scene::Scene{F}, superObjType::SuperObjForce{F}, obj::Object3 return nothing end -function assignObj(scene::Scene{F}, superObjType::SuperObjVisu{F}, obj::Object3D{F}, actPos::Int64)::Nothing where F <: Modia3D.VarFloatType - renderer = Modia3D.renderer[1] - if ( isVisible(obj, renderer) || isVisible(obj, scene.exportAnimation) || !isnothing(obj.visualizationFrame) ) && !hasJoint(obj) && !canCollide(obj) && !hasForceElement(obj) && !hasChildJoint(obj) #&& !hasCutJoint(obj) && !featureHasMass(obj) - # if an Object3D is for visualization/animation export only it is stored in updateVisuElements - if !(obj in scene.updateVisuElements) - push!(scene.updateVisuElements, obj) +# assign obj to scene.pureResultObject3Ds in case it is pure result or visualization +function assignObj(scene::Scene{F}, superObjType::SuperObjResult{F}, obj::Object3D{F}, actPos::Int64)::Nothing where F <: Modia3D.VarFloatType + if ( isUserDefined(obj) || isVisible(obj) || length(obj.visualizationFrame) > 0 ) && !hasJoint(obj) && !canCollide(obj) && !hasForceElement(obj) && !hasChildJoint(obj) #&& !hasCutJoint(obj) && !featureHasMass(obj) + if !(obj in scene.pureResultObject3Ds) + push!(scene.pureResultObject3Ds, obj) end end return nothing end - +# assign obj to field vectors of superObj function assignAll(scene::Scene{F}, superObj::SuperObjsRow{F}, obj::Object3D{F}, world::Object3D{F}, actPos::Int64)::Nothing where F <: Modia3D.VarFloatType names = fieldnames(typeof(superObj)) for val in names - tmp = getfield(superObj,val) + tmp = getfield(superObj, val) obj.interactionManner.originPos = actPos - assignObj(scene,tmp,obj,actPos) + assignObj(scene, tmp, obj, actPos) end return nothing end function fillVisuElements!(scene::Scene{F}, obj::Object3D{F}, world::Object3D{F})::Nothing where F <: Modia3D.VarFloatType - if scene.options.enableVisualization || scene.provideAnimationData - if isNotCoordinateSystem(obj) && obj.visualizeFrame != Modia3D.False && - ((scene.options.visualizeFrames && obj.visualizeFrame == Modia3D.Inherited) || obj.visualizeFrame == Modia3D.True) - name = Symbol(obj.path, ".", "visualizationFrame") - if obj != world - addObject3DVisualizationFrame!(obj, scene.autoCoordsys, name) - else - addObject3DVisualizationFrame!(obj, Shapes.CoordinateSystem(length=2*scene.options.defaultFrameLength), name) - end - append!(scene.allVisuElements, obj.visualizationFrame) - # if an Object3D is for visualization only it is stored in updateVisuElements - if !(obj in scene.updateVisuElements) - push!(scene.updateVisuElements, obj) - end + if isNotCoordinateSystem(obj) && obj.visualizeFrame != Modia3D.False && + ((scene.options.visualizeFrames && obj.visualizeFrame == Modia3D.Inherited) || obj.visualizeFrame == Modia3D.True) + name = Symbol(obj.path, ".", "visualizationFrame") + if obj != world + addObject3DVisualizationFrame!(obj, scene.autoCoordsys, name) + else + addObject3DVisualizationFrame!(obj, Shapes.CoordinateSystem(length=2*scene.options.defaultFrameLength), name) end - if isVisible(obj, Modia3D.renderer[1]) || isVisible(obj, scene.exportAnimation) # visible in visualization or animation export - push!(scene.allVisuElements, obj) + append!(scene.visualObject3Ds, obj.visualizationFrame) + if !(obj in scene.pureResultObject3Ds) + push!(scene.pureResultObject3Ds, obj) end end + if isVisible(obj) + push!(scene.visualObject3Ds, obj) + end + if isUserDefined(obj) + push!(scene.userDefinedObject3Ds, obj) + end return nothing end diff --git a/src/Composition/dynamics.jl b/src/Composition/dynamics.jl index 32dad67e..d0c28209 100644 --- a/src/Composition/dynamics.jl +++ b/src/Composition/dynamics.jl @@ -202,17 +202,13 @@ function initSegment_Model3D!(partiallyInstantiatedModel::Modia.InstantiatedMode zStartIndex = 0 end + # add r_abs and rot123_abs of all user-defined Object3Ds to results # objIndices[i,1]: Index of r_abs of Object3D i - # [i,2]: Index of R_abs of Object3D i - objIndices = Matrix{Int}(undef, length(scene.updateVisuElements), 2) - for (i,obj) in enumerate(scene.updateVisuElements) - if typeof(obj.feature) == Modia3D.Composition.EmptyObject3DFeature - objIndices[i,1] = 0 - objIndices[i,2] = 0 - else - objIndices[i,1] = Modia.new_w_segmented_variable!(partiallyInstantiatedModel, obj.path*".r_abs", Modia3D.ZeroVector3D(F), "m") - objIndices[i,2] = Modia.new_w_segmented_variable!(partiallyInstantiatedModel, obj.path*".R_abs", Modia3D.NullRotation(F), "") - end + # [i,2]: Index of rot123_abs of Object3D i + objIndices = Matrix{Int}(undef, length(scene.userDefinedObject3Ds), 2) + for (i,obj) in enumerate(scene.userDefinedObject3Ds) + objIndices[i,1] = Modia.new_w_segmented_variable!(partiallyInstantiatedModel, obj.path*".r_abs", Modia3D.ZeroVector3D(F), "m") + objIndices[i,2] = Modia.new_w_segmented_variable!(partiallyInstantiatedModel, obj.path*".rot123_abs", Modia3D.ZeroVector3D(F), "rad") end mbsBuild.mbs = MultibodyData{F,TimeType}(partiallyInstantiatedModel, modelPath, world, scene, @@ -233,7 +229,7 @@ function initSegment_Model3D!(partiallyInstantiatedModel::Modia.InstantiatedMode if scene.visualize && firstSegment TimerOutputs.@timeit partiallyInstantiatedModel.timer "Modia3D_0 initializeVisualization" Modia3D.Composition.initializeVisualization(Modia3D.renderer[1], scene) if partiallyInstantiatedModel.options.log - println( " Modia3D: nVisualShapes = ", length(scene.allVisuElements)) + println( " Modia3D: nVisualShapes = ", length(scene.visualObject3Ds)) if scene.options.enableContactDetection println(" mprTolerance = ", scene.options.contactDetection.tol_rel) println(" contact_eps = ", scene.options.contactDetection.contact_eps) @@ -557,19 +553,13 @@ function computeGeneralizedForces!(mbs::MultibodyData{F,TimeType}, qdd_hidden::V elseif leq_mode == -2 # Compute only terms needed at a communication point (currently: Only visualization + export animation) TimerOutputs.@timeit instantiatedModel.timer "Modia3D_3" begin - # objects can have interactionManner (need to rename updateVisuElements) + # objects can have interactionManner if scene.options.useOptimizedStructure - objIndices = mbs.objIndices - for (i,obj) in enumerate(scene.updateVisuElements) + for obj in scene.pureResultObject3Ds parent = obj.parent obj.r_abs = obj.r_rel ≡ Modia3D.ZeroVector3D(F) ? parent.r_abs : parent.r_abs + parent.R_abs'*obj.r_rel obj.R_abs = obj.R_rel ≡ Modia3D.NullRotation(F) ? parent.R_abs : obj.R_rel*parent.R_abs - if objIndices[i,1] > 0 - Modia.copy_w_segmented_value_to_result(instantiatedModel, objIndices[i,1], obj.r_abs) - Modia.copy_w_segmented_value_to_result(instantiatedModel, objIndices[i,2], obj.R_abs) - end - # is executed only if an internal Object3D called if length( obj.visualizationFrame ) == 1 obj.visualizationFrame[1].r_abs = obj.r_abs @@ -583,6 +573,15 @@ function computeGeneralizedForces!(mbs::MultibodyData{F,TimeType}, qdd_hidden::V end if storeResult && !isTerminalOfAllSegments + # copy r_abs and rot123_abs of all user-defined Object3Ds to results + objIndices = mbs.objIndices + for (i, obj) in enumerate(scene.userDefinedObject3Ds) + if objIndices[i,1] > 0 + Modia.copy_w_segmented_value_to_result(instantiatedModel, objIndices[i,1], obj.r_abs) + Modia.copy_w_segmented_value_to_result(instantiatedModel, objIndices[i,2], Modia3D.rot123fromR(obj.R_abs)) + end + end + # evaluate result elements for result in resultElements evaluateResultElement(instantiatedModel, scene, result, time) @@ -606,7 +605,7 @@ function computeGeneralizedForces!(mbs::MultibodyData{F,TimeType}, qdd_hidden::V if provideAnimationData TimerOutputs.@timeit instantiatedModel.timer "Modia3D_3 provideAnimationData" begin objectData = [] - for obj in scene.allVisuElements + for obj in scene.visualObject3Ds pos = Modia3D.convertToFloat64(obj.r_abs) ori = Modia3D.from_R(Modia3D.convertToFloat64(obj.R_abs)) dat = animationData(pos, ori) diff --git a/src/Composition/handler.jl b/src/Composition/handler.jl index 11f15e43..971c46aa 100644 --- a/src/Composition/handler.jl +++ b/src/Composition/handler.jl @@ -7,12 +7,14 @@ function build_tree!(scene::Scene{F}, world::Object3D{F})::Nothing where F <: Modia3D.VarFloatType - tree = scene.tree - stack = scene.stack + tree = scene.tree + stack = scene.stack allCollisionElements = scene.allCollisionElements empty!(tree) empty!(stack) - empty!(scene.allVisuElements) + empty!(scene.userDefinedObject3Ds) + empty!(scene.visualObject3Ds) + empty!(scene.pureResultObject3Ds) empty!(allCollisionElements) fillVisuElements!(scene, world, world) @@ -186,8 +188,10 @@ function build_superObjs!(scene::Scene{F}, world::Object3D{F})::Nothing where F treeAccVelo = scene.treeAccVelo empty!(stack) empty!(buffer) - empty!(scene.allVisuElements) empty!(treeAccVelo) + empty!(scene.userDefinedObject3Ds) + empty!(scene.visualObject3Ds) + empty!(scene.pureResultObject3Ds) world.computeAcceleration = true world.isRootObj = true # all objs stored in buffer are root objs @@ -434,19 +438,19 @@ function chooseAndBuildUpTree(world::Object3D{F}, scene::Scene{F}) where F <: Mo if scene.options.enableContactDetection && scene.collide initializeContactDetection!(world, scene) if length(world.contactVisuObj1) > 0 - append!(scene.allVisuElements, world.contactVisuObj1) - append!(scene.allVisuElements, world.contactVisuObj2) + append!(scene.visualObject3Ds, world.contactVisuObj1) + append!(scene.visualObject3Ds, world.contactVisuObj2) end if length(world.supportVisuObj1A) > 0 - append!(scene.allVisuElements, world.supportVisuObj1A) - append!(scene.allVisuElements, world.supportVisuObj2A) - append!(scene.allVisuElements, world.supportVisuObj3A) - append!(scene.allVisuElements, world.supportVisuObj1B) - append!(scene.allVisuElements, world.supportVisuObj2B) - append!(scene.allVisuElements, world.supportVisuObj3B) + append!(scene.visualObject3Ds, world.supportVisuObj1A) + append!(scene.visualObject3Ds, world.supportVisuObj2A) + append!(scene.visualObject3Ds, world.supportVisuObj3A) + append!(scene.visualObject3Ds, world.supportVisuObj1B) + append!(scene.visualObject3Ds, world.supportVisuObj2B) + append!(scene.visualObject3Ds, world.supportVisuObj3B) end if length(world.AABBVisu) > 0 - append!(scene.allVisuElements, world.AABBVisu) + append!(scene.visualObject3Ds, world.AABBVisu) end end initializeMassComputation!(scene) @@ -463,7 +467,7 @@ function chooseAndBuildUpTree(world::Object3D{F}, scene::Scene{F}) where F <: Mo scene.visualize = false scene.exportAnimation = false else - if length(scene.allVisuElements) > 0 + if length(scene.visualObject3Ds) > 0 scene.visualize = scene.options.enableVisualization else scene.visualize = false @@ -503,13 +507,13 @@ end function emptyScene!(scene::Scene{F})::Nothing where F <: Modia3D.VarFloatType empty!(scene.stack) empty!(scene.buffer) - empty!(scene.superObjs) - empty!(scene.updateVisuElements) + empty!(scene.userDefinedObject3Ds) + empty!(scene.visualObject3Ds) + empty!(scene.pureResultObject3Ds) + empty!(scene.allCollisionElements) empty!(scene.treeAccVelo) empty!(scene.tree) - empty!(scene.allVisuElements) - empty!(scene.allCollisionElements) empty!(scene.noCPairs) empty!(scene.noCPairsHelp) empty!(scene.allowedToMove) @@ -527,7 +531,7 @@ end function closeAnalysis!(scene::Scene{F})::Nothing where F <: Modia3D.VarFloatType # Close Visualisation closeVisualization(Modia3D.renderer[1]) - empty!(scene.allVisuElements) + empty!(scene.visualObject3Ds) scene.visualize = false # Close Collision detection if scene.collide diff --git a/src/Composition/object3D.jl b/src/Composition/object3D.jl index 1a3dc6f8..04178f3b 100644 --- a/src/Composition/object3D.jl +++ b/src/Composition/object3D.jl @@ -155,6 +155,7 @@ mutable struct Object3D{F <: Modia3D.VarFloatType} <: Modia3D.AbstractObject3D # Additional information associated with Object3D feature::Union{Modia3D.AbstractObject3DFeature, Modia3D.AbstractScene} # Optional feature associated with Object3D twoObject3Dobject::Vector{Modia3D.AbstractTwoObject3DObject} # Optional AbstractTwoObject3DObject object associated with Object3D + isUserDefined::Bool # true if defined by the user (i.e. no internally generated visualization frame, contact/support point, bounding box, convex partition member object) hasCutJoint::Bool # true if it has a cut joint hasForceElement::Bool # true if it has a force element hasChildJoint::Bool # true if its child has a joint @@ -269,7 +270,7 @@ mutable struct Object3D{F <: Modia3D.VarFloatType} <: Modia3D.AbstractObject3D Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), false, F(0.0), Modia3D.ZeroVector3D(F), SMatrix{3,3,F,9}(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), feature, Modia3D.AbstractTwoObject3DObject[], - false, false, false, false, + true, false, false, false, false, shapeKind, shape, visualMaterial, centroid, visualizeFrame2, Vector{Object3D{F}}[], @@ -295,9 +296,10 @@ mutable struct Object3D{F <: Modia3D.VarFloatType} <: Modia3D.AbstractObject3D end # obj = Object3D{F}(feature, visualizeFrame=visualizeFrame, path=path) - obj = Object3DWithoutParent(new(), visualizeFrame = visualizeFrame, lockable=lockable, assemblyRoot=assemblyRoot, path=path) + obj = Object3DWithoutParent(new(), visualizeFrame=visualizeFrame, lockable=lockable, assemblyRoot=assemblyRoot, path=path) obj.feature = feature (obj.shapeKind, obj.shape, obj.visualMaterial, obj.centroid) = setShapeKind(F, feature) + obj.isUserDefined = true end if typeof(feature) <: Modia3D.Shapes.Visual && typeof(feature.shape) <: Modia3D.Shapes.FileMesh && feature.shape.convexPartition @@ -366,7 +368,7 @@ mutable struct Object3D{F <: Modia3D.VarFloatType} <: Modia3D.AbstractObject3D Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), false, F(0.0), Modia3D.ZeroVector3D(F), SMatrix{3,3,F,9}(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), feature, Modia3D.AbstractTwoObject3DObject[], - false, false, false, false, + false, false, false, false, false, shapeKind, shape, visualMaterial, centroid, visualizeFrame2, Vector{Object3D{F}}[], @@ -375,7 +377,6 @@ mutable struct Object3D{F <: Modia3D.VarFloatType} <: Modia3D.AbstractObject3D Vector{Object3D{F}}[], Vector{Object3D{F}}[], Vector{Object3D{F}}[], Vector{Object3D{F}}[], path) - if fixed push!(parent.children, obj) @@ -414,7 +415,7 @@ mutable struct Object3D{F <: Modia3D.VarFloatType} <: Modia3D.AbstractObject3D Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), Modia3D.ZeroVector3D(F), false, F(0.0), Modia3D.ZeroVector3D(F), SMatrix{3,3,F,9}(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), feature, Modia3D.AbstractTwoObject3DObject[], - false, false, false, false, + false, false, false, false, false, shapeKind, shape, visualMaterial, centroid, visualizeFrame, Vector{Object3D{F}}[], @@ -632,19 +633,23 @@ hasChildJoint( obj::Object3D{F}) where F <: Modia3D.VarFloatType = obj.ha needsAcceleration( obj::Object3D{F}) where F <: Modia3D.VarFloatType = obj.computeAcceleration objectHasMass( obj::Object3D{F}) where F <: Modia3D.VarFloatType = obj.hasMass isRootObject( obj::Object3D{F}) where F <: Modia3D.VarFloatType = obj.isRootObj +isUserDefined( obj::Object3D{F}) where F <: Modia3D.VarFloatType = obj.isUserDefined objectHasMovablePos( obj::Object3D{F}) where F <: Modia3D.VarFloatType = isdefined(obj.interactionManner, :movablePos) +isSolid( obj::Object3D{F}) where F <: Modia3D.VarFloatType = typeof(obj.feature) <: Modia3D.Shapes.Solid{F} +isVisual( obj::Object3D{F}) where F <: Modia3D.VarFloatType = typeof(obj.feature) <: Modia3D.Shapes.Visual featureHasMass(obj::Object3D{F}) where F <: Modia3D.VarFloatType = featureHasMass(obj.feature) featureHasMass(feature::Modia3D.AbstractObject3DFeature) = false featureHasMass(feature::Modia3D.AbstractScene) = false featureHasMass(feature::Shapes.Solid{F}) where F <: Modia3D.VarFloatType = !isnothing(feature.massProperties) -isVisible(obj::Object3D{F}, renderer::Modia3D.AbstractRenderer) where F <: Modia3D.VarFloatType = isVisible(obj.feature, renderer) -isVisible(obj::Object3D{F}, exportAnimation::Bool) where F <: Modia3D.VarFloatType = isVisible(obj.feature, exportAnimation) -isVisible(feature::Modia3D.AbstractObject3DFeature, renderer::Modia3D.AbstractRenderer) = false -isVisible(feature::Modia3D.AbstractObject3DFeature, exportAnimation::Bool) = false -isVisible(feature::Modia3D.AbstractScene, renderer::Modia3D.AbstractRenderer) = false -isVisible(feature::Modia3D.AbstractScene, exportAnimation::Bool) = false +function isVisible(obj::Object3D{F})::Bool where F <: Modia3D.VarFloatType + if isSolid(obj) || isVisual(obj) + return !isnothing(obj.feature.visualMaterial) && !isnothing(obj.feature.shape) + else + return false + end +end canCollide(feature::Modia3D.AbstractObject3DFeature) = false diff --git a/src/Composition/printObject3D.jl b/src/Composition/printObject3D.jl index 9a4d1599..b65a5676 100644 --- a/src/Composition/printObject3D.jl +++ b/src/Composition/printObject3D.jl @@ -5,7 +5,7 @@ end function printAllVisuElements(scene::Scene) - printTree(scene.allVisuElements) + printTree(scene.visualObject3Ds) end diff --git a/src/Composition/scene.jl b/src/Composition/scene.jl index 63677759..024c4664 100644 --- a/src/Composition/scene.jl +++ b/src/Composition/scene.jl @@ -406,14 +406,15 @@ mutable struct Scene{F <: Modia3D.VarFloatType} <: Modia3D.AbstractScene superObjs::Vector{SuperObjsRow} # super objects treeAccVelo::Vector{Object3D{F}} - tree::Vector{Object3D{F}} # Spanning tree of the frames in depth-first order (without world) - treeForComputation::Vector{Object3D{F}} # Tree that is used for the computation + tree::Vector{Object3D{F}} # Spanning tree of the frames in depth-first order (without world) + treeForComputation::Vector{Object3D{F}} # Tree that is used for the computation # treeForComputation = options.useOptimizedStructure ? treeAccVelo : tree - #cutJoints::Vector{Modia3D.AbstractJoint} # Vector of all cut-joints - allVisuElements::Vector{Object3D{F}} # all Object3Ds that should be visualized (for communiating with SimVis) - updateVisuElements::Vector{Object3D{F}} # all Object3Ds that are visibly only e.g. visualization frames (must be updated first) - allCollisionElements::Vector{Object3D{F}} # all Object3Ds, which are allowed to collide (no order, no super objects) + #cutJoints::Vector{Modia3D.AbstractJoint} # Vector of all cut-joints + userDefinedObject3Ds::Vector{Object3D{F}} # all Object3Ds defined by the user (i.e. no internally generated visualization frame, contact/support point, bounding box, convex partition member object) + visualObject3Ds::Vector{Object3D{F}} # all Object3Ds required for visualization (i.e. obj.feature = Solid/Visual/Light/Camera, includes visualization frames, contact points and bounding boxes) + pureResultObject3Ds::Vector{Object3D{F}} # all pure result or visualization Object3Ds which are not part of the equations of motion and therefore need extra calculation of r_abs and R_abs (includes visualization frames) + allCollisionElements::Vector{Object3D{F}} # all Object3Ds, which are allowed to collide (no order, no super objects) noCPairs::Vector{Vector{Int64}} # Indices of frames (with respect to collSuperObjs) that can't collide in general (e.g. objects are connected via joints) noCPairsHelp::Dict{Modia3D.AbstractJoint,Vector{Int64}} allowedToMove::Vector{Union{Bool,Nothing}} @@ -511,6 +512,7 @@ mutable struct Scene{F <: Modia3D.VarFloatType} <: Modia3D.AbstractScene Vector{Object3D{F}}[], Vector{Object3D{F}}[], Vector{Object3D{F}}[], + Vector{Object3D{F}}[], Vector{Vector{Int64}}[], Dict{Modia3D.AbstractJoint,Vector{Int64}}(), Vector{Union{Bool}}[], diff --git a/src/Composition/superObjects.jl b/src/Composition/superObjects.jl index bc1d6087..7908d643 100644 --- a/src/Composition/superObjects.jl +++ b/src/Composition/superObjects.jl @@ -26,9 +26,9 @@ mutable struct SuperObjForce{F <: Modia3D.VarFloatType} end end -mutable struct SuperObjVisu{F <: Modia3D.VarFloatType} +mutable struct SuperObjResult{F <: Modia3D.VarFloatType} superObj::Vector{Object3D{F}} - function SuperObjVisu{F}() where F <: Modia3D.VarFloatType + function SuperObjResult{F}() where F <: Modia3D.VarFloatType new(Vector{Object3D{F}}[]) end end @@ -40,9 +40,9 @@ mutable struct SuperObjsRow{F <: Modia3D.VarFloatType} superObjMass::SuperObjMass{F} superObjMovable::SuperObjMovable{F} superObjForce::SuperObjForce{F} - superObjVisu::SuperObjVisu{F} + superObjResult::SuperObjResult{F} noCPair::Vector{Int64} function SuperObjsRow{F}() where F <: Modia3D.VarFloatType - new(SuperObjCollision{F}(), SuperObjMass{F}(), SuperObjMovable{F}(), SuperObjForce{F}(), SuperObjVisu{F}(), Vector{Int64}[]) + new(SuperObjCollision{F}(), SuperObjMass{F}(), SuperObjMovable{F}(), SuperObjForce{F}(), SuperObjResult{F}(), Vector{Int64}[]) end end diff --git a/src/ModiaInterface/buildModel3D.jl b/src/ModiaInterface/buildModel3D.jl index ce6d0830..c95ed52a 100644 --- a/src/ModiaInterface/buildModel3D.jl +++ b/src/ModiaInterface/buildModel3D.jl @@ -68,7 +68,7 @@ equations = :[ ] ``` """ -function build_Model3D!(model::AbstractDict, modelModule, FloatType::Type, TimeType::Type, +function build_Model3D!(model::AbstractDict, modelModule, FloatType::Type, TimeType::Type, instantiateModelOptions::OrderedDict{Symbol,Any}, ID, modelPath::Union{Expr,Symbol,Nothing}, buildOption::String = "ComputeGeneralizedForces") # ComputeJointAccelerations, ComputeJointAccelerationsOn @@ -79,7 +79,7 @@ function build_Model3D!(model::AbstractDict, modelModule, FloatType::Type, TimeT if !unitless source = instantiateModelOptions[:source] modelName = instantiateModelOptions[:modelName] - error("\nError from Model3D(..) in model $modelName at $source:\n@instantiatedModel(..., unitless=true, ...) required, because units not yet fully supported by Model3D.\n") + error("\nError from Model3D(..) in model $modelName at $source:\n@instantiatedModel(..., unitless=true, ...) required, because units not yet fully supported by Model3D.\n") end jointInfo = [] getJointInfo!(model, jointInfo) @@ -350,13 +350,13 @@ function get_animationHistory(instantiatedModel::Modia.InstantiatedModel{FloatTy mbs::Modia3D.Composition.MultibodyData{FloatType,TimeType} = instantiatedModel.buildDict[modelPathAsString].mbs scene = mbs.scene - allVisuElements = scene.allVisuElements + visualObject3Ds = scene.visualObject3Ds animation = scene.animation animationHistory = OrderedDict{String,Any}() - if length(allVisuElements) > 0 && scene.provideAnimationData + if length(visualObject3Ds) > 0 && scene.provideAnimationData if log - println("get_animationHistory(..): Return animation history of ", length(allVisuElements), " Object3Ds at ", + println("get_animationHistory(..): Return animation history of ", length(visualObject3Ds), " Object3Ds at ", length(animation), " time instants") end @@ -366,7 +366,7 @@ function get_animationHistory(instantiatedModel::Modia.InstantiatedModel{FloatTy end animationHistory["time"] = timeVector - for (iobj,obj) in enumerate(allVisuElements) + for (iobj,obj) in enumerate(visualObject3Ds) positions = SVector{3,Float64}[] quaternions = SVector{4,Float64}[] for animationStep in animation diff --git a/src/renderer/DLR_Visualization/handler.jl b/src/renderer/DLR_Visualization/handler.jl index 66a57557..8a59a39c 100644 --- a/src/renderer/DLR_Visualization/handler.jl +++ b/src/renderer/DLR_Visualization/handler.jl @@ -7,7 +7,7 @@ function Composition.initializeVisualization(renderer::Modia3D.AbstractDLR_VisualizationRenderer, scene::Composition.Scene{F})::Nothing where F <: Modia3D.VarFloatType simVis::SimVis_Renderer = renderer.simVis - velements = scene.allVisuElements + velements = scene.visualObject3Ds @assert(length(velements) > 0) if simVis.isInitialized Composition.closeVisualization(renderer) @@ -57,12 +57,3 @@ function Composition.closeVisualization(renderer::Modia3D.AbstractDLR_Visualizat simVis.isInitialized = false return nothing end - - -function Composition.isVisible(feature::Shapes.Solid{F}, renderer::Modia3D.AbstractDLR_VisualizationRenderer) where F <: Modia3D.VarFloatType - return !isnothing(feature.shape) && !isnothing(feature.visualMaterial) -end - -function Composition.isVisible(feature::Shapes.Visual, renderer::Modia3D.AbstractDLR_VisualizationRenderer) - return !isnothing(feature.shape) && !isnothing(feature.visualMaterial) -end diff --git a/src/renderer/NoRenderer/handler.jl b/src/renderer/NoRenderer/handler.jl index a7d7dc46..a9de12ad 100644 --- a/src/renderer/NoRenderer/handler.jl +++ b/src/renderer/NoRenderer/handler.jl @@ -15,6 +15,3 @@ end function Composition.closeVisualization(renderer::DummyRenderer) end - - -Composition.isVisible(feature::Modia3D.AbstractVisualElement, renderer::DummyRenderer) = false diff --git a/test/Basic/Pendulum.jl b/test/Basic/Pendulum.jl index 04d321e9..19e44acf 100644 --- a/test/Basic/Pendulum.jl +++ b/test/Basic/Pendulum.jl @@ -15,6 +15,6 @@ simulate!(pendulum, stopTime=3.0, log=true, requiredFinalStates = requiredFinalS showInfo(pendulum) @usingModiaPlot -plot(pendulum, ["rev.phi", "body.r_abs", "body.R_abs"]) +plot(pendulum, ["rev.phi", "body.r_abs", "body.rot123_abs"]) end diff --git a/test/Collision/NewtonsCradle.jl b/test/Collision/NewtonsCradle.jl index f9213a20..c3a3371c 100644 --- a/test/Collision/NewtonsCradle.jl +++ b/test/Collision/NewtonsCradle.jl @@ -57,7 +57,11 @@ Cradle = Model3D( enableContactDetection=true, elasticContactReductionFactor=1.0, animationFile="NewtonsCradle.json", - visualizeBoundingBox=true)), + enableVisualization=true, + visualizeFrames=false, + visualizeBoundingBox=true, + visualizeContactPoints=false, + visualizeSupportPoints=false)), box = Object3D(parent=:world, feature=Visual(shape=Box(lengthX=Lx, lengthY=Ly, lengthZ=Lz), visualMaterial=vmatVisual)), @@ -88,7 +92,10 @@ tolerance = 1e-8 requiredFinalStates = [-1.180791527568564, -1.033934458288708, 0.04982982739055273, 0.018466029517559813, 0.049844032881367094, 0.018471344490359712, 0.04986127142907837, 0.018476465719447804, 0.04987561416137295, 0.018481494292598495] simulate!(newtonsCradle, stopTime=stopTime, tolerance=tolerance, log=true, logStates=false, logEvents=false, requiredFinalStates=requiredFinalStates) +#showInfo(newtonsCradle) + @usingModiaPlot plot(newtonsCradle, ["rev1.phi" "rev5.phi"; "rev1.w" "rev5.w"], figure=1) +plot(newtonsCradle, ["pendulum1.sphere.r_abs"; "pendulum1.sphere.rot123_abs"], figure=2) end diff --git a/test/Robot/ScenarioCollisionOnly.jl b/test/Robot/ScenarioCollisionOnly.jl index 21c55c7f..18b98934 100644 --- a/test/Robot/ScenarioCollisionOnly.jl +++ b/test/Robot/ScenarioCollisionOnly.jl @@ -538,7 +538,7 @@ youbot = @instantiateModel(youbotModel, unitless=true, logCode=false, log=false) stopTime = 13.5 tolerance = 1e-7 -# use boxes instead of FileMesh for better performance + if Sys.iswindows() requiredFinalStates = [3.141592656083914, 3.2955210650043794e-9, 0.6805942885295763, -0.09565767441181468, 0.7909095511209971, 0.10951974347893331, 1.032702582672235, -0.14501159330773356, 4.843043035569045e-8, -5.084066106605599e-8, 9.463525418080984e-8, -0.4161958225397787, -0.3634865106392557, -0.11218698258440177, 0.00028351378391616364, -0.0687518903928338, 0.04978878983770011, -4.140566109957699e-6, -0.7842800497816398, 0.005105609550611603, 0.21862295671355367, -0.0096585351122136, 2.0689584764943053e-6, 0.02110845828012153, -0.19785528209242548, 0.1186760937422613, 0.02372051044718875, -6.533396584593705e-8, 0.13049051323039967, 4.26642489125089e-8] elseif Sys.isapple() @@ -549,24 +549,13 @@ end simulate!(youbot, stopTime=stopTime, tolerance=tolerance, requiredFinalStates_rtol=0.01, requiredFinalStates_atol=0.01, log=true, logStates=false, logParameters=false, requiredFinalStates=requiredFinalStates, logEvents=false) -# @usingModiaPlot -# plot(youbot, [ "sphere.translation[1]", -# "sphere.translation[2]", -# "sphere.translation[3]"], reuse=true, prefix="S1: ", figure=1) - -# plot(youbot, [ "sphere.r_abs[1]", -# "sphere.r_abs[2]", -# "sphere.r_abs[3]"], reuse=true, prefix="S1: ", figure=2) - - -# plot(youbot, ["sphere.translation", -# # ("youbot1.rev1.phi", -# # "youbot1.rev2.phi", -# # "youbot1.rev3.phi", -# # "youbot1.rev4.phi", -# # "youbot1.rev5.phi") -# ], figure=1) - +@usingModiaPlot +plot(youbot, [ "sphere.translation[1]", + "sphere.translation[2]", + "sphere.translation[3]"], reuse=true, prefix="S1: ", figure=1) +plot(youbot, [ "sphere.r_abs[1]", + "sphere.r_abs[2]", + "sphere.r_abs[3]"], reuse=true, prefix="S1: ", figure=2) end diff --git a/test/Segmented/ScenarioSegmentedCollisionOff.jl b/test/Segmented/ScenarioSegmentedCollisionOff.jl index e76841f3..a0e6ab34 100644 --- a/test/Segmented/ScenarioSegmentedCollisionOff.jl +++ b/test/Segmented/ScenarioSegmentedCollisionOff.jl @@ -568,27 +568,21 @@ youbot = @instantiateModel(youbotModel, unitless=true, logCode=false, log=false) stopTime = 13.5 tolerance = 1e-7 -# use boxes instead of FileMesh for better collision performance + requiredFinalStates = [3.1415926570363713, -1.3013458081419306e-7, 0.6805942873976024, -0.09565764991241311, 0.7909095517856483, 0.10951972995434828, 1.032702591771644, -0.14501158670555986, 5.492377676162606e-8, -5.981922191949395e-8, 7.757643552277316e-6, -0.4162469942033338, -0.3635507982892172, -0.11225051653570566, 0.0002829193229775221, -0.045836985439091864, 0.04707287716612709, 0.0014854402731197453] simulate!(youbot, stopTime=stopTime, tolerance=tolerance, requiredFinalStates_atol=0.002, log=true, logStates=false, logParameters=false, requiredFinalStates=requiredFinalStates, logEvents=false) # showInfo(youbot) -# @usingModiaPlot -# plot(youbot, ["sphere.translation", -# ("youbot1.rev1.phi", -# "youbot1.rev2.phi", -# "youbot1.rev3.phi", -# "youbot1.rev4.phi", -# "youbot1.rev5.phi")], figure=1) - -# plot(youbot, [ "sphere.translation[1]", -# "sphere.translation[2]", -# "sphere.translation[3]"], reuse=true, prefix="S3: ", figure=1) - -# plot(youbot, [ "sphere.r_abs[1]", -# "sphere.r_abs[2]", -# "sphere.r_abs[3]"], reuse=true, prefix="S3: ", figure=2) +@usingModiaPlot + +plot(youbot, [ "sphere.translation[1]", + "sphere.translation[2]", + "sphere.translation[3]"], reuse=true, prefix="S3: ", figure=1) + +plot(youbot, [ "sphere.r_abs[1]", + "sphere.r_abs[2]", + "sphere.r_abs[3]"], reuse=true, prefix="S3: ", figure=2) end diff --git a/test/Segmented/ScenarioSegmentedCollisionOn.jl b/test/Segmented/ScenarioSegmentedCollisionOn.jl index fa696327..c6630acd 100644 --- a/test/Segmented/ScenarioSegmentedCollisionOn.jl +++ b/test/Segmented/ScenarioSegmentedCollisionOn.jl @@ -566,27 +566,21 @@ youbot = @instantiateModel(youbotModel, unitless=true, logCode=false, log=false) stopTime = 13.5 tolerance = 1e-7 -# use boxes instead of FileMesh for better collision performance + requiredFinalStates = [3.1415926561937666, 3.180307603613472e-9, 0.6805942902151595, -0.09565769212815624, 0.7909095547559756, 0.10951974466588697, 1.0327025949882498, -0.14501161390073966, 4.834365439536424e-8, -5.083589168175532e-8, 9.482986225093542e-7, -0.41623125840706904, -0.3635339629899328, -0.11224029745945692, 0.000283221896408894, -0.06877832213561617, 0.04978954930374486, -2.2467894719281828e-6] simulate!(youbot, stopTime=stopTime, tolerance=tolerance, requiredFinalStates_atol=0.002, log=true, logStates=false, logParameters=false, requiredFinalStates=requiredFinalStates, logEvents=false) # showInfo(youbot) -# @usingModiaPlot -# plot(youbot, ["sphere.translation", -# ("youbot1.rev1.phi", -# "youbot1.rev2.phi", -# "youbot1.rev3.phi", -# "youbot1.rev4.phi", -# "youbot1.rev5.phi")], figure=1) - -# plot(youbot, [ "sphere.translation[1]", -# "sphere.translation[2]", -# "sphere.translation[3]"], reuse=true, prefix="S2: ", figure=1) - -# plot(youbot, [ "sphere.r_abs[1]", -# "sphere.r_abs[2]", -# "sphere.r_abs[3]"], reuse=true, prefix="S2: ", figure=2) +@usingModiaPlot + +plot(youbot, [ "sphere.translation[1]", + "sphere.translation[2]", + "sphere.translation[3]"], reuse=true, prefix="S2: ", figure=1) + +plot(youbot, [ "sphere.r_abs[1]", + "sphere.r_abs[2]", + "sphere.r_abs[3]"], reuse=true, prefix="S2: ", figure=2) end diff --git a/test/Segmented/ScenarioSegmentedOnly.jl b/test/Segmented/ScenarioSegmentedOnly.jl index 018b1445..1eeb4098 100644 --- a/test/Segmented/ScenarioSegmentedOnly.jl +++ b/test/Segmented/ScenarioSegmentedOnly.jl @@ -565,26 +565,20 @@ youbot = @instantiateModel(youbotModel, unitless=true, logCode=false, log=false) stopTime = 13.5 tolerance = 1e-7 -# use boxes instead of FileMesh for better performance + requiredFinalStates = [3.1415926553482936, 3.940308425576264e-9, 0.6805942761756493, -0.0956576899775176, 0.7909095290954901, 0.10951977177943406, 1.0327025673843655, -0.14501159844620148, 1.9286175287484307e-8, -3.283069277920548e-8, -4.1609409172268536e-6, -0.41631100515552766, -0.36361306819749833, -0.1122726475747107, 0.0003657180323440799, 6.003535500656957e-5, 0.04800122492323228, -1.2243878275181126e-6] simulate!(youbot, stopTime=stopTime, tolerance=tolerance, requiredFinalStates_atol=0.002, log=true, logStates=false, logParameters=false, requiredFinalStates=requiredFinalStates, logEvents=false) -# @usingModiaPlot -# plot(youbot, ["sphere.translation", -# ("youbot1.rev1.phi", -# "youbot1.rev2.phi", -# "youbot1.rev3.phi", -# "youbot1.rev4.phi", -# "youbot1.rev5.phi") -# ], figure=1) +@usingModiaPlot + +plot(youbot, [ "sphere.translation[1]", + "sphere.translation[2]", + "sphere.translation[3]"], reuse=true, prefix="S4: ", figure=1) -# plot(youbot, [ "sphere.translation[1]", -# "sphere.translation[2]", -# "sphere.translation[3]"], reuse=true, prefix="S4: ", figure=1) +plot(youbot, [ "sphere.r_abs[1]", + "sphere.r_abs[2]", + "sphere.r_abs[3]"], reuse=true, prefix="S4: ", figure=2) -# plot(youbot, [ "sphere.r_abs[1]", -# "sphere.r_abs[2]", -# "sphere.r_abs[3]"], reuse=true, prefix="S4: ", figure=2) end diff --git a/test/Segmented/TwoStageRocket3D.jl b/test/Segmented/TwoStageRocket3D.jl index 6cb1eb04..76df9776 100644 --- a/test/Segmented/TwoStageRocket3D.jl +++ b/test/Segmented/TwoStageRocket3D.jl @@ -78,4 +78,5 @@ plot(rocket, [("stage2.body.translation[2]", "stage1.body.translation[2]" ), ("stage1.thrust.forceVector[2]", "stage2.thrust.forceVector[2]")]) plot(rocket, ["stage1.body.r_abs[2]", "stage2.body.r_abs[2]"], figure=2) + end From bb803f71701578e4ddcc7ac475d7f2325f961d2c Mon Sep 17 00:00:00 2001 From: Gerhard Hippmann Date: Wed, 22 Nov 2023 12:31:24 +0100 Subject: [PATCH 2/3] Add argument and return types in function exportAnimation --- src/AnimationExport/exportAnimation.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/AnimationExport/exportAnimation.jl b/src/AnimationExport/exportAnimation.jl index bcba1d4f..05e42d87 100644 --- a/src/AnimationExport/exportAnimation.jl +++ b/src/AnimationExport/exportAnimation.jl @@ -435,7 +435,7 @@ function createAnimationQuaternionTrack(object, animation, obj, iobj, R_obj::Not end -function exportAnimation(scene) +function exportAnimation(scene::Modia3D.Composition.Scene{F}) where F <: Modia3D.VarFloatType visualObject3Ds = scene.visualObject3Ds if scene.exportAnimation && length(visualObject3Ds) > 0 animationFile = scene.options.animationFile @@ -490,4 +490,5 @@ function exportAnimation(scene) println("done.") end + return nothing end From b1ed1b07f50684668b82583618ed34ac6098ce48 Mon Sep 17 00:00:00 2001 From: Gerhard Hippmann Date: Wed, 22 Nov 2023 15:21:37 +0100 Subject: [PATCH 3/3] Update Modia compatibility 0.12.0 -> 0.12.1 --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 411aaf72..fd42f8c9 100644 --- a/Project.toml +++ b/Project.toml @@ -11,8 +11,8 @@ FileIO = "1" HTTP = "0.9" JSON = "0.21" Measurements = "2" -MeshIO = "0.4.10" -Modia = "0.12.0" +MeshIO = ">= 0.4.10" +Modia = "0.12.1" MonteCarloMeasurements = "1" OrderedCollections = "1" Reexport = "1.0"