Open furushchev opened 8 years ago
docstringに合わせるのがAPIとしてスッキリしていると思いますが、 実機でwait-interpolatinの結果を見て何かしているところに影響がありますね。 pr2/hrp2/urata系のすべてに影響が及びます。
それで、実機の場合のwait-interpolationの結果はwait-for-resultの結果ではなくて、
send *ri* :interpolatingp
の結果を返すのがいいかと思います。
docstring通りですし、interpolatingpの結果は説明通りのように見えます。
おそくなりました.
うーん,いまいちですね. ただ,:wait-interpolation でかえるのは,wait-for-result だとして,これがnil になるのは, followtrajectoryactionでエラーが大きくなった時か, https://github.com/start-jsk/rtmros_common/pull/765 がmergeされてて,canel させた時しか無いのではないでしょうか.
つまり,hrp2/urata系には影響なく,影響あるのはpr2だけかと.
ところで,pr2ではどの場面でこれがもんだいになりましたか.
◉ Kei Okada
2015-11-21 15:12 GMT+09:00 Yohei Kakiuchi notifications@github.com:
docstringに合わせるのがAPIとしてスッキリしていると思いますが、 実機でwait-interpolatinの結果を見て何かしているところに影響がありますね。 pr2/hrp2/urata系のすべてに影響が及びます。
それで、実機の場合のwait-interpolationの結果はwait-for-resultの結果ではなくて、 send ri :interpolatingpの結果を返すのがいいかと思います。 docstring通りですし、interpolatingpの結果は説明通りのように見えます。
— Reply to this email directly or view it on GitHub https://github.com/jsk-ros-pkg/jsk_pr2eus/issues/187#issuecomment-158593557 .
ところで,pr2ではどの場面でこれがもんだいになりましたか.
例えば
https://github.com/jsk-ros-pkg/jsk_demos/blob/master/jsk_demo_common/euslisp/attention-observation.l#L29 などではwait-interpolationが終わると
(t t t t)
を返すような想定になっています。
ではsimulationの場合wait-interpolation中に必ず中断が入る挙動になってしまいます。 jsk_demo_commonのテストコードを書こうとしておかしいなと気づきました。
なるほど.:wait-interplationの結果に依存するコードはないということでいいですか.
実機の場合のwait-interpolationの結果はwait-for-resultの結果ではなくて、 send ri :interpolatingpの結果を返すのがいいかと思います。
でやりましょう.
◉ Kei Okada
2015-11-23 10:37 GMT+09:00 Furushchev notifications@github.com:
ところで,pr2ではどの場面でこれがもんだいになりましたか.
例えば
https://github.com/jsk-ros-pkg/jsk_demos/blob/master/jsk_demo_common/euslisp/attention-observation.l#L29 などではwait-interpolationが終わると(t t t t)を返すような想定になっています。
ではsimulationの場合wait-interpolation中に必ず中断が入る挙動になってしまいます。 jsk_demo_commonのテストコードを書こうとしておかしいなと気づきました。
— Reply to this email directly or view it on GitHub https://github.com/jsk-ros-pkg/jsk_pr2eus/issues/187#issuecomment-158826538 .
こちらですが、pr2がやわらくてangle vectorをおおくってなにかにぶつかってとまり、そのときの間接エラーがおおきいとき、wait-interpolationがnilになったりするでしょうか。
はい.そう期待しています. 実際にどうなるか,明示的に確認したことはあまりない気がするので,一回試したらいいですね > @furushchev @h-kamada @chiwunau @himlen1990
初歩的な質問になりますが,
実際にどうなるか,明示的に確認したことはあまりない気がするので,一回試したらいいですね
37.irteusgl$ (send *pr2* :rarm :move-end-pos #f(0 0 500) *pr2*)
#f(50.0 60.0 74.0 70.0 -120.0 20.0 -30.0 180.0 -12.4833 16.5145 -51.6378 -76.3784 58.4912 -23.4754 122.546 -24.5457\
59.33)
38.irteusgl$ (progn (send *ri* :angle-vector (send *pr2* :angle-vector)) (send *ri* :wait-interpolation))
[ INFO] [1448786993.901075475]: wait-interpolation debug: start
[ INFO] [1448786997.010105078]: wait-interpolation debug: end
(t t t t)
などとして(アームの上方向300mmくらいに机がある環境で500mm上にend-coordsを動かしてみる。)試してみたところ、アームに関しては机と衝突して目標位置に行けなくてもt
が帰ってきているように思います。
返り値自体は各コントローラがresultを返したかどうかという意味でのt
でしょうか。
アームに司令を送り、他のノードからcancelを送るとnilが帰ってくるのは確認しています。
pr2/ros 系の実装は https://github.com/ros-controls/ros_controllers/blob/4508d8797b245004c6aa3fa5722eb8e23a27208d/joint_trajectory_controller/include/joint_trajectory_controller/joint_trajectory_controller_impl.h#L200 のあたりだともいます. hrpsys ros bridgeではやっていないと思いますので,やるべきという声は有りますか?という話でした. https://github.com/start-jsk/rtmros_common/pull/765 も,含めて,必要,ということがあれば,issueを抱いておいて下さい.
◉ Kei Okada
2015-11-29 17:53 GMT+09:00 Furushchev notifications@github.com:
実際にどうなるか,明示的に確認したことはあまりない気がするので,一回試したらいいですね
37.irteusgl$ (send pr2 :rarm :move-end-pos #f(0 0 500) pr2)
f(50.0 60.0 74.0 70.0 -120.0 20.0 -30.0 180.0 -12.4833 16.5145 -51.6378 -76.3784 58.4912 -23.4754 122.546 -24.5457\
59.33) 38.irteusgl$ (progn (send ri :angle-vector (send pr2 :angle-vector)) (send ri :wait-interpolation)) [ INFO] [1448786993.901075475]: wait-interpolation debug: start [ INFO] [1448786997.010105078]: wait-interpolation debug: end (t t t t)
などとして(アームの上方向300mmくらいに机がある環境で500mm上にend-coordsを動かしてみる。)試してみたところ、アームに関しては机と衝突して目標位置に行けなくても tが帰ってきているように思います。 返り値自体は各コントローラがresultを返したかどうかという意味でのtでしょうか。 アームに司令を送り、他のノードからcancelを送るとnilが帰ってくるのは確認しています。
— Reply to this email directly or view it on GitHub https://github.com/jsk-ros-pkg/jsk_pr2eus/issues/187#issuecomment-160391977 .
https://github.com/jsk-ros-pkg/jsk_pr2eus/pull/191 のように関数をdocumentに従うように修正して見ました。 おかしかったらご指摘お願いします。
ちなみに、:wait-interpolation-smooth
の挙動はどうでしょうか?docstringはReturn value is a list of interpolatingp for all controllers
ですが、そうなっていないような気がします.
:interpolating-smoothp
の挙動もdocstringと異なり常にnilでしょうか.
:wait-interpolation-smooth
はPR2では使われていないのでわからないですが、:wait-interpolation
と同じ場所で使われるなら揃えたほうがいいのではないでしょうか?
(CCでmentionしたらいい人もわからない。。。 @wkentaro ?)
(これテストしたいところですが、gazeboをテストに入れると途端にテストの速度低下&&エラー率が上がるので、何とかしたいところですね。。。)
@pazeshunがsmoothを使っています
smoothの戻り値をチェックしたことがないので、わからないです。
ちなみに、:wait-interpolation-smoothの挙動はどうでしょうか?docstringはReturn value is a list of interpolatingp for all controllersですが、そうなっていないような気がします.
:interpolating-smoothpの挙動もdocstringと異なり常にnilでしょうか.
大変遅くなりましたが、 #356 を作っていて、:wait-interpolation-smooth
について色々確認しました。
@k-okada のご指摘通り、:wait-interpolation-smooth
が終了した際には常にnilを返すようになっていましたので、 #356 で:wait-interpolation
と同じくdocstringに従うようにしました。
なお、angle-vectorを送った後で(send *ri* :wait-interpolation-smooth 500)
と送った場合は、補間終了の500ms前に関数から抜けることになるので、返り値はtを含んだlistになると予想されますが、まだ実機で確認していません。
この変化に伴い、testも修正しました。
:wait-interpolation
の仕様が変わりそうですが、変わった場合は:wait-interpolation-smooth
もそれに合わせていこうと思います。放置していましたが,まとめとして,
docstringに書いてある
return values is a list of interpolatingp for all controllers, so (null (some #'identity (send ri :wait-interpolation))) -> t if all interpolation has stopped
を原則として,
:wait-interpolation
はactionlibを想定して,:angle-vector
などを使って,action serverに投げたgoalに対して,resultが返ってくるまで待つ.ということになる. (i.e. :wait-interpolation
はすべてのresultを待ってcontrollerの数分nil
の入ったlistを返す):wait-interpolation
に対してtimeout
が実際にresultが返ってくるまでの時間より短く与えられた時にはresultが帰ってきていないcontrollerに対してt
が返る.のような挙動にすることになったという理解で良いでしょうか.
また,
:wait-interpolation-smooth
などの関連メソッドも:wait-interpolation
に合わせるので問題ないでしょうか.
@YoheiKakiuchi @pazeshun @Naoki-Hiraoka @knorth55 ?
@k-okada @YoheiKakiuchi
こちらのissueで議論されていた:wait-interpolation
の返り値ですが、controller-type
が指定されていた場合にはどうあるべきか、についてご意見いただけないでしょうか。
現在は、実装・docstringともに、controller-type
が指定されていても全てのcontrollerのinterpolatingp
が返ってくるようになっていて、:wait-interpolationの関連メソッドもそのようにしようということになっているのですが、controller-type
が指定されていた場合はそのinterpolatingp
のみが返ってくるようにしたいです。
事情としては、以下の通りです。
:wait-interpolation
の関連メソッドを作ろうとして、その返り値のリストにt
が含まれているかどうかで補間中なのか補間終了したのかを判断しようとしていたのですが、controller-type
が指定されていた場合にも全てのcontrollerのinterpolatingp
が返ってくるので、興味のあるcontroller以外に補間中のcontrollerが一つでもあると、返り値のリストには必ずt
が含まれてしまい、興味のあるcontrollerだけを判断できない、ということに気づきました。メインのrobot-interfaceノード以外に、頭だけ別ノードからも動かしている、みたいな時に困ることが予想されます(レアケースかもしれないですが・・・)。
PR2実機では以下のようにチェックできます。
$ roscd pr2eus
$ roseus pr2-interface.l
$ pr2-init
$ progn (send *ri* :angle-vector (send *pr2* :reset-pose) 3000) (send *ri* :wait-interpolation) ;; 初期化
$ send *ri* :wait-interpolation
[ INFO] [1628079905.249275561]: wait-interpolation debug: start
[ INFO] [1628079905.297132332]: wait-interpolation debug: end
(nil nil nil nil) ;; 全てのcontroller
$ send *ri* :wait-interpolation :rarm-controller
[ INFO] [1628079975.218505638]: wait-interpolation debug: start
[ INFO] [1628079975.256166219]: wait-interpolation debug: end
(nil nil nil nil) ;; この場合も全てのcontroller
$ progn (send *ri* :angle-vector (send *pr2* :init-pose) 10000 :larm-controller) (send *ri* :angle-vector (send *pr2* :init-pose) 3000 :rarm-controller) (some #'identity (send *ri* :wait-interpolation :rarm-controller))
...
t ;; :rarm-controllerの補間は終わっているが、:larm-controllerの補間が終わっていないため、返り値のリストにtが入っている
$ progn (send *ri* :angle-vector (send *pr2* :reset-pose) 3000) (send *ri* :wait-interpolation) ;; 初期化
$ progn (send *ri* :angle-vector (send *pr2* :init-pose) 10000 :larm-controller) (send *ri* :angle-vector (send *pr2* :init-pose) 3000 :rarm-controller) (some #'identity (send *ri* :wait-interpolation :rarm-controller 1.0))
...
t ;; :wait-interpolationがtimeoutした場合でも区別できない
:wait-interpolationについて、
values is a list of interpolatingp for all controllers, so (null (some #'identity (send *ri* :wait-interpolation))) -> t if all interpolation has stopped
とあります。 これはつまりtimeoutが0(無限大)で:wait-interpolationされたときに必ず(nil nil nil nil)
になるという想定 testコードは https://github.com/jsk-ros-pkg/jsk_pr2eus/blob/master/pr2eus/test/default-ri-test.l#L29:wait-interpolation
の返り値は(send-all controller-actions :wait-for-result :timeout timeout)
となっています。values is a list of interpolatingp for all controllers
では無いように思います。:wait-for-result
はresultが返ってくるとt
を返す関数なので、actionがabortされない限りt
を返すと思います。さらに1回でもactionを送ると、次からはtが返ります。(直前のgoalに対するwait-for-resultの結果)pr2実機の場合
\3. 実機なしのwait-interpolation https://github.com/jsk-ros-pkg/jsk_pr2eus/blob/master/pr2eus/robot-interface.l#L482 となっていて、docstringに従っている
simulationの場合
ちなみに https://github.com/jsk-ros-pkg/jsk_demos/blob/master/jsk_demo_common/euslisp/attention-observation.l#L29 などではwait-interpolationが終わると
(t t t t)
を返すような想定になっています。 どちらを変えるのが正解でしょうか?