jsk-ros-pkg / jsk_model_tools

JSK model utilities
https://github.com/jsk-ros-pkg/jsk_model_tools
BSD 3-Clause "New" or "Revised" License
5 stars 27 forks source link

[euscollada] Support passing limbs to predefined pose method #172

Closed wkentaro closed 8 years ago

wkentaro commented 8 years ago

Modified:

wkentaro commented 8 years ago

to allow

(send *robot* :reset-pose :rarm)
wkentaro commented 8 years ago

Could you please review and merge?

k-okada commented 8 years ago

@YoheiKakiuchi

◉ Kei Okada

On Mon, Apr 11, 2016 at 5:13 PM, Kentaro Wada notifications@github.com wrote:

Could you please review and merge?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/jsk-ros-pkg/jsk_model_tools/pull/172#issuecomment-208219426

wkentaro commented 8 years ago

Below is robot model generated with this commit:

YoheiKakiuchi commented 8 years ago

Could you please take care about readability. Generated code may be like this.

    (:reset-pose
     (&optional (limbs '(:rleg :lleg :torso :head :rarm :larm)))
     (unless (listp limbs) (setq limbs (list limbs)))
     (dolist (limb limbs)
       (case limb
         (:rleg (send self limb :angle-vector (float-vector 0.000000 0.000000 -26.000000 50.000000 -24.000000 0.000000 0.000000)))
         (:lleg (send self limb :angle-vector (float-vector 0.000000 0.000000 -26.000000 50.000000 -24.000000 0.000000 0.000000)))
         (:torso (send self limb :angle-vector (float-vector 0.000000 0.000000)))
         (:head (send self limb :angle-vector (float-vector 0.000000 0.000000)))
         (:rarm (send self limb :angle-vector (float-vector 10.000000 -10.000000 0.000000 -25.000000 0.000000 0.000000 -10.000000 15.000000)))
         (:larm (send self limb :angle-vector (float-vector 10.000000 10.000000 0.000000 -25.000000 0.000000 0.000000 -10.000000 -15.000000)))
         (t (format t "Unknown limb is passed: ~a~%" limb))))
     (send self :angle-vector))
wkentaro commented 8 years ago

@YoheiKakiuchi Thank you for the review. I have updated the commit. Could you please review again?

$ cat baxter.l | grep '(:reset-pose (&optional' -A10
    (:reset-pose (&optional (limbs '(:head :larm :rarm)))
      (unless (listp limbs) (setq limbs (list limbs)))
      (dolist (limb limbs)
        (case limb
          (:head (send self limb :angle-vector (float-vector 0.000000)))
          (:larm (send self limb :angle-vector (float-vector 20.000000 -25.000000 -40.000000 60.000000 -20.000000 80.000000 0.000000)))
          (:rarm (send self limb :angle-vector (float-vector -20.000000 -25.000000 40.000000 60.000000 20.000000 80.000000 0.000000)))
          (t (format t "Unknown limb is passed: ~a~%" limb))))
      (send self :angle-vector))
    (:tuck-pose (&optional (limbs '(:head :larm :rarm)))
      (unless (listp limbs) (setq limbs (list limbs)))
k-okada commented 8 years ago

Did you confirm if this work for robot like one arm/leg, such as Pepper or Fetch?

I feel it's much safer to update code like ;; if limb is not given (send self :angle-vector #f(....)) ;; else (dolist ...

Or is this too redundant?

◉ Kei Okada

2016/04/11 18:32、Yohei Kakiuchi notifications@github.com のメッセージ:

Could you please take care about readability. Generated code may be like this.

(:reset-pose
 (&optional (limbs '(:rleg :lleg :torso :head :rarm :larm)))
 (unless (listp limbs) (setq limbs (list limbs)))
 (dolist (limb limbs)
   (case limb
     (:rleg (send self limb :angle-vector (float-vector 0.000000 0.000000 -26.000000 50.000000 -24.000000 0.000000 0.000000)))
     (:lleg (send self limb :angle-vector (float-vector 0.000000 0.000000 -26.000000 50.000000 -24.000000 0.000000 0.000000)))
     (:torso (send self limb :angle-vector (float-vector 0.000000 0.000000)))
     (:head (send self limb :angle-vector (float-vector 0.000000 0.000000)))
     (:rarm (send self limb :angle-vector (float-vector 10.000000 -10.000000 0.000000 -25.000000 0.000000 0.000000 -10.000000 15.000000)))
     (:larm (send self limb :angle-vector (float-vector 10.000000 10.000000 0.000000 -25.000000 0.000000 0.000000 -10.000000 -15.000000)))
     (t (format t "Unknown limb is passed: ~a~%" limb))))
 (send self :angle-vector))

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

wkentaro commented 8 years ago

@k-okada

Did you confirm if this work for robot like one arm/leg, such as Pepper or Fetch?[

I think it works, because they don't have only one limb, like (:rarm, :head, :torso for Fetch).

$ roseus fetch.l
2.irteusgl$ send *fetch* :reset-pose
#f(2.86479 75.6304 80.2141 -11.4592 98.5487 0.0 95.111 0.0 0.0 0.0)
3.irteusgl$ send *fetch* :reset-pose :rarm
#f(2.86479 75.6304 80.2141 -11.4592 98.5487 0.0 95.111 0.0 0.0 0.0)
4.irteusgl$ send *fetch* :reset-pose :larm
Unknown limb is passed: :larm
#f(2.86479 75.6304 80.2141 -11.4592 98.5487 0.0 95.111 0.0 0.0 0.0)
5.irteusgl$ send *fetch* :reset-pose :head
#f(2.86479 75.6304 80.2141 -11.4592 98.5487 0.0 95.111 0.0 0.0 0.0)
$ grep ':reset-pose (&optional' fetch.l -A8
    (:reset-pose (&optional (limbs '(:torso :rarm :head)))
      (unless (listp limbs) (setq limbs (list limbs)))
      (dolist (limb limbs)
        (case limb
          (:torso (send self limb :angle-vector (float-vector 2.864790)))
          (:rarm (send self limb :angle-vector (float-vector 75.630400 80.214100 -11.459200 98.548700 0.000000 95.111000 0.000000)))
          (:head (send self limb :angle-vector (float-vector 0.000000 0.000000)))
          (t (format t "Unknown limb is passed: ~a~%" limb))))
      (send self :angle-vector))
snozawa commented 8 years ago

It would be nice to add:

wkentaro commented 8 years ago

@YoheiKakiuchi @snozawa As the author of pr2.sh, nao.sh and darwin.sh, do you know how to run these test scripts with catkin run_tests command? I'm looking for cmake function to run shell script as test, like roslaunch_add_file_check do for roslauch file.

wkentaro commented 8 years ago

I added a simple tool for this. https://github.com/jsk-ros-pkg/jsk_common/pull/1371 And added the test: https://github.com/jsk-ros-pkg/jsk_model_tools/pull/175