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

[eus_assimp] need to set faces before calling gl::make-glvertices-fro… #208

Merged
merged 1 commit into from Jul 20, 2017

Conversation

eisoku9618
Copy link
Contributor

…m-faces

dump-to-meshfile did not work because faces in (funcall #'gl::make-glvertices-from-faces faces :material mat) was not set and it was nil.

(progn                                                                          
  (load "package://pr2eus/pr2.l")                                               
  (load "package://eus_assimp/euslisp/eus-assimp.l")                            
  (setq *robot* (pr2))                                                          
  (objects (list *robot*))                                                      
  (dump-to-meshfile "/tmp/robot.stl" *robot*)                                   
  (unix::system "meshlab /tmp/robot.stl"))

image


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.

image

@k-okada
Copy link
Member

k-okada commented Jul 19, 2017

@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))))

using euslisp/jskeus#248

Copy link
Member

@YoheiKakiuchi YoheiKakiuchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@k-okada k-okada merged commit 7c611f0 into jsk-ros-pkg:master Jul 20, 2017
@YoheiKakiuchi
Copy link
Member

(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)
  )

@eisoku9618
Copy link
Contributor Author

@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 #210

k-okada added a commit to k-okada/jskeus that referenced this pull request Jul 24, 2017
k-okada added a commit to k-okada/jskeus that referenced this pull request Jun 11, 2020
k-okada added a commit to k-okada/jskeus that referenced this pull request Jun 11, 2020
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 this pull request may close these issues.

None yet

3 participants