jsk-ros-pkg / jsk_aerial_robot

The platfrom for aerial robot (e.g. general multirotor, hydrus, di, dragon, etc)
http://www.jsk.t.u-tokyo.ac.jp/index-j.html
33 stars 33 forks source link

prev_xy_control_modeについて #383

Closed chibi314 closed 3 months ago

chibi314 commented 4 years ago

@tongtybj

https://github.com/tongtybj/aerial_robot/blob/master/aerial_robot_base/src/flight_navigation.cpp#L594

この部分って prev_xy_control_mode_ が変化しない気がするんですが挙動としては合っていますか?

tongtybj commented 4 years ago

ごめん、質問の意図をちゃんと理解できていないので、 もう少し詳しく説明してくれるかな。

chibi314 commented 4 years ago

simulationで/uav/navにxy_control_modeがacc_modeなメッセージを送ったところ、 Estimation for X, Y state is established, siwtch back to the xy control mode が出続けたので、このエラーメッセージで検索して該当のファイルにたどり着いたのですが、ここ では prev_xy_control_mode_ = xy_control_mode_ と古い方が新しい値に更新されていてパット見正しそうなのに対して、ここではそれが逆になっているのでもしかするとバグなのではないかと思いました.

tongtybj commented 4 years ago

なるほど、確かにバグがあるね。

https://github.com/tongtybj/aerial_robot/blob/master/aerial_robot_base/src/flight_navigation.cpp#L578-L597 の部分は、launch初期にVIOやGPSの初期化が終わってない、もしくわそもそもないときに、高度センサのみになるので、if分の方では、強制的にacc_modeに切り替える(もともとのcontrol_modeは保存する-> prev_xy_control_mode)。VIOやGPSが使われるようになったら、elseの方に入って、もとのprev_xy_control_modeに戻すという機能を果たしている。どちらかというと、センサーフュージョンでx/yに関する状態推定ができないときに機能すべきで、今回みたいに意図的にacc_modeに切り替えた時に反応すべきではないハズ。

なので、一番シンプルな直し方は、 https://github.com/tongtybj/aerial_robot/blob/master/aerial_robot_base/src/flight_navigation.cpp#L228 の下に、 prev_xy_control_mode_ = flight_nav::ACC_CONTROL_MODE; を挟めば解決するとはおもうけど、試してみてくれるかな

chibi314 commented 4 years ago

実装の意図を理解しました.試してみます.