Note: This tutorial assumes that you have completed the previous tutorials: http://wiki.ros.org/denso_robot_ros/Tutorials/How%20to%20control%20an%20RC8%20with%20MoveIt%21. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
How to read or write IO while controlling robot with MoveIt!
Description: Gives instructions for reading/writing I/O while controlling robot with MoveIt!.Keywords: DENSO robot, I/O
Tutorial Level: INTERMEDIATE
Contents
Overview
This tutorial describes how to read/write I/O while controlling robot with MoveIt!.
Parameters for reading/writing I/O
To read/write I/O while controlling robot with MoveIt!, execute the following command.
roslaunch denso_robot_bringup vs060_bringup.launch sim:=false ip_address:=192.168.0.1 send_format:=288 recv_format:=290
If your launch file does not have send_format and recv_format parameters, you can execute the following command.
roslaunch denso_robot_bringup denso_robot_bringup.launch robot_name:=vs060 sim:=false ip_address:=192.168.0.1 send_format:=288 recv_format:=290
Send format
The send_format parameter can be used for write Hand I/O, Mini I/O or User I/O. Following table shows the detail of the send format parameter.
Value |
I/O |
0 |
None |
32 |
Hand I/O (Port 64 to 71) |
256 |
Mini I/O (Port 16 to 31) |
288 |
Hand I/O and Mini I/O |
512 |
User I/O (Port 128 or after) |
544 |
Hand I/O and User I/O |
Receive format
The recv_format parameter can be used for read Hand I/O, Mini I/O or User I/O. Following table shows the detail of the receive format parameter.
Value |
I/O |
2 |
None |
34 |
Hand I/O (Port 48 to 55 and 64 to 71) |
258 |
Mini I/O (Port 0 to 31) |
290 |
Hand I/O and Mini I/O |
514 |
User I/O (Port 128 or after) |
546 |
Hand I/O and User I/O |
770 |
Mini I/O and User I/O |
Topics for reading/writing I/O
If you set send_format and recv_format parameters, some subscribers and publishers are launched.
Writing Mini I/O
If you set 256 or 288 for send_format, a subscriber named "${robot_name}/Write_MiniIO" is launched.
The subscriber's format is std_msgs/Int32.
The least significant bit means I/O port 0 and the most significant bit means port 31.
Reading Mini I/O
If you set 258, 290 or 770 for recv_format, a publisher named "${robot_name}/Read_MiniIO" is launched. The publisher's format is std_msgs/Int32. The least significant bit means I/O port 0 and the most significant bit means port 31.
Writing Hand I/O
If you set 32, 288 or 544 for send_format, a subscriber named "${robot_name}/Write_HandIO" is launched.
The subscriber's format is std_msgs/Int32.
The least significant bit means I/O port 48 and the most significant bit means port 79.
Reading Hand I/O
If you set 34, 290 or 546 for recv_format, a publisher named "${robot_name}/Read_HandIO" is launched. The publisher's format is std_msgs/Int32. The least significant bit means I/O port 48 and the most significant bit means port 79.
Writing User I/O
If you set 512 or 544 for send_format, a subscriber named "${robot_name}/Write_SendUserIO" is launched.
The subscriber's format is denso_robot_core/UserIO.
The offset parameter means the beginning of user I/O ports to write. It has to be greater than 127, and be multiple of 8.
The size parameter means the length of the value array.
The value array means the I/O states to write. The least significant bit of the first element means I/O port ${offset}+0, and the most significant bit means port ${offset}+7, and so on.
Reading User I/O
If you set 514, 546 or 770 for recv_format, a subscriber named "${robot_name}/Write_RecvUserIO" and a publisher named "${robot_name}/Read_RecvUserIO" are launched.
The subscriber's and publisher's format are denso_robot_core/UserIO.
The offset parameter means the beginning of user I/O ports to read. It has to be greater than 127, and be multiple of 8.
The size parameter means the number of I/O ports to read. It has to be the value dividing the number of I/O ports to read by 8. For examle, if you want to read 8 I/O ports, you should set 1 as this parameter.
The value array does not use in the "Write_RecvUserIO". In the "Read_RecvUserIO", it means the I/O states to have had read. The least significant bit of the first element means I/O port ${offset}+0, and the most significant bit means port ${offset}+7, and so on.