・URDFの基本形
<robot name="">
<link name="">
<visual>
<geometry></geometry>
</visual>
<collision>
<geometry></geometry>
</collision>
<inertial>
<mass>
<inertia>
</inertial>
</link>
<joint name="" type="">
<axis>
<parent link="">
<child link="">
<origin>
</joint>
</robot>
robot nameはGazeboにモデルをspawnする時などに使う
linkの位置はjointで親リンクとの相対位置として指定する
・関節情報のやり取り
パラメーターサーバーはURDFモデルをrobot_descriptionという名前で読み込む
<param name="robot_description" textfile="$(find tortoisebot)/urdf/tortoisebot.urdf>
/joint_state_publisherノードは、関節状態を/joint_statesトピックとして配信する
<gazebo>
<plugin name="joint_state_publisher">
<jointName></jointName>
</plugin>
</gazebo>
/robot_state_publisherノードは、パラメーターサーバーからURDFモデルを読み込み、/joint_statesを購読して順運動学を実行し、/tfトピックとして配信する
<node name="robot_state_publisher" pkg="" type=""/>
rvizは、パラメーターサーバーからURDFモデルを読み込み、/tfを購読して、ロボットを可視化する
・ロボットの動かし方
移動ロボットなら、cmd_velトピックをdifferential_drive_controllerプラグインに購読させて動かす(p.307)
アームロボットなら、follow_joint_trajectoryアクションをros_controllプラグインに受信させて動かす(p.343)
controller_managerがJointTrajectoryトピックを購読してfollow_joint_trajectoryアクションをros_controllに投げる
移動ロボもアームロボもjoint_state_publisherでjoint_statesを配信する点は同じ
・アームロボット
ロボット(urdfで定義されるgazebo sim)はros_controlとjoint_state_publisherのプラグインを持つ。
ros_controlは最初、コントローラーが何も動いていない状態で起動する。
launchファイルから、controller_managerにjoint_trajectory_controllerを起動させる。
joint_trajectory_controllerはJointTrajectoryメッセージをゴールとしてfollow_joint_trajectoryアクションを処理し、ロボットを制御する。
joint_state_publisherはjoint_statesを配信する。
robot_state_publisherはjoint_statesをtfに変換して配信する。
ros_control(joint_trajectory_controller)が無いと、ロボットを制御できない。follow_joint_trajectoryアクションを処理できない。
joint_state_publisherが無いとjoint_statesがわからない。
robot_state_publisherが無いとtfがわからない。
・アームロボット基本
ros_controlプラグイン
コントローラーの種類はJointTrajectoryControllerでarm_controllerと名付ける
/arm_controller/commandでtrajectory_msgs/JointTrajectoryを指定して起動生成
JointTrajectory/pointsは指定した軸の角度(rad)
<robot name="">
<link name="">
<visual>
<geometry></geometry>
</visual>
<collision>
<geometry></geometry>
</collision>
<inertial>
<mass>
<inertia>
</inertial>
</link>
<joint name="" type="">
<axis>
<parent link="">
<child link="">
<origin>
</joint>
</robot>
robot nameはGazeboにモデルをspawnする時などに使う
linkの位置はjointで親リンクとの相対位置として指定する
・関節情報のやり取り
パラメーターサーバーはURDFモデルをrobot_descriptionという名前で読み込む
<param name="robot_description" textfile="$(find tortoisebot)/urdf/tortoisebot.urdf>
/joint_state_publisherノードは、関節状態を/joint_statesトピックとして配信する
<gazebo>
<plugin name="joint_state_publisher">
<jointName></jointName>
</plugin>
</gazebo>
/robot_state_publisherノードは、パラメーターサーバーからURDFモデルを読み込み、/joint_statesを購読して順運動学を実行し、/tfトピックとして配信する
<node name="robot_state_publisher" pkg="" type=""/>
rvizは、パラメーターサーバーからURDFモデルを読み込み、/tfを購読して、ロボットを可視化する
・ロボットの動かし方
移動ロボットなら、cmd_velトピックをdifferential_drive_controllerプラグインに購読させて動かす(p.307)
アームロボットなら、follow_joint_trajectoryアクションをros_controllプラグインに受信させて動かす(p.343)
controller_managerがJointTrajectoryトピックを購読してfollow_joint_trajectoryアクションをros_controllに投げる
移動ロボもアームロボもjoint_state_publisherでjoint_statesを配信する点は同じ
・アームロボット
ロボット(urdfで定義されるgazebo sim)はros_controlとjoint_state_publisherのプラグインを持つ。
ros_controlは最初、コントローラーが何も動いていない状態で起動する。
launchファイルから、controller_managerにjoint_trajectory_controllerを起動させる。
joint_trajectory_controllerはJointTrajectoryメッセージをゴールとしてfollow_joint_trajectoryアクションを処理し、ロボットを制御する。
joint_state_publisherはjoint_statesを配信する。
robot_state_publisherはjoint_statesをtfに変換して配信する。
ros_control(joint_trajectory_controller)が無いと、ロボットを制御できない。follow_joint_trajectoryアクションを処理できない。
joint_state_publisherが無いとjoint_statesがわからない。
robot_state_publisherが無いとtfがわからない。
・アームロボット基本
ros_controlプラグイン
コントローラーの種類はJointTrajectoryControllerでarm_controllerと名付ける
/arm_controller/commandでtrajectory_msgs/JointTrajectoryを指定して起動生成
JointTrajectory/pointsは指定した軸の角度(rad)
コメント