Created
June 6, 2020 21:42
-
-
Save knorth55/972d530b4acb975a4cbe7ac14af82515 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require "package://hrpsys_ros_bridge_tutorials/euslisp/hrp2jsk-interface.l") | |
(defun main () | |
(let ((faces (flatten (send-all (flatten (send-all (send *hrp2jsk* :links) :bodies)) :faces))) | |
(face-i 0)) | |
(while (< face-i (length faces)) | |
(send *viewer* :draw-objects :flush nil) | |
(do-until-key | |
(let ((i 0)) | |
(while (< i (length faces)) | |
(let* ((f (elt faces i)) | |
(normal (scale 200 (send f :normal))) | |
(vertices (send f :vertices)) | |
(center #f(0 0 0)) | |
(prev-v nil)) | |
(if (eq face-i i) | |
(progn | |
(send *viewer* :viewsurface :line-width 3) | |
(send *viewer* :viewsurface :color #F(1.0 0 0)) | |
(dolist (v vertices) | |
(if prev-v (send *viewer* :draw-line prev-v v)) | |
(setq prev-v v) | |
(setq center (v+ center v))) | |
(setq center (scale (/ 1.0 (length vertices)) center)) | |
(send *viewer* :draw-arrow center (v+ center normal))) | |
(progn | |
(send *viewer* :viewsurface :line-width 0.5) | |
(send *viewer* :viewsurface :color #F(0 1.0 0)) | |
(dolist (v vertices) | |
(if prev-v (send *viewer* :draw-line prev-v v)) | |
(setq prev-v v))))) | |
(setq i (+ i 1)))) | |
(send *viewer* :viewsurface :flush) | |
(x::window-main-one) | |
(unix::usleep (* 100 1000))) | |
(setq face-i (+ face-i 1))))) | |
(setq *hrp2jsk* (hrp2jsk)) | |
(when (not (and (boundp '*viewer*) *viewer*)) | |
(make-irtviewer :draw-origin nil :draw-floor #F(0 0 0) :title "hrp2jsk-normal.l")) | |
(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment