-
Notifications
You must be signed in to change notification settings - Fork 41
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
【robot-interface.l】fix return value of :wait-interpolation for real robot #351
Conversation
なるほど.GoodCatchです. また,これで副作用がないか @furushchev さんにも聞いてみてください. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TL;DR
I think it will be better if both #351 and #352 are merged into one pull request
Long answer:
I think #352 is simpler solution for this problem, however the pull request will return nil
on any other condition than active
like when the controller is pending.
#351 uses comm-state::done
instead, which is considered also for that case.
For more detail on behavior of actionlib:
http://wiki.ros.org/actionlib/DetailedDescription?action=AttachFile&do=get&target=simple_client_state_transitions.png
P.S. I think it is worth to discuss about this method should return t
if the controller is only in active
state or return t
also in pending
state...
@k-okada @mmurooka ?
ありがとうございます。 controller-action-clientの:interpolatingpが、 interpolation中かどうかという意味を考えると2が適切と思いますが、
のように、interpolationが完了したどうかを知りたい場合に使うことができません。 今気づいたのですが、 jsk_pr2eus/pr2eus/robot-interface.l Line 176 in 1d92322
で:default-controllerに対応したcontroller-action-clientがリストに加えられたきり、他のcontroller-action-clientは加えられていないようです。 pr2の場合はdefault-controllerが各部位のcontroller-action-clientを内包しているため問題が現れませんが、hrp2の場合はdefault-controllerはfullbody-controllerのcontroller-action-clientに対応しているため、rarm-controllerやlleg-controllerといった他の部位に対応したcontroller-action-clientがcontroller-actionsに入っておらず、 robot-interfaceの:wait-interpolationや:interpolatingpの返値にこれらのcontroller-action-clientの情報が含まれないという状況になっています。 |
controller-action-clientの:interpolatingpが、
1、simple-goal-state-pendingまたはsimple-goal-state-activeのときにtを返す
2、simple-goal-state-activeのときにtを返す
のどちらがよいのか、自身がありません。
interpolation中かどうかという意味を考えると2が適切と思いますが、
2の方法ですと、先述した
一個一個のactionが動いているか,というよりは,ロボット自体が動いているかと,というのが:interpolationgpなので,1がそういうこといなるのかな?であれば1でいい気がします.
今は
https://github.com/jsk-ros-pkg/jsk_pr2eus/pull/352/files#diff-15f6920b924513f6027d36b361f85bbdR89
だけど,これだとダメなのかな?
今気づいたのですが、
robot-interfaceの:wait-interpolationや:interpolatingpの返値の算出で利用されているcontroller-actionsですが、
https://github.com/jsk-ros-pkg/jsk_pr2eus/blob/1d92322c744aecdf8051cfd30da02f1042f1c9e8/pr2eus/robot-interface.l#L176
で:default-controllerに対応したcontroller-action-clientがリストに加えられたきり、他のcontroller-action-clientは加えられていないようです。
pr2の場合はdefault-controllerが各部位のcontroller-action-clientを内包しているため問題が現れませんが、hrp2の場合はdefault-controllerはfullbody-controllerのcontroller-action-clientに対応しているため、rarm-controllerやlleg-controllerといった他の部位に対応したcontroller-action-clientがcontroller-actionsに入っておらず、
robot-interfaceの:wait-interpolationや:interpolatingpの返値にこれらのcontroller-action-clientの情報が含まれないという状況になっています。
なるほど,これはHRP2側の問題なので,
@mmurooka にきいてみてください.
hrp2でもdefault-conttoller1に追加できるといいんだけど.
|
ありがとうございます。異存ありません。
mmurooka先生と話したところ、必ずしもhrp2固有の問題では無く:add-controller関数の問題であるけれども、解決しようとするとhrp2固有の問題によって解決できないということが分かりました。 robot-interfaceクラスのメンバ変数controller-actionsは、robot-intarfaceのもつcontroller-action-clientが重複なく1つずつ入っていることが期待されているものだと認識しています。例えば、:add-controller のオプションの:create-actionsをnilとすると、既に作ってあるcontroller-action-clientをcontroller-actionsから探して:~-controllerのインターフェイスに対応させるという処理をする、というような利用がされています。 jsk_pr2eus/pr2eus/robot-interface.l Lines 245 to 246 in 1d92322
ところが、:add-controller関数は新しく関数内で新しくcontroller-action-clientを作成した時に、controller-actionsにcontroller-action-clientを追加していません。 この結果、
となっており、
とfullbody-controllerの結果しか返らない状態になっています。 解決方を2通り考えました。 この方法ではhrp2固有の問題が浮上し、
と、hrp2の場合Fullbody_controller以外のactionserverにgoalが設定されていることは稀なので、no goal existsのエラーメッセージが出てきてしまいます。 2. この方法で生じる問題は、足の動作など左右でタイミングが一致しなければならない動作について、一致することが保障されないことです(hrpsys_ros_bridgeのHrpsysJointTrajectoryBridgeは、trajectoryのtime_from_startを、/goalのtopicが届いてからの時間として処理するため)。また、dashboardからのreset-poseやreset-manip-poseなどの指示はhrpsysのSequencePlayerのfullbody-controllerに相当する部分に送られるため、これらはhrpsysのSequencePlayerの各部位のcontrollerに相当する部分に上書きされる仕様上、dashboardからhrp2を動かせなくなってしまいます。 |
昨日話しているときは分かっているつもりだったんだけれど,一晩たったらどういう問題だったか思い出せなくなってしまったので, (send *ri* :angle-vector hoge 1000 :head-controller)
(send *ri* :wait-interpolation) ;; PR2だと待ってくれる.HRP2だと待ってくれない. という問題だっけ? (send *ri* :angle-vector hoge 1000 :head-controller)
(send *ri* :wait-interpolation :head-controller) ;; これならHRP2でも待ってくれる? とすればとりあえずは大丈夫だけれど,
という挙動になるようにするには,どう直していけばいいかという話であってる?
のhrp2固有の問題っていうのは何かな. |
以下のようになります。
↑は
上記すべての問題は、先述の1または2の方法で解決します。 hrp2固有の問題というのは、 (editが多くてすみません) |
It seems #352 solved this issue. |
#191
(null (some #'identity (send ri :wait-interpolation))) -> t if all interpolation has stopped
という使い方ができると期待し、
としたところ、ループを1周目の前に抜けてしまいました。
原因は、
jsk_pr2eus/pr2eus/robot-interface.l
Line 598 in 1d92322
で:wait-interpolationは(send-all controller-actions :interpolatingp)を返すことになっていますが、
jsk_pr2eus/pr2eus/robot-interface.l
Line 84 in 1d92322
で:interpolatingpはtimer-sequenceを返すことになっており、timer-sequenceはsimulationモード時しか更新されないためです。
(send ri :wait-interpolation)はactioncallの/resultが返って来たかどうかを返すのが適切ではないかと考え、コードを修正しました。
なお、(send ri :interpolatingp)は、actioncallがサーバー側で受理されてから完了するまでの間tを返す仕様になっているため、:angle-vectorを送った直後はサーバー側から受理されたとの信号がまだ届いておらず、nilを返すようです。