ROS1を使ってみる その3(Open Manipulator、Node-RED)

はじめに

 今回はOpen ManipulatorのROS Serviceでの制御を確認し、Node-REDのノードでも操作してみました。

 ROS Serviceを扱うのははじめてです。データ形式がややこしくてまだ完全には理解していませんが、とりあえず動かすことはできました。

▼今回もWSL2のUbuntu 20.04の環境で実行しています。

WSL2を使ってみる その3(Ubuntu 20.04、ROS Noetic、Open Manipulator)

はじめに  今回はWSL2のUbuntu 20.04に、ROSをインストールしてみました。  前回構築したのはWSL2のUbuntu 22.04です。WSL2で複数のバージョンのUbuntu環境をインストー…

▼以前の記事はこちら

Unreal Engine 5を使ってみる その9(Remote Control API、Node-RED)

はじめに  以前HTTP Blueprintを使ってUnreal Engine 5(UE5)からNode-REDへの通信は試したのですが、今回はその逆です。  HTTP Remote Control APIを使ってNod [&hell…

ROS1を使ってみる その2(PythonのコードでPublishとSubscribe)

はじめに  今回はPythonのコードでROSのPublishとSubscribeを実行してみました。  これまでOpen Manipulatorを操作するのにROSを使っていたのですが、そのためのソフト…

WSL2環境とU2D2を接続する

 WSL2でUbuntu 20.04の環境を構築したときの記事でも書いていたのですが、WSL2環境でUSBデバイスを使うには少し手順を踏む必要があります。重要なことなので、Open Manipulatorを操作するための電子部品であるU2D2と接続するまでの手順を再掲しておきます。

 usbipdをインストールしていない場合は、まずインストールしてください。

▼こちらからmsiファイルをダウンロードして実行すると、インストールが始まります。

https://github.com/dorssel/usbipd-win/releases/tag/v4.2.0

 WindowsのPowerShellでコマンドを実行していきます。管理者権限で起動しておいてください。

▼接続中のUSBデバイスを確認するコマンドはこちら

▼この後のコマンドを実行した状態ですが、USB Serial ConverterがU2D2です。

 今回の場合、左に書いてあるBUSIDが1-2です。コマンドでこのBUSIDに対するUSBデバイスを共有します。

▼busidは状況に合わせて変更してください。

▼実行してみると以下の警告が表示されていました。

▼–forceをつけて実行すると警告は表示されていませんでした。

▼以下のコマンドでWSL2に接続したディストリビューションでも接続できるようにします。

 この状態でUbuntuのターミナルを開き、lsusbを実行すると接続されていることが確認できました。

▼接続前と接続後の画像です。ちゃんと接続できていました。

 USBを抜いてもう一度接続する場合は、再度コマンドを実行する必要があります。

 これでU2D2がUbuntu環境でも認識されたので、Open Manipulatorへ電源を供給してから、以下のコマンドで接続します。

roslaunch open_manipulator_controller open_manipulator_controller.launch

▼U2D2に接続できると、LEDが点灯します。

Topicを確認する

 Open Manipulatorのメッセージについては、e-ManualのMessage listのページにまとめられていました。まずはTopicについて確認してみました。

▼こちらのページです。

https://emanual.robotis.com/docs/en/platform/openmanipulator_x/ros_controller_msg/#topic

 以下のコマンドで起動するOpen ManipulatorのGUIコントローラの画面と照らし合わせてみました。

roslaunch open_manipulator_control_gui open_manipulator_control_gui.launch

▼Timer Startを選択すると、現在のジョイント角度などを取得できます。

 以下のコマンドでrostopicを確認してみます。

rostopic list

▼/gripper/kinematics_poseや/joint_statesなどがあります。

 以下のコマンドを実行すると、ジョイントの状態が表示されます。

rostopic echo /joint_states

▼joint1~4とgripperのpositionやvelocity、effortが表示されています。

 rqtでの表示も確認してみました。

▼Node Graphではノードの関係が表示されました。

▼Nodes onlyをNodes/Topics(all)に変更すると、Topicも表示されました。

▼Topic Monitorでそれぞれの値を見ることができました。

Serviceで操作する

 次にOpen ManipulatorのServiceのメッセージについて確認しました。

▼Serviceの欄に書かれていますが、Open ManipulatorやDynamixelを操作するためのメッセージだそうです。

https://emanual.robotis.com/docs/en/platform/openmanipulator_x/ros_controller_msg/#service

 rosserviceのlistを確認してみました。

rosservice list

▼ROBOTISのe-ManualにあったService名が並んでいます。

 Open ManipulatorのServiceについて書かれたページのRequestを参照しつつ、/goal_joint_space_pathについてChatGPTにどういった形式で送信すればいいのか相談してみました。

 以下の形式で、init poseに移動しました。

rosservice call /goal_joint_space_path "planning_group: 'arm'
joint_position:
  joint_name: ['joint1', 'joint2', 'joint3', 'joint4']
  position: [0.0, 0.0, 0.0, 0.0]
  max_accelerations_scaling_factor: 0.2
  max_velocity_scaling_factor: 0.2
path_time: 2.0"
is_planned: True

▼positionの値を変更すると、移動しました。

▼rqtでも/goal_joint_space_pathを確認すると、同じ値を指定するようになっていました。

 /goal_task_space_pathについても試してみました。以下の形式で動かすことができました。

rosservice call /goal_task_space_path "planning_group: 'arm'
end_effector_name: 'gripper'
kinematics_pose:
  pose:
    position:
      x: 0.3
      y: 0.0
      z: 0.2
    orientation:
      x: 0.0
      y: 0.0
      z: 0.0
      w: 1.0
  max_accelerations_scaling_factor: 0.2
  max_velocity_scaling_factor: 0.2
  tolerance: 0.01
path_time: 2.0"

▼四捨五入されているようですが、positionはGUIコントローラの値と符合しています。

Node-REDで操作してみる

ros callSrvノードで操作する

 これまで試していたことを元に、Node-REDのrosノードで操作してみました。rosservice callを実行する、ros callSrvノードを利用して操作します。

▼rosノードはTurtlesimのカメを操作したときの記事でも利用しています。

ROS1を使ってみる その1(Turtlesim、Node-RED)

はじめに  今回はROSをちゃんと学びたいということで、Turtlesimで通信周りの確認をしてみました。  これまでTurtlesimのカメをキーボードやGUIで操作したことはありま…

 rosノードはROS Bridgeを利用する前提なので、インストールして実行しておきます。

▼ROS Bridgeのインストールについては以前の記事をご覧ください。WSL2のUbuntuで実行しても、WindowsのNode-REDと通信できます。

WSL2のROSとWebSocket通信(ROS Bridge、Node-RED、Gazebo)

はじめに  今回はWSL2のROS NoeticとNode-REDで、WebSocket通信を行いました。  ROSで計算した数値をNode-REDで取得したかったのですが、調べているとROS Bridgeという…

 インストールされていれば、以下のコマンドでROS Bridgeを実行できます。

roslaunch rosbridge_server rosbridge_websocket.launch

 フローを作成して、実行してみました。

▼全体のフローはこちら

[{"id":"8f41f9de823e1ba5","type":"ros-call-service","z":"6f967b24d95ab8d8","server":"ed72b9d48a11624b","servicename":"/goal_joint_space_path","srvtype":"/open_manipulator_msgs/SetJointPosition","x":370,"y":1480,"wires":[["da279563e24a6007"]]},{"id":"479e1594762289d6","type":"inject","z":"6f967b24d95ab8d8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"planning_group\":\"arm\",\"joint_position\":{\"joint_name\":[\"joint1\",\"joint2\",\"joint3\",\"joint4\",\"joint5\"],\"position\":[0,0,0,0,0.2],\"max_accelerations_scaling_factor\":0.2,\"max_velocity_scaling_factor\":0.2},\"path_time\":2}","payloadType":"json","x":170,"y":1480,"wires":[["8f41f9de823e1ba5"]]},{"id":"3a44bd2db588f3ce","type":"debug","z":"6f967b24d95ab8d8","name":"debug 134","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":1480,"wires":[]},{"id":"da279563e24a6007","type":"json","z":"6f967b24d95ab8d8","name":"","property":"payload","action":"","pretty":false,"x":570,"y":1480,"wires":[["3a44bd2db588f3ce"]]},{"id":"ed72b9d48a11624b","type":"ros-server","url":"ws://localhost:9090"}]

 /goal_joint_space_pathからのResponseを一度jsonノードでパースしています。

▼injectノードの中には、JSON形式で先程送信したような値を指定しています。

 Gripperがjoint5になるのかなと思って入れてみたのですが、関係ないようです。

▼ros callSrvノードには、サーバーとService名、Typeを指定しています。

 この状態でinjectノードを実行すると、injectノードで指定したpositionに移動しました。

dashboardノードで操作する

 dashboardノードのスライドバーで操作できるようにフローを作成してみました。

▼全体のフローはこちら

[{"id":"8f41f9de823e1ba5","type":"ros-call-service","z":"6f967b24d95ab8d8","server":"ed72b9d48a11624b","servicename":"/goal_joint_space_path","srvtype":"/open_manipulator_msgs/SetJointPosition","x":370,"y":1480,"wires":[["da279563e24a6007"]]},{"id":"479e1594762289d6","type":"inject","z":"6f967b24d95ab8d8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"planning_group\":\"arm\",\"joint_position\":{\"joint_name\":[\"joint1\",\"joint2\",\"joint3\",\"joint4\",\"joint5\"],\"position\":[0,0,0,0,0.2],\"max_accelerations_scaling_factor\":0.2,\"max_velocity_scaling_factor\":0.2},\"path_time\":2}","payloadType":"json","x":170,"y":1480,"wires":[["8f41f9de823e1ba5"]]},{"id":"3a44bd2db588f3ce","type":"debug","z":"6f967b24d95ab8d8","name":"debug 134","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":1480,"wires":[]},{"id":"da279563e24a6007","type":"json","z":"6f967b24d95ab8d8","name":"","property":"payload","action":"","pretty":false,"x":570,"y":1480,"wires":[["3a44bd2db588f3ce"]]},{"id":"dcfcb55122a8a36e","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"joint1","tooltip":"","group":"feb35b11ee041e6f","order":2,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-5","max":"5","step":"0.01","className":"","x":370,"y":1580,"wires":[["07734bb16001a3f1"]]},{"id":"425bc72592482c9b","type":"template","z":"6f967b24d95ab8d8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"planning_group\": \"arm\",\n    \"joint_position\": {\n        \"joint_name\": [\n            \"joint1\",\n            \"joint2\",\n            \"joint3\",\n            \"joint4\"\n        ],\n        \"position\": [\n            {{flow.joint1}},\n            {{flow.joint2}},\n            {{flow.joint3}},\n            {{flow.joint4}}\n        ],\n        \"max_accelerations_scaling_factor\": 0.2,\n        \"max_velocity_scaling_factor\": 0.2\n    },\n    \"path_time\": 2\n}","output":"json","x":880,"y":1640,"wires":[["34838df78b278cea","8f41f9de823e1ba5"]]},{"id":"f9da865143844478","type":"ui_button","z":"6f967b24d95ab8d8","name":"","group":"feb35b11ee041e6f","order":1,"width":0,"height":0,"passthru":false,"label":"Reset","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"0","payloadType":"num","topic":"topic","topicType":"msg","x":170,"y":1580,"wires":[["0463344ba8fe1cf7"]]},{"id":"37041bcb171e58f8","type":"inject","z":"6f967b24d95ab8d8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":1540,"wires":[["0463344ba8fe1cf7"]]},{"id":"baa81914cb8b3ec4","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"joint2","tooltip":"","group":"feb35b11ee041e6f","order":4,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-5","max":"5","step":"0.01","className":"","x":370,"y":1620,"wires":[["b3bb81f43468b442"]]},{"id":"4e7e77f054167f08","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"joint3","tooltip":"","group":"feb35b11ee041e6f","order":6,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-5","max":"5","step":"0.01","className":"","x":370,"y":1660,"wires":[["729cceabf2bf318e"]]},{"id":"766a1a0f6dc17a61","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"joint4","tooltip":"","group":"feb35b11ee041e6f","order":8,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-5","max":"5","step":"0.01","className":"","x":370,"y":1700,"wires":[["191443d0ba5379ef"]]},{"id":"7b43c4d4b9b48b4a","type":"ui_text","z":"6f967b24d95ab8d8","group":"feb35b11ee041e6f","order":3,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":710,"y":1580,"wires":[]},{"id":"5dd050417b082e13","type":"ui_text","z":"6f967b24d95ab8d8","group":"feb35b11ee041e6f","order":5,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":710,"y":1620,"wires":[]},{"id":"891cf2e2833b2309","type":"ui_text","z":"6f967b24d95ab8d8","group":"feb35b11ee041e6f","order":7,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":710,"y":1660,"wires":[]},{"id":"296b0e4bf0dbbaae","type":"ui_text","z":"6f967b24d95ab8d8","group":"feb35b11ee041e6f","order":9,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":710,"y":1700,"wires":[]},{"id":"07734bb16001a3f1","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"joint1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1580,"wires":[["7b43c4d4b9b48b4a","0107bb6a1505eaad"]]},{"id":"b3bb81f43468b442","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"joint2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1620,"wires":[["5dd050417b082e13","0107bb6a1505eaad"]]},{"id":"729cceabf2bf318e","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"joint3","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1660,"wires":[["891cf2e2833b2309","0107bb6a1505eaad"]]},{"id":"191443d0ba5379ef","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"joint4","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1700,"wires":[["296b0e4bf0dbbaae","0107bb6a1505eaad"]]},{"id":"34838df78b278cea","type":"debug","z":"6f967b24d95ab8d8","name":"debug 135","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":890,"y":1700,"wires":[]},{"id":"0463344ba8fe1cf7","type":"junction","z":"6f967b24d95ab8d8","x":260,"y":1580,"wires":[["dcfcb55122a8a36e","baa81914cb8b3ec4","4e7e77f054167f08","766a1a0f6dc17a61"]]},{"id":"0107bb6a1505eaad","type":"junction","z":"6f967b24d95ab8d8","x":800,"y":1640,"wires":[["425bc72592482c9b"]]},{"id":"ed72b9d48a11624b","type":"ros-server","url":"ws://localhost:9090"},{"id":"feb35b11ee041e6f","type":"ui_group","name":"Open Manipulator","tab":"7f2b0e1192b72dcc","order":2,"disp":true,"width":8,"collapse":false,"className":""},{"id":"7f2b0e1192b72dcc","type":"ui_tab","name":"ROS","icon":"dashboard","disabled":false,"hidden":false}]

 一番上のフローは先程と同じで、injectノードに設定していたJSON形式のデータを、templateノードで変数を代入してJSON形式で渡すようにしています。

▼changeノードでスライドバーの値を一旦flow変数に代入しています。

▼templateノードでflow変数の値をpositionの部分に代入しています。

▼ダッシュボード画面にアクセスすると、以下のような画面が表示されます。

 実際に動かしてみました。

▼最大値と最小値が大きいので、調整する必要がありそうです。

 Open Manipulatorをキーボードで操作したときはゆっくりだったのですが、今回はスライダーで値を変えやすかったので動きも早かったです。そんな速度で動かせるのか…という感じでした。

 最大値と最小値を調整して、/goal_task_space_pathについても追加してみました。しかし、orientationが操作できなかったり、途中で操作できなくなることがありました。

 /goal_task_space_pathのpositionについては動かすことができました。

▼作成してみた全体のフローはこちら

[{"id":"8f41f9de823e1ba5","type":"ros-call-service","z":"6f967b24d95ab8d8","server":"ed72b9d48a11624b","servicename":"/goal_joint_space_path","srvtype":"/open_manipulator_msgs/SetJointPosition","x":370,"y":1480,"wires":[["da279563e24a6007"]]},{"id":"479e1594762289d6","type":"inject","z":"6f967b24d95ab8d8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"planning_group\":\"arm\",\"joint_position\":{\"joint_name\":[\"joint1\",\"joint2\",\"joint3\",\"joint4\"],\"position\":[0,0,0,0],\"max_accelerations_scaling_factor\":0.2,\"max_velocity_scaling_factor\":0.2},\"path_time\":2}","payloadType":"json","x":170,"y":1480,"wires":[["8f41f9de823e1ba5"]]},{"id":"3a44bd2db588f3ce","type":"debug","z":"6f967b24d95ab8d8","name":"debug 134","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":1480,"wires":[]},{"id":"da279563e24a6007","type":"json","z":"6f967b24d95ab8d8","name":"","property":"payload","action":"","pretty":false,"x":570,"y":1480,"wires":[["3a44bd2db588f3ce","ce7304fd44f0aecb"]]},{"id":"dcfcb55122a8a36e","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"joint1","tooltip":"","group":"feb35b11ee041e6f","order":2,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-2","max":"2","step":"0.01","className":"","x":370,"y":1580,"wires":[["07734bb16001a3f1"]]},{"id":"425bc72592482c9b","type":"template","z":"6f967b24d95ab8d8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"planning_group\": \"arm\",\n    \"joint_position\": {\n        \"joint_name\": [\n            \"joint1\",\n            \"joint2\",\n            \"joint3\",\n            \"joint4\"\n        ],\n        \"position\": [\n            {{flow.joint1}},\n            {{flow.joint2}},\n            {{flow.joint3}},\n            {{flow.joint4}}\n        ],\n        \"max_accelerations_scaling_factor\": 0.2,\n        \"max_velocity_scaling_factor\": 0.2\n    },\n    \"path_time\": 2\n}","output":"json","x":880,"y":1640,"wires":[["34838df78b278cea","8f41f9de823e1ba5"]]},{"id":"f9da865143844478","type":"ui_button","z":"6f967b24d95ab8d8","name":"","group":"feb35b11ee041e6f","order":1,"width":0,"height":0,"passthru":false,"label":"Reset","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"0","payloadType":"num","topic":"topic","topicType":"msg","x":170,"y":1580,"wires":[["0463344ba8fe1cf7"]]},{"id":"37041bcb171e58f8","type":"inject","z":"6f967b24d95ab8d8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":1540,"wires":[["0463344ba8fe1cf7"]]},{"id":"baa81914cb8b3ec4","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"joint2","tooltip":"","group":"feb35b11ee041e6f","order":4,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-1","max":"1","step":"0.01","className":"","x":370,"y":1620,"wires":[["b3bb81f43468b442"]]},{"id":"4e7e77f054167f08","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"joint3","tooltip":"","group":"feb35b11ee041e6f","order":6,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-1","max":"1","step":"0.01","className":"","x":370,"y":1660,"wires":[["729cceabf2bf318e"]]},{"id":"766a1a0f6dc17a61","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"joint4","tooltip":"","group":"feb35b11ee041e6f","order":8,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-1","max":"1","step":"0.01","className":"","x":370,"y":1700,"wires":[["191443d0ba5379ef"]]},{"id":"7b43c4d4b9b48b4a","type":"ui_text","z":"6f967b24d95ab8d8","group":"feb35b11ee041e6f","order":3,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":710,"y":1580,"wires":[]},{"id":"5dd050417b082e13","type":"ui_text","z":"6f967b24d95ab8d8","group":"feb35b11ee041e6f","order":5,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":710,"y":1620,"wires":[]},{"id":"891cf2e2833b2309","type":"ui_text","z":"6f967b24d95ab8d8","group":"feb35b11ee041e6f","order":7,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":710,"y":1660,"wires":[]},{"id":"296b0e4bf0dbbaae","type":"ui_text","z":"6f967b24d95ab8d8","group":"feb35b11ee041e6f","order":9,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":710,"y":1700,"wires":[]},{"id":"07734bb16001a3f1","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"joint1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1580,"wires":[["7b43c4d4b9b48b4a","0107bb6a1505eaad"]]},{"id":"b3bb81f43468b442","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"joint2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1620,"wires":[["5dd050417b082e13","0107bb6a1505eaad"]]},{"id":"729cceabf2bf318e","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"joint3","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1660,"wires":[["891cf2e2833b2309","0107bb6a1505eaad"]]},{"id":"191443d0ba5379ef","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"joint4","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1700,"wires":[["296b0e4bf0dbbaae","0107bb6a1505eaad"]]},{"id":"34838df78b278cea","type":"debug","z":"6f967b24d95ab8d8","name":"debug 135","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":1700,"wires":[]},{"id":"25ec2b2b04914fa9","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"position x","tooltip":"","group":"370141ee5ae50eac","order":2,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-1","max":"1","step":"0.01","className":"","x":540,"y":1940,"wires":[["e11a6d416c0901d0"]]},{"id":"72972c63d86ca9bf","type":"template","z":"6f967b24d95ab8d8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"planning_group\": \"arm\",\n    \"end_effector_name\": \"gripper\",\n    \"kinematics_pose\": {\n        \"pose\": {\n            \"position\": {\n                \"x\": {{flow.position.x}},\n                \"y\": {{flow.position.y}},\n                \"z\": {{flow.position.z}}\n            },\n            \"orientation\": {\n                \"x\": {{flow.orientation.x}},\n                \"y\": {{flow.orientation.y}},\n                \"z\": {{flow.orientation.z}},\n                \"w\": {{flow.orientation.w}}\n            }\n        },\n        \"max_accelerations_scaling_factor\": 0.2,\n        \"max_velocity_scaling_factor\": 0.2,\n        \"tolerance\": 0.01\n    },\n    \"path_time\": 3\n}","output":"json","x":1120,"y":2000,"wires":[["8e5691b37c708c6f","de5f0ae045e1366d"]]},{"id":"776434583f9228fa","type":"ui_button","z":"6f967b24d95ab8d8","name":"","group":"370141ee5ae50eac","order":1,"width":0,"height":0,"passthru":false,"label":"Reset","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"0","payloadType":"num","topic":"topic","topicType":"msg","x":170,"y":1940,"wires":[["104a18439262bd3f"]]},{"id":"a90544951376b64a","type":"inject","z":"6f967b24d95ab8d8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":1900,"wires":[["104a18439262bd3f"]]},{"id":"506ca36e69c11970","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"position y","tooltip":"","group":"370141ee5ae50eac","order":4,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-1","max":"1","step":"0.01","className":"","x":540,"y":1980,"wires":[["dae8ea9d501f3734"]]},{"id":"ed6420ef2e2a80ce","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"position z","tooltip":"","group":"370141ee5ae50eac","order":6,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-1","max":"1","step":"0.01","className":"","x":540,"y":2020,"wires":[["95029b5476ae8493"]]},{"id":"f3c5c8c146c7923e","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"orientation x","tooltip":"","group":"370141ee5ae50eac","order":8,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-1","max":"1","step":"0.01","className":"","x":550,"y":2060,"wires":[["1ed1212ab4b20886"]]},{"id":"0ecdd56b4d4698a3","type":"ui_text","z":"6f967b24d95ab8d8","group":"370141ee5ae50eac","order":3,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":930,"y":1940,"wires":[]},{"id":"46b8620fb686ee27","type":"ui_text","z":"6f967b24d95ab8d8","group":"370141ee5ae50eac","order":5,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":930,"y":1980,"wires":[]},{"id":"01cd87aae344cc3d","type":"ui_text","z":"6f967b24d95ab8d8","group":"370141ee5ae50eac","order":7,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":930,"y":2020,"wires":[]},{"id":"f73d8f82b3c4bd55","type":"ui_text","z":"6f967b24d95ab8d8","group":"370141ee5ae50eac","order":9,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":930,"y":2060,"wires":[]},{"id":"e11a6d416c0901d0","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"position.x","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":1940,"wires":[["0ecdd56b4d4698a3","b9e3d49ece89c8a4"]]},{"id":"dae8ea9d501f3734","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"position.y","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":1980,"wires":[["46b8620fb686ee27","b9e3d49ece89c8a4"]]},{"id":"95029b5476ae8493","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"position.z","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":2020,"wires":[["01cd87aae344cc3d","b9e3d49ece89c8a4"]]},{"id":"1ed1212ab4b20886","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"orientation.x","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":2060,"wires":[["f73d8f82b3c4bd55","b9e3d49ece89c8a4"]]},{"id":"8e5691b37c708c6f","type":"debug","z":"6f967b24d95ab8d8","name":"debug 181","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1150,"y":2060,"wires":[]},{"id":"de5f0ae045e1366d","type":"ros-call-service","z":"6f967b24d95ab8d8","server":"ed72b9d48a11624b","servicename":"/goal_task_space_path","srvtype":"open_manipulator_msgs/SetKinematicsPose","x":370,"y":1840,"wires":[["0aa9332e1639fd2b"]]},{"id":"09feb964dc8de1ee","type":"inject","z":"6f967b24d95ab8d8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"planning_group\":\"arm\",\"end_effector_name\":\"gripper\",\"kinematics_pose\":{\"pose\":{\"position\":{\"x\":0.3,\"y\":0,\"z\":0.2},\"orientation\":{\"x\":0,\"y\":0,\"z\":0,\"w\":1}},\"max_accelerations_scaling_factor\":0.2,\"max_velocity_scaling_factor\":0.2,\"tolerance\":0.01},\"path_time\":2}","payloadType":"json","x":170,"y":1840,"wires":[["de5f0ae045e1366d"]]},{"id":"9e374e724b5bba48","type":"debug","z":"6f967b24d95ab8d8","name":"debug 182","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":1840,"wires":[]},{"id":"0aa9332e1639fd2b","type":"json","z":"6f967b24d95ab8d8","name":"","property":"payload","action":"","pretty":false,"x":570,"y":1840,"wires":[["9e374e724b5bba48","11fdaf3f62dafcbe"]]},{"id":"7061fcd28d3bc8ee","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"orientation y","tooltip":"","group":"370141ee5ae50eac","order":10,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-1","max":"1","step":"0.01","className":"","x":550,"y":2100,"wires":[["06a539f355e8b841"]]},{"id":"017a979fa19eb752","type":"ui_text","z":"6f967b24d95ab8d8","group":"370141ee5ae50eac","order":11,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":930,"y":2100,"wires":[]},{"id":"06a539f355e8b841","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"orientation.y","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":2100,"wires":[["017a979fa19eb752","b9e3d49ece89c8a4"]]},{"id":"639e0ba51e3f2e02","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"orientation z","tooltip":"","group":"370141ee5ae50eac","order":12,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-1","max":"1","step":"0.01","className":"","x":550,"y":2140,"wires":[["d43c9f346943db9b"]]},{"id":"554c8f22ab0522c9","type":"ui_text","z":"6f967b24d95ab8d8","group":"370141ee5ae50eac","order":13,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":930,"y":2140,"wires":[]},{"id":"d43c9f346943db9b","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"orientation.z","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":2140,"wires":[["554c8f22ab0522c9","b9e3d49ece89c8a4"]]},{"id":"660ab8fa70c1bcef","type":"ui_slider","z":"6f967b24d95ab8d8","name":"","label":"orientation w","tooltip":"","group":"370141ee5ae50eac","order":14,"width":6,"height":1,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"-1","max":"1","step":"0.01","className":"","x":550,"y":2180,"wires":[["9b25e8b811538060"]]},{"id":"9e7765a85fc96e85","type":"ui_text","z":"6f967b24d95ab8d8","group":"370141ee5ae50eac","order":15,"width":2,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":930,"y":2180,"wires":[]},{"id":"9b25e8b811538060","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"orientation.w","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":2180,"wires":[["9e7765a85fc96e85","b9e3d49ece89c8a4"]]},{"id":"b67794d74686a4de","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"0.3","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":1940,"wires":[["25ec2b2b04914fa9"]]},{"id":"968ffebd2aa4faa5","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"0.2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":2020,"wires":[["ed6420ef2e2a80ce"]]},{"id":"1940478d951f316b","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":2180,"wires":[["660ab8fa70c1bcef"]]},{"id":"7bddbb4c63362e5e","type":"ui_text","z":"6f967b24d95ab8d8","group":"feb35b11ee041e6f","order":11,"width":4,"height":1,"name":"","label":"is_planned","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":1070,"y":1520,"wires":[]},{"id":"bd2b746d4f1637d4","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.is_planned","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":1520,"wires":[["7bddbb4c63362e5e"]]},{"id":"ce7304fd44f0aecb","type":"json","z":"6f967b24d95ab8d8","name":"","property":"payload","action":"","pretty":false,"x":710,"y":1520,"wires":[["bd2b746d4f1637d4"]]},{"id":"357f7d0b44d011a5","type":"ui_text","z":"6f967b24d95ab8d8","group":"370141ee5ae50eac","order":17,"width":4,"height":1,"name":"","label":"is_planned","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":1070,"y":1880,"wires":[]},{"id":"d8aff2796641af5c","type":"change","z":"6f967b24d95ab8d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.is_planned","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":1880,"wires":[["357f7d0b44d011a5"]]},{"id":"11fdaf3f62dafcbe","type":"json","z":"6f967b24d95ab8d8","name":"","property":"payload","action":"","pretty":false,"x":710,"y":1880,"wires":[["d8aff2796641af5c"]]},{"id":"0463344ba8fe1cf7","type":"junction","z":"6f967b24d95ab8d8","x":260,"y":1580,"wires":[["dcfcb55122a8a36e","baa81914cb8b3ec4","4e7e77f054167f08","766a1a0f6dc17a61"]]},{"id":"0107bb6a1505eaad","type":"junction","z":"6f967b24d95ab8d8","x":800,"y":1640,"wires":[["425bc72592482c9b"]]},{"id":"104a18439262bd3f","type":"junction","z":"6f967b24d95ab8d8","x":260,"y":1940,"wires":[["506ca36e69c11970","f3c5c8c146c7923e","7061fcd28d3bc8ee","639e0ba51e3f2e02","b67794d74686a4de","968ffebd2aa4faa5","1940478d951f316b"]]},{"id":"b9e3d49ece89c8a4","type":"junction","z":"6f967b24d95ab8d8","x":1020,"y":2000,"wires":[["72972c63d86ca9bf"]]},{"id":"ed72b9d48a11624b","type":"ros-server","url":"ws://localhost:9090"},{"id":"feb35b11ee041e6f","type":"ui_group","name":"Open Manipulator Joint","tab":"7f2b0e1192b72dcc","order":2,"disp":true,"width":"8","collapse":false,"className":""},{"id":"370141ee5ae50eac","type":"ui_group","name":"Open Manipulator Task","tab":"7f2b0e1192b72dcc","order":3,"disp":true,"width":8,"collapse":false,"className":""},{"id":"7f2b0e1192b72dcc","type":"ui_tab","name":"ROS","icon":"dashboard","disabled":false,"hidden":false}]

最後に

 Gripperも制御したかったのですが、Serviceでの制御方法がすぐに見つかりませんでした。見つかったらまた試してみようと思います。

 送信するデータ形式が複雑で、そこが使いにくいなと感じました。Open Manipulatorをキーボードで操作したときもそうだったのですが、操作ができなくなることが多いのも困りどころです。

 ROSからNode-REDを経由してUnreal Engineに送信することはできていたので、逆にUnreal Engineの入力からロボットを操作できそうだなと考えています。リアルなデジタルツインに近づいていきそうです。


趣味的ロボット研究所をもっと見る

購読すると最新の投稿がメールで送信されます。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です