Closed YUKINA-3252 closed 6 months ago
@annan-tang if you're interested in 20.04 support of hrpsys/rtmros_common system, plesee check this pr works both python2 and python3. Test code is also welcome.
Okada-sensei
I finished the c++ version of reinforcement learning rtc last week in 18.04 environment(current jaxon red control pc also use 18.04)
But I’ am also interested in the python3 version of hrpsys. I will try to check and test this new version with python3 code of reinforcement learning rtc and other rtc(running in c++) after writing 学振 and journal paper.
Tang Annan
On Mon, Apr 24, 2023 at 2:33 PM Kei Okada @.***> wrote:
@annan-tang https://github.com/annan-tang if you're interested in 20.04 support of hrpsys/rtmros_common system, plesee check this pr works both python2 and python3. Test code is also welcome.
— Reply to this email directly, view it on GitHub https://github.com/jsk-ros-pkg/jsk_model_tools/pull/251#issuecomment-1519409869, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANCO6QLIVB4DLRQUORRNSHDXCYGCDANCNFSM6AAAAAAWVBD25A . You are receiving this because you were mentioned.Message ID: @.***>
@W567 added some more fix to this branch (see https://github.com/ban-masa/jsk_model_tools/pull/2 ) @Naoki-Hiraoka @Takuma-Hiraoka @kindsenior could someone check if this works on python2 environment?
@Naoki-Hiraoka と確認しました。
このPull Request及びhttps://github.com/ban-masa/jsk_model_tools/pull/2 は以下5つの変更を含んでいます。
それぞれについて確認し、修正が必要なものについて修正したcommitをhttps://github.com/W567/jsk_model_tools/compare/dev...Takuma-Hiraoka:jsk_model_tools:fix_for_python3-python2_compatible?expand=1 に上げました。
python2ではimportlibにreload関数がないため、現在のPull Requestの内容ではpython2実行時にエラーになります。
https://github.com/jsk-ros-pkg/jsk_3rdparty/blob/56747c3a4e0cb13cea3996996846d107a1fa364b/chaplus_ros/scripts/chaplus_ros.py#L46 のように、実行寺にpython2かどうかを調べて挙動を変えるようにしました。
sort()もsorted()もpython2/3ともに存在するため、この変更はpython3対応とは無関係です。
さらにsorted関数は非破壊処理であり、sortをsortedにするだけの変更ではプログラムの挙動が変わってしまうため、sortを使うもともとの実装に戻しました。
python3ではbasestring型がstr型に統一されたのに対し、python2ではstr型はbasestring型の部分集合であるため、単にstrかどうかを判定するだけではpython2環境だと全てを正しく判定することができません。
まずpython2のためにbasestring型か調べ、basestring型が存在しない場合にstr型を調べるようにしました。
この変更はpython3対応とは無関係ですが、こちらの変更は問題ないかと思います。
この変更はpython3対応とは無関係ですが、こちらの変更は問題ないかと思います。
この変更を行って、python2環境でhrpsys_ros_bridge_tutorialsのビルドを行うことができ、生成されたJAXON_RED_WH_SENSORS.urdfがmasterと変わらないことを確認しました。
@Takuma-Hiraoka ありがとう。 @W567 のリポジトリはなぜかフォークではなくて、新たにコミットしているので、こちらからPR作れないので、ban-masa:fix_for_python3 向けのPRを作ってください。
@ban-masa のリポジトリもフォークでないのか。。。。という事で、作りました https://github.com/jsk-ros-pkg/jsk_model_tools/pull/254
@pazeshun will fix this PR to work with Python 2, too.