Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create json animation files on mac #124

Closed
glen99pl opened this issue Oct 7, 2023 · 5 comments · Fixed by #125
Closed

Can't create json animation files on mac #124

glen99pl opened this issue Oct 7, 2023 · 5 comments · Fixed by #125

Comments

@glen99pl
Copy link

glen99pl commented Oct 7, 2023

Modia3D is installed on my mac. It runs the tutorial and generates 2D plots (PyPlot and GLMakie), but I can’t generate 3D animations (json) for display in threejs.org.

I’ve tried many of the tutorials and tests (I know not all are supposed to generate a json file). So far, only the following have produced a json file:

  • NewtonsCradle
  • BouncingCones
  • BouncingCapsules

However, the json files that are created don’t display properly in threejs.org. As an example, I’ve attached the json file and a short threejs animation screen capture for NewtonsCradle.

I’m not trying to use DLR_VISUALIZATION. (Library not available for mac.)

Not sure if it is related, but I get errors when I try to add the ModiaPlot_GLMakie package. Terminal output is at the below (at the end).

Here is how I’ve run the simulations:

julia> ENV["SignalTablesPlotPackage"] = "PyPlot"
"PyPlot"

julia> import Modia3D;

... Info: ENV["DLR_VISUALIZATION"] is not defined.
Therefore, no online renderer is used in Modia3D.

... Info: No renderer found -> online visualization is disabled.

julia> include("$(Modia3D.path)/test/Collision/NewtonsCradle.jl")

Instantiating model Cradle
in module: Main.NewtonsCradle
in file: /Users/glenc/.julia/packages/Modia3D/AQjsp/test/Collision/NewtonsCradle.jl:84

... Simulate model Cradle
Initialization at time = 0.0 s
Modia3D: nVisualShapes = 5
mprTolerance = 1.0e-20
contact_eps = 1.0e-13
Initialization finished within 12.066346 seconds (19.45 M allocations: 1.192 GiB, 3.89% gc time, 99.32% compilation time: 2% of which was recompilation)
Export animation to NewtonsCradle.json ... done.
Termination of Cradle at time = 5.0 s
initCpuTime = 12.1 s
simCpuTime = 3.08 s
initAlloc = 1280.0 MB
simAlloc = 406.0 MB
FloatType = Float64
algorithm = CVODE_BDF (ODE integrator)
startTime = 0.0 s
terminationTime = 5.0 s
interval = 0.01 s
tolerance = 1.0e-8 (relative tolerance)
nStates = 10
nResults = 885
nf_total = 36289 (total number of getDerivatives! calls)
nf_integrator = 15203 (number of getDerivatives! calls from integrator)
nf_zeroCrossings = 20103 (number of getDerivatives! calls for zero crossing detection)
nJac = missing (number of Jacobian computations)
nAcceptedSteps = missing
nRejectedSteps = missing
nTimeEvents = 0
nStateEvents = 96
nRestartEvents = 96
linearSystemsSizes = [5]
linearSystemsRecFac = [false] (= true, if LU with RecursiveFactorization.jl)
linearSystemsOdeMode = [true]
using SignalTablesInterface_PyPlot
Main.NewtonsCradle

julia>

Julia info and packages:

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (x86_64-apple-darwin22.4.0)
CPU: 10 × Apple M1 Pro
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, westmere)
Threads: 1 on 10 virtual cores
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS =

julia> Pkg.status()
Status ~/.julia/environments/v1.9/Project.toml
[717857b8] DSP v0.7.9
[7a1cc6ca] FFTW v1.7.1
[9c8b4983] LightXML v0.9.0
⌅ [ee78f7c6] Makie v0.17.13
[cb905087] Modia v0.12.0
[07f2c1e0] Modia3D v0.12.1
[59e4e452] ModiaPlot_PyPlot v0.4.1
[d330b81b] PyPlot v2.11.2
[295af30f] Revise v3.5.6
[ddbd5806] SignalTablesInterface_GLMakie v0.1.2
[a24218ac] SignalTablesInterface_PyPlot v0.1.3
[de0858da] Printf
[10745b16] Statistics v1.9.0
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use status --outdated

Error trying to add ModiaPlot_GLMakie:

julia> Pkg.add("ModiaPlot_GLMakie")
Updating registry at ~/.julia/registries/General.toml
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package GLMakie [e9467ef8]:
GLMakie [e9467ef8] log:
├─possible versions are: 0.0.1-0.8.11 or uninstalled
├─restricted by compatibility requirements with SignalTablesInterface_GLMakie [ddbd5806] to versions: 0.6.0-0.6.13
│ └─SignalTablesInterface_GLMakie [ddbd5806] log:
│ ├─possible versions are: 0.1.0-0.1.2 or uninstalled
│ └─restricted to versions * by an explicit requirement, leaving only versions: 0.1.0-0.1.2
└─restricted by compatibility requirements with ModiaPlot_GLMakie [16bb567d] to versions: [0.1.30-0.2.9, 0.4.0-0.5.5] — no versions left
└─ModiaPlot_GLMakie [16bb567d] log:
├─possible versions are: 0.1.0-0.4.0 or uninstalled
└─restricted to versions * by an explicit requirement, leaving only versions: 0.1.0-0.4.0
Stacktrace:
[1] propagate_constraints!(graph::Pkg.Resolve.Graph, sources::Set{Int64}; log_events::Bool)
@ Pkg.Resolve /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/Resolve/graphtype.jl:1072
[2] propagate_constraints! (repeats 2 times)
@ /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/Resolve/graphtype.jl:1008 [inlined]
[3] simplify_graph!(graph::Pkg.Resolve.Graph, sources::Set{Int64}; clean_graph::Bool)
@ Pkg.Resolve /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/Resolve/graphtype.jl:1533
[4] simplify_graph! (repeats 2 times)
@ /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/Resolve/graphtype.jl:1532 [inlined]
[5] resolve_versions!(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber, installed_only::Bool)
@ Pkg.Operations /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:408
[6] targeted_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
@ Pkg.Operations /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:1357
[7] tiered_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber, try_all_installed::Bool)
@ Pkg.Operations /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:1346
[8] _resolve(io::Base.TTY, env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
@ Pkg.Operations /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:1367
[9] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, new_git::Set{Base.UUID}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform)
@ Pkg.Operations /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:1384
[10] add
@ /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:1373 [inlined]
[11] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::Base.Pairs{Symbol, Base.TTY, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.TTY}}})
@ Pkg.API /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/API.jl:275
[12] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Pkg.API /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/API.jl:156
[13] add(pkgs::Vector{Pkg.Types.PackageSpec})
@ Pkg.API /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/API.jl:145
[14] #add#25
@ /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/API.jl:144 [inlined]
[15] add
@ /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/API.jl:144 [inlined]
[16] #add#24
@ /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/API.jl:143 [inlined]
[17] add(pkg::String)
@ Pkg.API /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Pkg/src/API.jl:143
[18] top-level scope
@ REPL[9]:1

NewtonsCradle outputs.zip

@GerhardHippmann
Copy link
Collaborator

Thanks for reporting your issue.

Animation export can be enabled in any Modia3D model by setting animationFile="<filename>.json" in the Scene definition. As expected your example is identical to my output on Linux (except for time integration round-off errors). However, it does not display correctly in the three.js editor (Linux/Firefox) either.

I am going to investigate the problem asap. Supposedly the JSON Object Scene format has changed again like some time ago in #119.

I am not sure what your problem with GLMakie is, but it is not related to Modia3D animation export.

@glen99pl
Copy link
Author

Thanks Gerhard.
Looking forward to seeing some animations :-)

By the way, I just tried using the DLR visualisation in a linux VM. No luck though. I guess this is because I'm running on an M1 macbook, so everything has to be compiled for ARM.

@GerhardHippmann
Copy link
Collaborator

Not yet fixed in Modia3D, coming soon...

GerhardHippmann added a commit that referenced this issue Oct 12, 2023
- Always consider Object3Ds for AnimationExport in Scene.allVisuElements and Scene.updateVisuElements
- This fixes #124
@glen99pl
Copy link
Author

glen99pl commented Oct 15, 2023 via email

@GerhardHippmann
Copy link
Collaborator

Yes, this time the problem was not caused by three.js, but by me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants