Giter Site home page Giter Site logo

meshcat.jl's Introduction

MeshCat.jl: Julia bindings to the MeshCat WebGL viewer

Build Status codecov.io

MeshCat is a remotely-controllable 3D viewer, built on top of three.js. The viewer contains a tree of objects and transformations (i.e. a scene graph) and allows those objects and transformations to be added and manipulated with simple commands. This makes it easy to create 3D visualizations of geometries, mechanisms, and robots. MeshCat.jl runs on macOS, Linux, and Windows.

The MeshCat viewer runs entirely in the browser, with no external dependencies. All files are served locally, so no internet connection is required. Communication between the browser and your Julia code is managed by HTTP.jl. That means that MeshCat should work:

As much as possible, MeshCat.jl tries to use existing implementations of its fundamental types. In particular, we use:

That means that MeshCat should play well with other tools in the JuliaGeometry ecosystem like MeshIO.jl, Meshing.jl, etc.

Demos

Basic Usage

For detailed examples of usage, check out demo.ipynb.

Animation

To learn about the animation system (introduced in MeshCat.jl v0.2.0), see animation.ipynb.

Related Projects

MeshCat.jl is a successor to DrakeVisualizer.jl, and the interface is quite similar (with the exception that we use setobject! instead of setgeometry!). The primary difference is that DrakeVisualizer required Director, LCM, and VTK, all of which could be difficult to install, while MeshCat just needs a web browser. MeshCat also has better support for materials, textures, point clouds, and complex meshes.

You may also want to check out:

Examples

Create a visualizer and open it

using MeshCat
vis = Visualizer()
open(vis)

## In an IJulia/Jupyter notebook, you can also do:
# IJuliaCell(vis)

Cube

using GeometryBasics
using CoordinateTransformations

setobject!(vis, HyperRectangle(Vec(0., 0, 0), Vec(1., 1, 1)))
settransform!(vis, Translation(-0.5, -0.5, 0))

demo-cube

Point Clouds

using ColorTypes
verts = rand(Point3f, 100_000)
colors = [RGB(p...) for p in verts]
setobject!(vis, PointCloud(verts, colors))

demo-points

Contours

# Visualize a mesh from the level set of a function
using Meshing: MarchingTetrahedra
using GeometryBasics: Mesh, HyperRectangle
f = x -> sum(sin, 5 * x)
mesh = Mesh(f, HyperRectangle(Vec(-1, -1, -1), Vec(2, 2, 2)),
            MarchingTetrahedra())
setobject!(vis, mesh,
           MeshPhongMaterial(color=RGBA{Float32}(1, 0, 0, 0.5)))

demo-contour

Polyhedra

See here for a notebook with the example.

# Visualize the permutahedron of order 4 using Polyhedra.jl
using Combinatorics, Polyhedra
v = vrep(collect(permutations([0, 1, 2, 3])))
using CDDLib
p4 = polyhedron(v, CDDLib.Library())

# Project that polyhedron down to 3 dimensions for visualization
v1 = [1, -1,  0,  0]
v2 = [1,  1, -2,  0]
v3 = [1,  1,  1, -3]
p3 = project(p4, [v1 v2 v3])

# Show the result
setobject!(vis, Polyhedra.Mesh(p3))

polyhedron

Mechanisms

Using https://github.com/rdeits/MeshCatMechanisms.jl

demo-valkyrie

meshcat.jl's People

Contributors

affie avatar alhirzel avatar bjack205 avatar blegat avatar csertegt3 avatar dehann avatar dev10110 avatar ferrolho avatar github-actions[bot] avatar janbruedigam avatar juliatagbot avatar petrkryslucsd avatar rdeits avatar ryanelandt avatar tkoolen avatar traversaro avatar twavv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meshcat.jl's Issues

Compatibility with WebIO 0.6

Looks like WebIO 0.6 breaks MeshCat a little bit. Basic visualizations seem to work, but:

  • wait(vis) blocks forever
  • iframe(vis) throws a MethodError

All of these look like cases where I was digging around inside the internals of WebIO, so I'm not too surprised.

Cryptic Asset not found error upon `using MeshCat` when package not built

I was getting

julia> using MeshCat
ERROR: InitError: Asset not found
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] #register#1(::String, ::Function, ::String) at /home/twan/.julia/packages/AssetRegistry/4TyKv/src/AssetRegistry.jl:30
 [3] register at /home/twan/.julia/packages/AssetRegistry/4TyKv/src/AssetRegistry.jl:29 [inlined]
 [4] __init__() at /home/twan/.julia/packages/MeshCat/Kl8QU/src/MeshCat.jl:102
 [5] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:627
 [6] macro expansion at ./logging.jl:312 [inlined]
 [7] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:698
 [8] _require(::Base.PkgId) at ./loading.jl:931
 [9] require(::Base.PkgId) at ./loading.jl:852
 [10] macro expansion at ./logging.jl:311 [inlined]
 [11] require(::Module, ::Symbol) at ./loading.jl:834
during initialization of module MeshCat

PR incoming.

Unsatisfiable requirements

Hello, I've been trying to simulate my robot dynamics using the RigidBodyDynamics package, and I'd like to visualise the simulation using MeshCatMechanisms. I tried to add the package MeshCatMechanisms, but I'm getting this error:

ERROR: Unsatisfiable requirements detected for package MeshCat [283c5d60]:
MeshCat [283c5d60] log:
├─possible versions are: 0.6.0 or uninstalled
├─MeshCat [283c5d60] is fixed to version 0.6.0
└─found to have no compatible versions left with MeshCatMechanisms [6ad125db]
└─MeshCatMechanisms [6ad125db] log:
├─possible versions are: [0.0.1-0.0.6, 0.1.0-0.1.1, 0.2.0-0.2.1] or uninstalled
└─restricted to versions * by an explicit requirement, leaving only versions [0.0.1-0.0.6, 0.1.0-0.1.1, 0.2.0-0.2.1]

When I run versioninfo(), I get this:
Julia Version 1.0.3
Commit 099e826241 (2018-12-18 01:34 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, sandybridge)
Environment:
JULIA_EDITOR = atom -a
JULIA_NUM_THREADS = 4
JULIA_PKG_SERVER = https://pkg.juliacomputing.com/
JULIA_PKG_TOKEN_PATH = /home/vish0908/.juliapro/token.toml

Any help would be appreciated.

Not all objects displays in meshcat

I'm on the master branch with an updated WebIO to latest, because of a requirement conflict with it. Julia 1.2 on Ubuntu 18.04
If I draw a bunch of (<40) spheres and triads in a loop not all of them makes it to the visualizer (with code that used to work).
If I add a delay (sleep(0.1)) in the loop they make it through.
What would you suggest? I do not want the extra delay and don't know how to use latest tag without conflicts with WebIO.
It also looks like a zero transform is also sometimes displayed.

Breaking Juno

When installing this in Juno, I get a compatibility problem for WebIO with Atom 0.7.12. If I downgrade to Atom 0.7.10 and then install MeshCat I loose auto-completion support in Atom/Juno, which is really frustrating, especially since I can't use unicode anymore.

Unable to setobject! in atframe

MWE:

using MeshCat    
using GeometryTypes    
                                                                                                               
vis = Visualizer()    
open(vis)    
                                                                                                               
function test!(vis)                                                                                                               
  anim = Animation()    
  for i in 1:10                                                                                                                                         
    atframe(anim, i) do    
      marker = Sphere(Point3(0., 0., 0.), i/10)    
      setobject!(vis, marker)    
    end    
  end    
  setanimation!(vis, anim)    
end    
                                                                                                               
test!(vis)

Output:

ERROR: LoadError: type DataType has no field body
Stacktrace:
 [1] getproperty at ./Base.jl:15 [inlined]
 [2] call at /home/drm/.julia/packages/Cassette/YCOeN/src/context.jl:447 [inlined]
 [3] fallback at /home/drm/.julia/packages/Cassette/YCOeN/src/context.jl:445 [inlined]
 [4] overdub at /home/drm/.julia/packages/Cassette/YCOeN/src/context.jl:271 [inlined]
 [5] typename at ./essentials.jl:294 [inlined]
 [6] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(Base.typename), ::Type{ColorTypes.RGB}) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [7] typename at ./essentials.jl:294 [inlined]
 [8] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(Base.typename), ::Type{ColorTypes.RGB}) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [9] basetype at /home/drm/.julia/packages/ColorTypes/TvB32/src/traits.jl:156 [inlined]
 [10] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(ColorTypes.basetype), ::Type{ColorTypes.RGB}) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [11] base_colorant_type at /home/drm/.julia/packages/ColorTypes/TvB32/src/traits.jl:157 [inlined]
 [12] eltypes_supported at /home/drm/.julia/packages/ColorTypes/TvB32/src/traits.jl:97 [inlined]
 [13] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(ColorTypes.eltypes_supported), ::Type{ColorTypes.RGB}) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [14] issupported at /home/drm/.julia/packages/ColorTypes/TvB32/src/traits.jl:102 [inlined]
 [15] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(ColorTypes.issupported), ::Type{ColorTypes.RGB}, ::Type{Float32}) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [16] pick_eltype at /home/drm/.julia/packages/ColorTypes/TvB32/src/traits.jl:296 [inlined]
 [17] ccolor at /home/drm/.julia/packages/ColorTypes/TvB32/src/traits.jl:279 [inlined]
 [18] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(ColorTypes.ccolor), ::Type{ColorTypes.RGB}, ::Type{ColorTypes.RGBA{Float32}}) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [19] convert at /home/drm/.julia/packages/ColorTypes/TvB32/src/conversions.jl:7 [inlined]
 [20] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(convert), ::Type{ColorTypes.RGB}, ::ColorTypes.RGBA{Float32}) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [21] lower at /home/drm/.julia/packages/MeshCat/GMobF/src/lowering.jl:215 [inlined]
 [22] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(MeshCat.lower), ::MeshCat.GenericMaterial) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [23] lower at /home/drm/.julia/packages/MeshCat/GMobF/src/lowering.jl:21 [inlined]
 [24] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(MeshCat.lower), ::Object{HyperSphere{3,Float64},MeshCat.GenericMaterial}) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [25] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(MeshCat.lower), ::MeshCat.SetObject{Object{HyperSphere{3,Float64},MeshCat.GenericMaterial}}) at /home/drm/.julia/packages/MeshCat/GMobF/src/lowering.jl:265
 [26] send at /home/drm/.julia/packages/MeshCat/GMobF/src/visualizer.jl:110 [inlined]
 [27] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::typeof(MeshCat.send), ::MeshCat.CoreVisualizer, ::MeshCat.SetObject{Object{HyperSphere{3,Float64},MeshCat.GenericMaterial}}) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [28] setobject! at /home/drm/.julia/packages/MeshCat/GMobF/src/visualizer.jl:164 [inlined]
 [29] setobject! at /home/drm/.julia/packages/MeshCat/GMobF/src/abstract_visualizer.jl:12 [inlined]
 [30] #3 at /tmp/MWE.jl:12 [inlined]
 [31] overdub(::Cassette.Context{nametype(AnimationCtx),Tuple{Animation,Int64},Nothing,getfield(Cassette, Symbol("##PassType#373")),Nothing,Nothing}, ::getfield(Main, Symbol("##3#4")){Visualizer,Int64}) at /home/drm/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [32] atframe at /home/drm/.julia/packages/MeshCat/GMobF/src/atframe.jl:58 [inlined]
 [33] test!(::Visualizer) at /tmp/MWE.jl:10
 [34] top-level scope at /tmp/MWE.jl:18
 [35] include at ./boot.jl:328 [inlined]
 [36] include_relative(::Module, ::String) at ./loading.jl:1094
 [37] include(::Module, ::String) at ./Base.jl:31
 [38] exec_options(::Base.JLOptions) at ./client.jl:295
 [39] _start() at ./client.jl:464
in expression starting at /tmp/MWE.jl:18

Camera that follows the object

Hey,
I am using the graphical interface GUI with MechanismVisualizer to visualize my objects.
I have an object in floating but when it moves the camera stays fixed on the world object in the center.
Is there a way for the camera to follow the object when visualizing ?
Thanks in Advance

using PointsMaterial

Trying to control the size of the points in a PointCloud using PointsMaterial, I'm getting several triangles in the viewer instead:

triangles

Here's the code I used:

using MeshCat
vis = Visualizer()
open(vis)

using ColorTypes, GeometryTypes
material = PointsMaterial(color=RGBA(0,0,1,0.5))
verts =rand(Point3f0,100)
setobject!(vis[:PointCloud],PointCloud(verts),material)

This package looks awesome!

Thanks for the package, I am sure it will be really useful for many researchers!

I tried cloning master and creating the visualization on Linux + Chromium, getting this error about the GPU:

julia> open(vis)
MeshCat Visualizer at http://127.0.0.1:7000/static/ with path /meshcat

julia> Created new window in existing browser session.
[22602:22632:0305/192007.094718:ERROR:browser_gpu_channel_host_factory.cc(121)] Failed to launch GPU process.
SystemError("opening file /home/juliohm/.julia/v0.6/MeshCat/viewer/static/meshcat.html", 2, nothing)
ERROR: SystemError: opening file /home/juliohm/.julia/v0.6/MeshCat/viewer/static/meshcat.html: No such file or directory
SystemError("opening file /home/juliohm/.julia/v0.6/MeshCat/viewer/static/meshcat.html", 2, nothing)
ERROR: SystemError: opening file /home/juliohm/.julia/v0.6/MeshCat/viewer/static/meshcat.html: No such file or directory
Stacktrace:
 [1] #systemerror#44 at ./error.jl:64 [inlined]
 [2] systemerror(::String, ::Bool) at ./error.jl:64
 [3] open(::String, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./iostream.jl:104
 [4] handle_file_request(::HttpCommon.Request, ::HttpCommon.Response) at /home/juliohm/.julia/v0.6/MeshCat/src/servers/zmqserver.jl:24
 [5] (::HttpServer.#on_message_complete#14{HttpServer.Server,HttpServer.Client{TCPSocket},Bool})(::HttpCommon.Request) at /home/juliohm/.julia/v0.6/HttpServer/src/HttpServer.jl:427
 [6] on_message_complete(::Ptr{HttpParser.Parser}) at /home/juliohm/.julia/v0.6/HttpServer/src/RequestParser.jl:113
 [7] http_parser_execute(::HttpParser.Parser, ::HttpParser.ParserSettings, ::Array{UInt8,1}) at /home/juliohm/.julia/v0.6/HttpParser/src/HttpParser.jl:115
 [8] process_client(::HttpServer.Server, ::HttpServer.Client{TCPSocket}, ::Bool) at /home/juliohm/.julia/v0.6/HttpServer/src/HttpServer.jl:389
 [9] (::HttpServer.##7#8{HttpServer.Server,Bool})() at ./task.jl:335

Cylinder handling

I was surprised by

center(geometry::Cylinder) = origin(geometry) + geometry.extremity / 2

and

R = rotation_between(SVector(0, 1, 0), g.extremity)

The extremity field of a Cylinder is a Point, not a Vec, so I would have expected

center(geometry::Cylinder) = (origin(geometry) + geometry.extremity) / 2

and

R = rotation_between(SVector(0, 1, 0), g.extremity - g.origin)

Orbit Controls - Panning

After updating three.js to v110 (#131) the orbit controls have now a different panning default behaviour:

.screenSpacePanning : Boolean
Defines how the camera's position is translated when panning. If true, the camera pans in screen space. Otherwise, the camera pans in the plane orthogonal to the camera's up direction. Default is false.

Relevant docs: https://threejs.org/docs/#examples/en/controls/OrbitControls.screenSpacePanning

Personally, I'd rather have the old behaviour. Is there any way, from MeshCat.jl, we can set the above boolean to false?

Programmatically Take Pictures

This new visualizer is a lot lighter than DrakeVisualizer; well done!

I want to take pictures from this visualizer programmatically, but don't see a way to do this. I saw the animation demo, but it's not what I'm looking for. Is there a way to trigger the "save_image" button and save the image into a destination of your choice? I have something like save_mesh_cat_image("/home/rdeits/Downloads/image0001.png") in mind.

meshcat.zip not found in Windows

Building MeshCat in Windows returns :

Error: The system can not find the file specified.
C:\Users\phelipe\AppData\Local\Temp\jl_381D.tmp\meshcat.zip

ArrowVisualizer's settransform! fails for very short (but nonzero) arrows

settransform!(ArrowVisualizer(vis[:arrow]), Point(0., 0, 0), Vec(0, 0, 0.01))

gives:

LinearAlgebra.SingularException(3)

Stacktrace:
 [1] macro expansion at /home/rdeits/.julia/packages/StaticArrays/VyRz3/src/SDiagonal.jl:58 [inlined]
 [2] check_singular at /home/rdeits/.julia/packages/StaticArrays/VyRz3/src/SDiagonal.jl:57 [inlined]
 [3] inv at /home/rdeits/.julia/packages/StaticArrays/VyRz3/src/SDiagonal.jl:62 [inlined]
 [4] inv at /home/rdeits/.julia/packages/CoordinateTransformations/IrN9A/src/affine.jl:53 [inlined]
 [5] #settransform!#62(::Float64, ::Float64, ::Float64, ::Function, ::ArrowVisualizer{Visualizer}, ::Point{3,Float64}, ::Vec{3,Float64}) at /home/rdeits/.julia/packages/MeshCat/PHA8D/src/arrow_visualizer.jl:41
 [6] settransform!(::ArrowVisualizer{Visualizer}, ::Point{3,Float64}, ::Vec{3,Float64}) at /home/rdeits/.julia/packages/MeshCat/PHA8D/src/arrow_visualizer.jl:24
 [7] top-level scope at In[31]:1

Unable to install RigidBodySim due to unsatisfiable requirements from MeshCat

(v1.1) pkg> add RigidBodySim
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package MeshCatMechanisms [6ad125db]:
 MeshCatMechanisms [6ad125db] log:
 ├─possible versions are: [0.0.1-0.0.6, 0.1.0-0.1.1, 0.2.0-0.2.1, 0.3.0, 0.4.0, 0.5.0] or uninstalled
 ├─restricted by compatibility requirements with RigidBodyDynamics [366cf18f] to versions: [0.4.0, 0.5.0] or uninstalled
 │ └─RigidBodyDynamics [366cf18f] log:
 │   ├─possible versions are: [0.0.1-0.0.6, 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0-0.6.1, 0.7.0, 0.8.0, 0.9.0, 1.0.0-1.0.2, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 2.0.0, 2.1.0] or uninstalled
 │   └─restricted to versions 2.1.0 by an explicit requirement, leaving only versions 2.1.0
 ├─restricted by compatibility requirements with MeshCat [283c5d60] to versions: uninstalled
 │ └─MeshCat [283c5d60] log:
 │   ├─possible versions are: [0.0.1-0.0.3, 0.1.0-0.1.2, 0.2.0-0.2.3, 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.7.0] or uninstalled
 │   ├─restricted by julia compatibility requirements to versions: [0.1.0-0.1.2, 0.2.0-0.2.3, 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.7.0] or uninstalled
 │   └─restricted by compatibility requirements with WebIO [0f1e0344] to versions: 0.0.1-0.0.3 or uninstalled, leaving only versions: uninstalled
 │     └─WebIO [0f1e0344] log:
 │       ├─possible versions are: [0.1.0-0.1.10, 0.1.12, 0.2.0-0.2.8, 0.3.0-0.3.4, 0.4.0-0.4.2, 0.6.0-0.6.2, 0.7.0, 0.8.0-0.8.1, 0.8.3-0.8.8] or uninstalled
 │       └─restricted to versions 0.8.1 by an explicit requirement, leaving only versions 0.8.1
 └─restricted by compatibility requirements with RigidBodySim [e61f16d8] to versions: [0.1.1, 0.2.0-0.2.1, 0.3.0, 0.4.0, 0.5.0] — no versions left
   └─RigidBodySim [e61f16d8] log:
     ├─possible versions are: [0.0.1, 0.1.0, 0.2.0, 0.3.0, 1.0.0, 1.1.0, 1.2.0, 1.3.0] or uninstalled
     ├─restricted to versions * by an explicit requirement, leaving only versions [0.0.1, 0.1.0, 0.2.0, 0.3.0, 1.0.0, 1.1.0, 1.2.0, 1.3.0]
     ├─restricted by julia compatibility requirements to versions: [0.3.0, 1.0.0, 1.1.0, 1.2.0, 1.3.0] or uninstalled, leaving only versions: [0.3.0, 1.0.0, 1.1.0, 1.2.0, 1.3.0]
     └─restricted by compatibility requirements with RigidBodyDynamics [366cf18f] to versions: [1.2.0, 1.3.0] or uninstalled, leaving only versions: [1.2.0, 1.3.0]
       └─RigidBodyDynamics [366cf18f] log: see above

with_logger(NullLogger()) breaks MeshCat

I wanted to make MeshCat/the web stack a little less verbose, so I tried using with_logger(NullLogger()):

julia> using MeshCat

julia> vis = Visualizer()
MeshCat Visualizer with path /meshcat

julia> using Logging

julia> with_logger(NullLogger()) do
           open(vis)
       end
Process(`xdg-open http://127.0.0.1:8700`, ProcessExited(0))

Unfortunately, only the first time I run open(vis), I get

image

If I reload the browser tab, it's fine. Should open include a wait or something?

On the materials of COLLADA models (`.dae` files)

As of the current latest releases of MeshCat and MeshCatMechanisms there are still some issues loading the materials of a .dae model.

(v1.2) pkg> st
    Status `~/.julia/environments/v1.2/Project.toml`
  [283c5d60] MeshCat v0.8.0
  [6ad125db] MeshCatMechanisms v0.5.0

Below is a side-by-side comparison of the same model in MeshCat and in threejs.org/editor.

Screenshot from 2019-10-23 11-29-32

What should I be looking at to improve this? Would updating threejs resolve it (#54)? Or is there more to it than just that? Cheers! 🙂

Stop including meshcat as a submodule

This will stop working when packages are no longer full git checkouts in v0.7, so we need another way.

Ideally, we wouldn't even rely on git existing at all. Something like:

  • By default, we just download a tarball of the meshcat source, and record the current git sha so we can re-download if needed
  • Provide some way to develop meshcat by replacing the downloaded source with a git clone

Draw PolyLine

Is there a PolyLine that draws a continuous line. Like LineSegments, but connecting everything.

Displaying billboarded text

Any chance for supporting billboarded text (2D text that always faces the camera)?

Great library by the way! Similar to Drake without all the deps, nice.

Closing visualizer tab results in websocket connection error

Whenever I close a visualizer tab, I now (since a little while actually) get

Error handling websocket connection:
WebSockets.WebSocketClosedError("ws|server respond to OPCODE_CLOSE 1001:Going Away")
Stacktrace:
 [1] try_yieldto(::typeof(Base.ensure_rescheduled), ::Base.RefValue{Task}) at ./event.jl:196
 [2] wait() at ./event.jl:255
 [3] wait(::Condition) at ./event.jl:46
 [4] wait(::Task) at ./task.jl:188
 [5] create_socket(::Dict{Any,Any}) at /home/twan/.julia/packages/WebIO/Rk8wc/src/providers/mux.jl:44
 [6] (::getfield(Mux, Symbol("##5#6")){getfield(Mux, Symbol("##28#29")){Array{SubString{String},1}},typeof(WebIO.create_socket)})(::Function, ::Dict{Any,Any}) at /home/twan/.julia/packages/Mux/FeATY/src/Mux.jl:17
 [7] #1 at /home/twan/.julia/packages/Mux/FeATY/src/Mux.jl:10 [inlined]
 [8] splitquery(::getfield(Mux, Symbol("##1#2")){getfield(Mux, Symbol("##5#6")){getfield(Mux, Symbol("##28#29")){Array{SubString{String},1}},typeof(WebIO.create_socket)},getfield(Mux, Symbol("##1#2")){typeof(Mux.wclose),getfield(Mux, Symbol("##1#2")){getfield(Mux, Symbol("##18#19")){getfield(Mux, Symbol("##22#23")){Symbol,Int64}},getfield(Mux, Symbol("##20#21")){String}}}}, ::Dict{Any,Any}) at /home/twan/.julia/packages/Mux/FeATY/src/basics.jl:34
 [9] #1 at /home/twan/.julia/packages/Mux/FeATY/src/Mux.jl:10 [inlined]
 [10] wcatch(::getfield(Mux, Symbol("##1#2")){typeof(Mux.splitquery),getfield(Mux, Symbol("##1#2")){getfield(Mux, Symbol("##5#6")){getfield(Mux, Symbol("##28#29")){Array{SubString{String},1}},typeof(WebIO.create_socket)},getfield(Mux, Symbol("##1#2")){typeof(Mux.wclose),getfield(Mux, Symbol("##1#2")){getfield(Mux, Symbol("##18#19")){getfield(Mux, Symbol("##22#23")){Symbol,Int64}},getfield(Mux, Symbol("##20#21")){String}}}}}, ::Dict{Any,Any}) at /home/twan/.julia/packages/Mux/FeATY/src/websockets_integration.jl:12
 [11] todict at /home/twan/.julia/packages/Mux/FeATY/src/Mux.jl:10 [inlined]
 [12] #3 at /home/twan/.julia/packages/Mux/FeATY/src/Mux.jl:14 [inlined] (repeats 2 times)
 [13] (::getfield(Mux, Symbol("##1#2")){getfield(Mux, Symbol("##3#4")){getfield(Mux, Symbol("##3#4")){typeof(Mux.todict),typeof(Mux.wcatch)},typeof(Mux.splitquery)},getfield(Mux, Symbol("##1#2")){getfield(Mux, Symbol("##5#6")){getfield(Mux, Symbol("##28#29")){Array{SubString{String},1}},typeof(WebIO.create_socket)},getfield(Mux, Symbol("##1#2")){typeof(Mux.wclose),getfield(Mux, Symbol("##1#2")){getfield(Mux, Symbol("##18#19")){getfield(Mux, Symbol("##22#23")){Symbol,Int64}},getfield(Mux, Symbol("##20#21")){String}}}}})(::Tuple{HTTP.Messages.Request,WebSockets.WebSocket{Sockets.TCPSocket}}) at /home/twan/.julia/packages/Mux/FeATY/src/Mux.jl:10
 [14] (::getfield(Mux, Symbol("##9#10")){Mux.App})(::HTTP.Messages.Request, ::WebSockets.WebSocket{Sockets.TCPSocket}) at /home/twan/.julia/packages/Mux/FeATY/src/server.jl:49
 [15] upgrade(::getfield(Mux, Symbol("##9#10")){Mux.App}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at /home/twan/.julia/packages/WebSockets/pc4iW/src/HTTP.jl:201
 [16] (::getfield(WebSockets, Symbol("#_servercoroutine#11")){WebSockets.ServerWS})(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at /home/twan/.julia/packages/WebSockets/pc4iW/src/HTTP.jl:370
 [17] macro expansion at /home/twan/.julia/packages/HTTP/wY7Vc/src/Servers.jl:360 [inlined]
 [18] (::getfield(HTTP.Servers, Symbol("##13#14")){getfield(WebSockets, Symbol("#_servercoroutine#11")){WebSockets.ServerWS},HTTP.ConnectionPool.Transaction{Sockets.TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})() at ./task.jl:259

fallback for other JSON Material attributes

Not exactly an issue, but I needed to visualize some wireframes, and I wanted to try using MeshCat.jl. Here's the hack I was able to do:

import MeshCat
const mc = MeshCat

"""low-level access to three js JSON interface
See https://github.com/mrdoob/three.js/blob/master/src/loaders/MaterialLoader.js"""
mutable struct OverlayMaterial{T<:mc.AbstractMaterial, OVT} <: mc.AbstractMaterial
  underlying::T
  overlay::Dict{String, OVT}
end

function mc.lower(material::OverlayMaterial)
  merge(mc.lower(material.underlying), material.overlay)
end

wireframe_material = OverlayMaterial(
    mc.MeshPhongMaterial(color=mc.RGBA{Float32}(0.8, 0.8, 0.8, 1)),
    Dict{String, Any}("wireframe"=>true))

That might be a good escape hatch to support any possible feature of the three js loaders.

Badly degraded performance with latest WebIO

Upgrading from WebIO 0.8.6 to 0.8.8 (with MeshCat master) seems to cause geometry loading to become much slower. If you load Atlas, each individual link pops up about half a second after the other. I'll try to make a repro later, but I'm a little pressed for time right now.

CC: @travigd.

Add contour meshes

Ideally, this would involve porting my fixes from DrakeVisualizer.jl into Meshing.jl.

JSExpr warnings

Now that JuliaGizmos/JSExpr.jl#14 is in, I'm getting:

julia> Pkg.test("MeshCat")
INFO: Computing test dependencies for MeshCat...
INFO: No packages to install, update or remove
INFO: Testing MeshCat
WARNING: eval from module JSExpr to MeshCat:    
Expr(:call, :macroexpand, quote Expr(:macrocall, :@var, :element = Expr(:ref, Expr(:., Expr(:., :this, Expr(:quote, :dom)::Any)::Any, Expr(:quote, :children)::Any)::Any, 0)::Any)::Any end)::Any
  ** incremental compilation may be broken for this module **

WARNING: eval from module JSExpr to MeshCat:    
Expr(:call, :macroexpand, quote Expr(:macrocall, :@new, Expr(:call, Expr(:., :mc, Expr(:quote, :Viewer)::Any)::Any, :element)::Any)::Any end)::Any
  ** incremental compilation may be broken for this module **

list children or haskey type function for the tree

Say I have a Meshcat Visualizer object (vis) with vis[:poses][:x1] and vis[:poses][:x2]

Is there a way to get a list (:x1,:x2) of children for vis[:poses] or a haskey(vis[:poses], :x1) kind of function similar to a Dictionary? This information in the local object would be nice.

I would also like to know how to 'getObject' for example the transform of vis[:poses][:x1]?

cc @dehann

More synchronous operations

Currently, most of the actual communication happens in background tasks, which means that the viewer doesn't update until the current task yields for a while. It would be nice to change that, at least optionally, to make the viewer's behavior more deterministic.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.