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

[pr2eus_moveit/collision-object-publisher] support body class object #269

Merged
merged 1 commit into from
Dec 7, 2016

Conversation

knorth55
Copy link
Member

@knorth55 knorth55 commented Dec 5, 2016

What changed

  • support body class object, which do not have :bodies method.

@k-okada
Copy link
Member

k-okada commented Dec 6, 2016

do you really need :worldcoords?

(setq obj (make-cube 100 100 100))
(setq obj-2 (make-cube 100 100 100))
(send obj :assoc obj-2)
(send obj :locate #f(123 123 123))
(objects (list obj obj-2))
(print (send obj :worldpos))
(print (send obj :vertices))
(print (send obj-2 :worldpos))
(print (send obj-2 :vertices))
(if nil
    (progn
      (send obj :move-to (make-coords)) ;; ng                                   
      (send obj :worldcoords)
      )
  (progn
    (send obj :reset-coords) ;; ok                                              
    ))
(print "--")
(print (send obj :worldpos))
(print (send obj :vertices))
(print (send obj-2 :worldpos))
(print (send obj-2 :vertices))

@knorth55
Copy link
Member Author

knorth55 commented Dec 6, 2016

@k-okada this :worldcoords is for lazy-evaluation as euslisp/jskeus#384?

@k-okada
Copy link
Member

k-okada commented Dec 6, 2016 via email

@knorth55
Copy link
Member Author

knorth55 commented Dec 6, 2016

(send obj :worldpos) calls :world-coords, and if i remove it, the output is changed.

(setq obj (make-cube 100 100 100))
(setq obj-2 (make-cube 100 100 100))
(send obj :assoc obj-2)
(send obj :locate #f(123 123 123))
(objects (list obj obj-2))
(print (send obj :vertices))
(print (send obj-2 :vertices))
(if nil
    (progn
      (send obj :move-to (make-coords)) ;; ng                                   
      (send obj :worldcoords)
      )
  (progn
    (send obj :reset-coords) ;; ok                                              
    ))
(print "--")
(print (send obj :vertices))
(print (send obj-2 :vertices))

output:

(#f(173.0 173.0 73.0) #f(173.0 173.0 173.0) #f(173.0 73.0 73.0) #f(173.0 73.0 173.0) #f(73.0 173.0 73.0) #f(73.0 73.0 73.0) #f(73.0 73.0 173.0) #f(73.0 173.0 173.0))
(#f(173.0 173.0 73.0) #f(173.0 173.0 173.0) #f(173.0 73.0 73.0) #f(173.0 73.0 173.0) #f(73.0 173.0 73.0) #f(73.0 73.0 73.0) #f(73.0 73.0 173.0) #f(73.0 173.0 173.0))
"--"
(#f(173.0 173.0 73.0) #f(173.0 173.0 173.0) #f(173.0 73.0 73.0) #f(173.0 73.0 173.0) #f(73.0 173.0 73.0) #f(73.0 73.0 73.0) #f(73.0 73.0 173.0) #f(73.0 173.0 173.0))
(#f(173.0 173.0 73.0) #f(173.0 173.0 173.0) #f(173.0 73.0 73.0) #f(173.0 73.0 173.0) #f(73.0 173.0 73.0) #f(73.0 73.0 73.0) #f(73.0 73.0 173.0) #f(73.0 173.0 173.0))

@knorth55
Copy link
Member Author

knorth55 commented Dec 6, 2016

I tried code below, and my conclusion is :worldcoords is needed but (send-all (send obj :bodies) :worldcoords) is unnecessary.

(let (c2 c2 obj cds)
  (setq c1 (make-cube 100 100 100))
  (send c1 :set-color :red)
  (setq c2 (make-cylinder 30 100))
  (send c2 :set-color :green)
  (send c1 :assoc c2)
  (setq obj (instance bodyset :init (make-cascoords)
                      :bodies (list c1 c2)))
  (send obj :locate #f(123 123 123))
  (setq cds (send obj :copy-coords))
  (format t "(send obj :locate #f(123 123 123))~%")
  (print (send-all (send (body-to-faces obj) :faces) :vertices))
  (send obj :worldcoords)
  (format t "(send obj :worldcoords)~%")
  (print (send-all (send (body-to-faces obj) :faces) :vertices))
  (send obj :reset-coords)
  (format t "(send obj :reset-coords)~%")
  (print (send-all (send (body-to-faces obj) :faces) :vertices))
  (send obj :worldcoords)
  (format t "(send obj :worldcoords)~%")
  (print (send-all (send (body-to-faces obj) :faces) :vertices))
  (send obj :transform cds)
  (format t "(send obj :transform cds)~%")
  (print (send-all (send (body-to-faces obj) :faces) :vertices))
  (send obj :worldcoords)
  (format t "(send obj :worldcoords)~%")
  (print (send-all (send (body-to-faces obj) :faces) :vertices)))

@knorth55
Copy link
Member Author

knorth55 commented Dec 6, 2016

this line is added in ab092e1, and I'm not sure if this line is really necessary

@YoheiKakiuchi
Copy link
Member

I forget why I added (send-all ...
If sample works well, it is not necessary

@k-okada k-okada merged commit b3e8658 into jsk-ros-pkg:master Dec 7, 2016
@knorth55 knorth55 deleted the collision-object-make-body branch December 7, 2016 08:46
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