Closed eisoku9618 closed 6 years ago
@eisoku9618 how about
(load "irteus/demo/sample-robot-model.l")
(setq *r* (instance sample-robot :init))
(eus2stl "robot.stl" (instance bodyset :init (make-cascoords) :bodies (mapcar #'(lambda (b) (body-to-faces b)) (send *r* :bodies))))
(send-all (send *robot* :bodies) :faces)
returns convex-hull. It's defined at euscollada.
You can use glvertices(mesh description for drawing) directly, like this.
(let (glv-lst)
(dolist (bd (send *pr2* :bodies))
(let (glv)
(cond
((and (boundp 'gl::glbody) (classp gl::glbody) (derivedp bd gl::glbody))
(setq glv (send bd :glvertices))
)
(t
(setq glv (cdr (assoc 'glvertices (send bd :slots)))))
)
(when glv
(push glv glv-lst))
))
(apply #'save-mesh-file "/tmp/pr2.stl" (append-glvertices glv-lst :use-coordinate t) nil)
)
@k-okada sensei, @YoheiKakiuchi san, Thank you very much. Now I can get a detailed whole-body STL file !
With okada-sensei way, I could not get a detailed STL file as kakiuchi-san comment
(send-all (send *robot* :bodies) :faces)
returns convex-hull
In kakiuchi-san way, :use-coordinate
option is used, but append-glvertices
does not have this option, so I added it at https://github.com/jsk-ros-pkg/jsk_model_tools/pull/210
…m-faces
dump-to-meshfile
did not work becausefaces
in(funcall #'gl::make-glvertices-from-faces faces :material mat)
was not set and it was nil.By the way,,, Could you suggest some ideas about how to get a fine/detailed single whole-body STL file (pr2_whole_body.stl) from a URDF robot model having multiple links (pr2.urdf). For example, if we want to create a PR2 key holder by 3D printer, we need to generate one fine/detailed STL file.
After JSK conventional urdf -> collada -> euslisp conversion, I tried to convert the euslisp model to a STL file with this PR, but the output STL files looks like convex hull and it is not a fine/detailed STL file. Also, I tried to convert collada -> STL with meshlab, but meshlab does not understand translation information and all the links are located at world origin as follows.