Skip to content

Latest commit

 

History

History
198 lines (126 loc) · 7.11 KB

README.md

File metadata and controls

198 lines (126 loc) · 7.11 KB

crane_x7_examples_py

このパッケージはCRANE-X7 ROS 2パッケージのサンプルコード集です。

起動方法

CRANE-X7の起動方法はcrane_x7_examplesのREADMEを参照してください。

サンプルプログラムを実行する

準備ができたらサンプルプログラムを実行します。 例えばグリッパを開閉するサンプルは次のコマンドで実行できます。

ros2 launch crane_x7_examples_py example.launch.py example:='gripper_control'

終了するときはCtrl+cを入力します。

Gazeboでサンプルプログラムを実行する場合

Gazeboでサンプルプログラムを実行する場合はuse_sim_timeオプションを付けます。

ros2 launch crane_x7_examples_py example.launch.py example:='gripper_control' use_sim_time:='true'

Examples

demo.launchを実行している状態で各サンプルを実行できます。

実行できるサンプルの一覧は、example.launch.pyにオプション-sを付けて実行することで表示できます。

$ ros2 launch crane_x7_examples_py example.launch.py -s
Arguments (pass arguments as '<name>:=<value>'):

    'example':
        Set an example executable name: [gripper_control, pose_groupstate, joint_values, pick_and_place]
        (default: 'pose_groupstate')

gripper_control

ハンドを開閉させるコード例です。

次のコマンドを実行します。

ros2 launch crane_x7_examples_py example.launch.py example:='gripper_control'

crane_x7_gripper_control_demo

back to example list


pose_groupstate

group_stateを使うコード例です。

SRDFファイルcrane_x7_moveit_config/config/crane_x7.srdf に記載されているhomeverticalの姿勢に移行します。

次のコマンドを実行します。

ros2 launch crane_x7_examples_py example.launch.py example:='pose_groupstate'

crane_x7_pose_groupstate_demo

back to example list


joint_values

アームのジョイント角度を1つずつ変更させるコード例です。

次のコマンドを実行します。

ros2 launch crane_x7_examples_py example.launch.py example:='joint_values'

crane_x7_joint_values_demo

back to example list


pick_and_place

モノを掴む・持ち上げる・運ぶ・置くコード例です。

次のコマンドを実行します。

ros2 launch crane_x7_examples_py example.launch.py example:='pick_and_place'

実機を使う場合

CRANE-X7から20cm離れた位置にピッキング対象を設置します。

サンプルで使用しているこのオレンジ色のソフトボールはRT ROBOT SHOPのこちらのページから入手することができます。

crane_x7_pick_and_place_demo

back to example list

Camera Examples

RealSense D435マウンタ搭載モデルのカメラを使用したサンプルコードです。

crane_x7_examplesのREADMEに記載されている「RealSense D435マウンタ搭載モデルを使用する場合」の手順に従ってdemo.launchを実行している状態で各サンプルを実行できます。

実行できるサンプルの一覧は、camera_example.launch.pyにオプション-sを付けて実行することで表示できます。

$ ros2 launch crane_x7_examples_py camera_example.launch.py -s
Arguments (pass arguments as '<name>:=<value>'):

    'example':
        Set an example executable name: [aruco_detection, color_detection]
        (default: 'aruco_detection')

aruco_detection

モノに取り付けたArUcoマーカをカメラで検出し、マーカ位置に合わせて掴むコード例です。 マーカはaruco_markers.pdfをA4紙に印刷し、一辺50mmの立方体に取り付けて使用します。

検出されたマーカの位置姿勢はtfのフレームとして配信されます。 tfのframe_idはマーカIDごとに異なりID0のマーカのframe_idtarget_0になります。掴む対象はtarget_0に設定されています。マーカ検出にはOpenCVを使用しています。

次のコマンドを実行します

ros2 launch crane_x7_examples_py camera_example.launch.py example:='aruco_detection'

crane_x7_aruco_detection_demo

back to camera example list


color_detection

特定の色の物体を検出して掴むコード例です。

デフォルトでは青い物体の位置をtfのフレームとして配信します。 tfのframe_idtarget_0です。 色の検出にはOpenCVを使用しています。 検出した物体の距離は深度画像から取得します。

次のコマンドを実行します

ros2 launch crane_x7_examples_py camera_example.launch.py example:='color_detection'

crane_x7_color_detection_demo

back to camera example list