MeshCat.jl icon indicating copy to clipboard operation
MeshCat.jl copied to clipboard

setobject!() ERROR: 'no method matching setobject'

Open PratyushBhattacharya opened this issue 4 years ago • 2 comments

I'm a greenhorn in Julia & meshcat. I'm trying to run the demo codes in the meshcat GitHUb page in Juno-Atom, but it cannot find the 'setobject!' method. Please help!

`using MeshCat using GeometryTypes using CoordinateTransformations

vis = Visualizer()

open(vis)

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

ERROR:

┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser: ort └ http://127.0.0.1:8703
ERROR: LoadError: MethodError: no method matching setobject!(::Visiisualizer, ::HyperRectangle{3, Float64}) Closest candidates are: setobject!(::AbstractVisualizer, ::GeometryLike) at C:\Users\AisiSUS.julia\packages\MeshCat\GlCMx\src\abstract_visualizer.jl:21 setobject!(::AbstractVisualizer, ::GeometryLike, ::AbstractMaterial) at C:\Users\ASUS.julia\packages\MeshCat\GlCMx\src\abstraisuct_visualizer.jl:29 setobject!(::Visualizer, ::AbstractObject) at C:\Users\ASUS.julia\packages\MeshCat\GlCMx\src\visualizer.jl:199 SUS Stacktrace:
[1] top-level scope eri @ C:\Users\ASUS\AppData\Local\atom\app-1.57.0\scratch.jl:9 tis [2] eval @ .\boot.jl:360 [inlined] uli [3] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) @ Base .\loading.jl:1094 in expression starting at C:\Users\ASUS\AppData\Local\atom\app-1 .57.0\scratch.jl:9 julia>

PratyushBhattacharya avatar Jun 06 '21 09:06 PratyushBhattacharya

@PratyushBhattacharya I ran into the same thing - looks like the problem crops up from the switch from GeometryTypes (deprecated) to GeometryBasics (commit 9feb28). Both packages define many of the same types, but GeometryLike in MeshCat.jl is defined only for the latter package. Hence changing the example code in the README file as follows should do the trick:

- using GeometryTypes
+ using GeometryBasics

ornithos avatar Aug 07 '21 16:08 ornithos

You are correct, @ornithos. We should update the examples in the README.md, since the latest releases of MeshCat.jl are now using GeometryBasics.jl instead of GeometryTypes.jl.

ferrolho avatar Aug 12 '21 15:08 ferrolho

This issue has now been resolved. The only thing to note is that the contours example is not working because GeometryBasics.jl does not have a SignedDistanceField method, which GeometryTypes.jl used to have. I've captured this in issue https://github.com/rdeits/MeshCat.jl/issues/239, so I'm going to close this one.

ferrolho avatar May 14 '23 09:05 ferrolho