Skip to content

irtviewerに表示したことがあるobjectをdump-objectしてreadすると:set-colorできない #613

@pazeshun

Description

@pazeshun

一度でもirtviewerに表示したことがあるobjectをdump-objectでファイルに保存し、別のeusインスタンスからreadして作成したobjectに対して、:set-colorをしようとするとエラーになります。

$ irteusgl
configuring by "/opt/ros/melodic/share/euslisp/jskeus/eus//lib/eusrt.l"
;; readmacro ;; object ;; packsym ;; common ;; constants ;; stream ;; string ;; loader ;; pprint ;; process ;; hashtab ;; array ;; mathtran ;; eusdebug ;; eusforeign ;; extnum ;; coordinates ;; tty ;; history ;; toplevel ;; trans ;; comp ;; builtins ;; par ;; intersection ;; geoclasses ;; geopack ;; geobody ;; primt ;; compose ;; polygon ;; viewing ;; viewport ;; viewsurface ;; hid ;; shadow ;; bodyrel ;; dda ;; helpsub ;; eushelp ;; xforeign ;; Xdecl ;; Xgraphics ;; Xcolor ;; Xeus ;; Xevent ;; Xpanel ;; Xitem ;; Xtext ;; Xmenu ;; Xscroll ;; Xcanvas ;; Xtop ;; Xapplwin 
connected to Xserver DISPLAY=:0
X events are being asynchronously monitored.
;; pixword ;; RGBHLS ;; convolve ;; piximage ;; pbmfile ;; image_correlation ;; oglforeign ;; gldecl ;; glconst ;; glforeign ;; gluconst ;; gluforeign ;; glxconst ;; glxforeign ;; eglforeign ;; eglfunc ;; glutil ;; gltexture ;; glprim ;; gleus ;; glview ;; toiv-undefined ;; fstringdouble irtmath irtutil irtc irtgeoc irtgraph ___time ___pgsql irtgeo euspqp pqp irtscene irtmodel irtdyna irtrobot irtsensor irtbvh irtcollada irtstl irtwrl irtpointcloud eusbullet bullet irtcollision irtx eusjpeg euspng png irtimage irtglrgb 
;; extending gcstack 0x55f51f982690[16374] --> 0x55f51fe08250[32748] top=3c88
irtgl irtglc irtviewer 
EusLisp 9.27( 1.2.2) for Linux64 created on ip-10-0-1-65(Tue May 4 17:29:14 PST 2021)
1.irteusgl$ (setq test (make-cube 100 100 100))
#<body #X55f51fc38610 (:cube 100.0 100.0 100.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>
2.irteusgl$ (send test :set-color :red)
#f(0.996094 0.0 0.0)
3.irteusgl$ (objects (list test))
;; (make-irtviewer) executed
(#<body #X55f51fc38610 (:cube 100.0 100.0 100.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>)
4.irteusgl$ (dump-object "test.l" test)
nil
5.irteusgl$ quit
$ irteusgl
configuring by "/opt/ros/melodic/share/euslisp/jskeus/eus//lib/eusrt.l"
;; readmacro ;; object ;; packsym ;; common ;; constants ;; stream ;; string ;; loader ;; pprint ;; process ;; hashtab ;; array ;; mathtran ;; eusdebug ;; eusforeign ;; extnum ;; coordinates ;; tty ;; history ;; toplevel ;; trans ;; comp ;; builtins ;; par ;; intersection ;; geoclasses ;; geopack ;; geobody ;; primt ;; compose ;; polygon ;; viewing ;; viewport ;; viewsurface ;; hid ;; shadow ;; bodyrel ;; dda ;; helpsub ;; eushelp ;; xforeign ;; Xdecl ;; Xgraphics ;; Xcolor ;; Xeus ;; Xevent ;; Xpanel ;; Xitem ;; Xtext ;; Xmenu ;; Xscroll ;; Xcanvas ;; Xtop ;; Xapplwin 
connected to Xserver DISPLAY=:0
X events are being asynchronously monitored.
;; pixword ;; RGBHLS ;; convolve ;; piximage ;; pbmfile ;; image_correlation ;; oglforeign ;; gldecl ;; glconst ;; glforeign ;; gluconst ;; gluforeign ;; glxconst ;; glxforeign ;; eglforeign ;; eglfunc ;; glutil ;; gltexture ;; glprim ;; gleus ;; glview ;; toiv-undefined ;; fstringdouble irtmath irtutil irtc irtgeoc irtgraph ___time ___pgsql irtgeo euspqp pqp irtscene irtmodel irtdyna irtrobot irtsensor irtbvh irtcollada irtstl irtwrl irtpointcloud eusbullet bullet irtcollision irtx eusjpeg euspng png irtimage irtglrgb 
;; extending gcstack 0x56230f1b2690[16374] --> 0x56230f638250[32748] top=3c88
irtgl irtglc irtviewer 
EusLisp 9.27( 1.2.2) for Linux64 created on ip-10-0-1-65(Tue May 4 17:29:14 PST 2021)
1.irteusgl$ (with-open-file (f "test.l" :direction :input) (setq test (read f)))
#<body #X56230f468848 (:cube 100.0 100.0 100.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>
2.irteusgl$ (send test :set-color :red)
Call Stack (max depth: 20):
  0: at (send test :set-color :red)
  1: at #<compiled-code #X56230f2693e8>
irteusgl 0 error: could not find viewers for (94511292478592 . 1) in (send test :set-color :red)
3.E1-irteusgl$ reset
4.irteusgl$ (objects (list test))
;; (make-irtviewer) executed
(#<body #X56230f468848 (:cube 100.0 100.0 100.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>)
5.irteusgl$ (send test :set-color :red)
Call Stack (max depth: 20):
  0: at (send test :set-color :red)
  1: at #<compiled-code #X56230f2693e8>
irteusgl 0 error: could not find viewers for (94511292478592 . 1) in (send test :set-color :red)

一方で、一回もirtviewerに表示したことのないobjectに同様の操作をしても、エラーになりません。

$ irteusgl
configuring by "/opt/ros/melodic/share/euslisp/jskeus/eus//lib/eusrt.l"
;; readmacro ;; object ;; packsym ;; common ;; constants ;; stream ;; string ;; loader ;; pprint ;; process ;; hashtab ;; array ;; mathtran ;; eusdebug ;; eusforeign ;; extnum ;; coordinates ;; tty ;; history ;; toplevel ;; trans ;; comp ;; builtins ;; par ;; intersection ;; geoclasses ;; geopack ;; geobody ;; primt ;; compose ;; polygon ;; viewing ;; viewport ;; viewsurface ;; hid ;; shadow ;; bodyrel ;; dda ;; helpsub ;; eushelp ;; xforeign ;; Xdecl ;; Xgraphics ;; Xcolor ;; Xeus ;; Xevent ;; Xpanel ;; Xitem ;; Xtext ;; Xmenu ;; Xscroll ;; Xcanvas ;; Xtop ;; Xapplwin 
connected to Xserver DISPLAY=:0
X events are being asynchronously monitored.
;; pixword ;; RGBHLS ;; convolve ;; piximage ;; pbmfile ;; image_correlation ;; oglforeign ;; gldecl ;; glconst ;; glforeign ;; gluconst ;; gluforeign ;; glxconst ;; glxforeign ;; eglforeign ;; eglfunc ;; glutil ;; gltexture ;; glprim ;; gleus ;; glview ;; toiv-undefined ;; fstringdouble irtmath irtutil irtc irtgeoc irtgraph ___time ___pgsql irtgeo euspqp pqp irtscene irtmodel irtdyna irtrobot irtsensor irtbvh irtcollada irtstl irtwrl irtpointcloud eusbullet bullet irtcollision irtx eusjpeg euspng png irtimage irtglrgb 
;; extending gcstack 0x558e38b10690[16374] --> 0x558e38f96250[32748] top=3c88
irtgl irtglc irtviewer 
EusLisp 9.27( 1.2.2) for Linux64 created on ip-10-0-1-65(Tue May 4 17:29:14 PST 2021)
1.irteusgl$ (setq test (make-cube 100 100 100))
#<body #X558e38dc6650 (:cube 100.0 100.0 100.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>
2.irteusgl$ (send test :set-color :red)
#f(0.996094 0.0 0.0)
3.irteusgl$ (dump-object "test.l" test)
nil
4.irteusgl$ quit
$ irteusgl
configuring by "/opt/ros/melodic/share/euslisp/jskeus/eus//lib/eusrt.l"
;; readmacro ;; object ;; packsym ;; common ;; constants ;; stream ;; string ;; loader ;; pprint ;; process ;; hashtab ;; array ;; mathtran ;; eusdebug ;; eusforeign ;; extnum ;; coordinates ;; tty ;; history ;; toplevel ;; trans ;; comp ;; builtins ;; par ;; intersection ;; geoclasses ;; geopack ;; geobody ;; primt ;; compose ;; polygon ;; viewing ;; viewport ;; viewsurface ;; hid ;; shadow ;; bodyrel ;; dda ;; helpsub ;; eushelp ;; xforeign ;; Xdecl ;; Xgraphics ;; Xcolor ;; Xeus ;; Xevent ;; Xpanel ;; Xitem ;; Xtext ;; Xmenu ;; Xscroll ;; Xcanvas ;; Xtop ;; Xapplwin 
connected to Xserver DISPLAY=:0
X events are being asynchronously monitored.
;; pixword ;; RGBHLS ;; convolve ;; piximage ;; pbmfile ;; image_correlation ;; oglforeign ;; gldecl ;; glconst ;; glforeign ;; gluconst ;; gluforeign ;; glxconst ;; glxforeign ;; eglforeign ;; eglfunc ;; glutil ;; gltexture ;; glprim ;; gleus ;; glview ;; toiv-undefined ;; fstringdouble irtmath irtutil irtc irtgeoc irtgraph ___time ___pgsql irtgeo euspqp pqp irtscene irtmodel irtdyna irtrobot irtsensor irtbvh irtcollada irtstl irtwrl irtpointcloud eusbullet bullet irtcollision irtx eusjpeg euspng png irtimage irtglrgb 
;; extending gcstack 0x559aedb8a690[16374] --> 0x559aee010250[32748] top=3c88
irtgl irtglc irtviewer 
EusLisp 9.27( 1.2.2) for Linux64 created on ip-10-0-1-65(Tue May 4 17:29:14 PST 2021)
1.irteusgl$ (with-open-file (f "test.l" :direction :input) (setq test (read f)))
#<body #X559aede40808 (:cube 100.0 100.0 100.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>
2.irteusgl$ (send test :set-color :red)
#f(0.996094 0.0 0.0)

少し原因を探ったところ、
https://github.com/euslisp/jskeus/blob/1.2.5/irteus/irtgl.l#L445
でエラーが起きていて、それは
https://github.com/euslisp/jskeus/blob/1.2.5/irteus/irtgl.l#L120
から上がっているようです。
確かに、dumpされたファイルを読んでみると、:gl-displaylist-idに数値がベタ書きされていて、これが各eusインスタンスのirtviewer固有の値なので、それを新しいeusインスタンスで検索してもヒットしない、というのは当然だ、ということまでわかりましたが、どう直せば良いのかがあまりわからず、一旦issueにしました。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions