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

Collision avoidance IK easily failed on HIRONXJSK #613

Open
YUKINA-3252 opened this issue Oct 11, 2022 · 5 comments
Open

Collision avoidance IK easily failed on HIRONXJSK #613

YUKINA-3252 opened this issue Oct 11, 2022 · 5 comments

Comments

@YUKINA-3252
Copy link

I want to try collision avoidance IK on HIRONXJSK with the following modification to the model:
master...YUKINA-3252:rtmros_tutorials:hironxjsk-collision-ik
But the following code

(hironxjsk-init)
(objects (list *hironxjsk*))
(send *hironxjsk* :reset-manip-pose)
(send *hironxjsk* :rarm :move-end-pos #f(0 150 0) :world :debug-view t :check-collision t)

returned IK failure:
https://gist.github.com/YUKINA-3252/2a82d117c721e070c80d1db12a45e22f

This code succeeded when I did not use collision avoidance IK (set no collision-avoidance-links):
master...YUKINA-3252:rtmros_tutorials:hironxjsk-collision
log: https://gist.github.com/YUKINA-3252/363559b66b0e4b10f950ff78b4d4638e

cc @pazeshun @k-okada

@knorth55
Copy link
Member

can you check this PR to show and visualize the default collision pairs?
jsk-ros-pkg/jsk_robot#895

@Naoki-Hiraoka
Copy link
Contributor

これは、https://github.com/euslisp/jskeus/blob/3040a1aa1cce1326c2e79890111d099b07207479/irteus/irtmodel.l#L1838-L1862 の手法を使う限り避けられない問題で、以下のようなパラチューンでなんとかするしかないと思います。

(send *robot* :rarm :move-end-pos #f(0 150 0) :world :debug-view t :check-collision t :avoid-collision-joint-gain 0.0) 
(send *robot* :rarm :move-end-pos #f(0 150 0) :world :debug-view t :check-collision t :avoid-collision-distance 100) 

@YUKINA-3252
Copy link
Author

@knorth55
The two photos below show how the following code was sent.

(hironxjsk-init)
(objects (list *hironxjsk*))
(send *hironxjsk* :reset-manip-pose)
(send-all (send *hironxjsk* :collision-avoidance-links) :draw-on :flush t)

Screenshot from 2022-10-12 15-23-25
Screenshot from 2022-10-12 15-23-38

The three photos below show how the following code was sent.

(hironxjsk-init)
(objects (list *hironxjsk*))
(send *hironxjsk* :reset-manip-pose)
(send *hironxjsk* :rarm :move-end-pos #f(0 150 0) :world :debug-view t :check-collision t :revert-if-fail t)
(send-all (send *hironxjsk* :collision-avoidance-links) :draw-on :flush t)

Screenshot from 2022-10-12 15-25-08
Screenshot from 2022-10-12 15-24-41

Screenshot from 2022-10-12 15-25-37

@Naoki-Hiraoka
I made this issue because I am wondering if there are any issues related to HIRO links, etc., before I solve the problem with the ik methodology itself.
I will try to use the method you introduced for solving ik hereafter. Thank you very much.

@k-okada
Copy link
Member

k-okada commented Oct 12, 2022

@YUKINA-3252
I assume that you want to use collision avoidance IK because the robot hit its hand? arm? to the base body ("WAIST?"). If so, check collision between these links seems fine. For example, setting collision-avoidance-links as follows.

(defmethod hironxjsk-sensor-robot-safe
  (:init (&rest args)
    (send-super* :init args)
    (setq collision-avoidance-links (send self :links))
    (setq larm-collision-avoidance-links collision-avoidance-links)
    (setq rarm-collision-avoidance-links collision-avoidance-links)
    (setq collision-avoidance-links (list (send self :link "WAIST")
                                          (send self :link "LARM_JOINT1_Link")
                                          (send self :link "LARM_JOINT5_Link")
                                          (send self :link "RARM_JOINT1_Link")
                                          (send self :link "RARM_JOINT5_Link")
                                          ))
    (setq larm-collision-avoidance-links collision-avoidance-links
          rarm-collision-avoidance-links collision-avoidance-links)
    )
  )

Or, if you just do not want to send collided angle-vector to real robot, solve ik without :collision t but check (send *robot* :check-self-collision) before (send *ri* :angle-vector).
Because hiro robot only have 6 DoF, so I think advantage of avoiding collision during IK is not so much.

@YUKINA-3252
Copy link
Author

YUKINA-3252 commented Oct 12, 2022

issueの目的がわかりにくくすみません。
もともと私の目的は、一連の動作のikを解く過程でcollisionしているかどうかを確認したいというもので、
その意味では岡田先生のおっしゃるとおり:self-collision-check:check-collisionを使用することが解決策となるのだと思います。
ただ、ikを解く過程で衝突回避をするような計算があると教わり試してみたのですがうまくいかず、報告としてこのissueをたてました。
現状では私の最初のコメントにあるようにcollision-avoidanceを使うとikが解けない、という問題がありましたが、
これについてはみなさんが指摘されているようにhttps://github.com/jsk-ros-pkg/jsk_robot/pull/895のように
ペアを厳選していったり、 @Naoki-Hiraoka さんが示してくださったようにパラメータを変えたりソルバを用いたりすればうまくいくことがあるということがわかりました。
必要になった場合はこれらを使いたいと思います。
みなさんありがとうございました。

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

No branches or pull requests

4 participants