ROBOTIS-JAPAN-GIT / ROBOTIS-THORMANG-MPC

ROS packages for the motion of THORMANG3, MPC means Motion PC.
http://emanual.robotis.com/docs/en/platform/thormang3/introduction/
Apache License 2.0
0 stars 0 forks source link

gazebo実行時にmanagerが立ち上がってなくても、台車が動いてしまう #1

Open robograffitti opened 5 years ago

robograffitti commented 5 years ago

以下で台車モードの制御を実装したが、gazebo実行時にmanagerが立ち上がってなくても台車が動いてしまう https://github.com/ROBOTIS-JAPAN-GIT/ROBOTIS-THORMANG-MPC/commit/29c636d8b265c13aaa947b1ebc810c3889b12e7d

ロボットの関節角のコントローラではmanagerが立ち上がっていないと動かないので、同じような実装に修正するべき。

具体的にどの箇所を修正すべき…?

robograffitti commented 5 years ago

RobotisのGazeboの実装では、moduleで実機とgazeboに関係なくprocess()で関節角の目標位置や目標速度を設定し、controllerでそれを受け取る。受け取ったcontrollerはgazeboか実機かのフラグを見て、モータと通信して目標の指令を送るか、gazeboの関節角度指令のトピックと通信して目標の指令を送り、EffortJointeInterfaceを介して、JointPositionControllerで位置指令を受け取り、力制御でgazeboのロボットを動かす。この時、ロボットは位置指令を受けて力制御で動くが、力制御で目標位置まで関節を動かす。

ここでgazeboの関節角度のトピックを立ち上げて、 https://github.com/ROBOTIS-GIT/ROBOTIS-Framework/blob/master/robotis_controller/src/robotis_controller/robotis_controller.cpp#L657

ここでpublishされている https://github.com/ROBOTIS-GIT/ROBOTIS-Framework/blob/master/robotis_controller/src/robotis_controller/robotis_controller.cpp#L1111

robograffitti commented 5 years ago

解決策:

1) VelocityJointeInterfaceの削除

以下のファイルを削除して、以下のファイルをロードしている部分を元に戻す https://github.com/ROBOTIS-JAPAN-GIT/ROBOTIS-THORMANG-Common/blob/wheel/thormang3_description/urdf/thormang3_ndaj.transmissions.xacro

※VelocityJointInterfaceはやはり必要

2) diff_drive_controller を wheel_control_moduleで継承 diff_drive_controllerの速度指令値計算部分を流用する 必要であれば、依存関係の追記も忘れずに

3) cmd_vel を扱う callback を元に戻す

以下のファイルの該当部分以下の記述を復活させる https://github.com/ROBOTIS-JAPAN-GIT/ROBOTIS-THORMANG-MPC/blob/wheel/thormang3_wheel_module/src/wheel_control_module.cpp#L203

速度指令計算部分の実装に合わせて編集する

4) read() write() を消す

指令値はprocess()関数経由で行われるので、以下のread() write() は不要になる https://github.com/ROBOTIS-JAPAN-GIT/ROBOTIS-THORMANG-MPC/blob/wheel/thormang3_wheel_module/src/wheel_control_module.cpp#L187-L201

5) position_controller_ndaj.yaml を追加

以下を参考に position_controller_ndaj.yaml を追加 https://github.com/ROBOTIS-JAPAN-GIT/ROBOTIS-THORMANG-Common/blob/master/thormang3_gazebo/config/position_controller.yaml

以下を参考に、車輪の関節については、 type: effort_controllers/JointPositionController で記述する https://github.com/ROBOTIS-JAPAN-GIT/ROBOTIS-THORMANG-Common/blob/master/thormang3_gazebo/config/position_controller.yaml#L11-L14

velocity_controller/JointVelocityController を使う transmission に velocity interface を追加

6) launchファイル等、細かい部分を修正する