## For instruction on writing tutorials
## http://www.ros.org/wiki/WritingTutorials
####################################
##FILL ME IN
####################################
## for a custom note with links:
## note =
## for the canned note of "This tutorial assumes that you have completed the previous tutorials:" just add the links
## note.0= http://wiki.ros.org/denso_robot_ros/Tutorials/How%20to%20control%20an%20RC8%20with%20MoveIt%21
## descriptive title for the tutorial
## title = How to read or write IO while controlling robot with MoveIt!
## multi-line description to be displayed in search
## description = Gives instructions for reading/writing I/O while controlling robot with MoveIt!.
## the next tutorial description (optional)
## next =
## links to next tutorial (optional)
## next.0.link=
## next.1.link=
## what level user is this tutorial for
## level= IntermediateCategory
## keywords = DENSO robot, I/O 
####################################
<<IncludeCSTemplate(TutorialCSHeaderTemplate)>>
<<TableOfContents(4)>>

== 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.<<BR>>
||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.<<BR>>
||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.<<BR>>
The subscriber's format is std_msgs/Int32.<<BR>>
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.<<BR>>
The subscriber's format is std_msgs/Int32.<<BR>>
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.<<BR>>
The subscriber's format is [[https://github.com/DENSORobot/denso_robot_ros/blob/master/denso_robot_core/msg/UserIO.msg|denso_robot_core/UserIO]].<<BR>>
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.<<BR>>
The size parameter means the length of the value array.<<BR>>
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.<<BR>>
The subscriber's and publisher's format are [[https://github.com/DENSORobot/denso_robot_ros/blob/master/denso_robot_core/msg/UserIO.msg|denso_robot_core/UserIO]].<<BR>>
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.<<BR>>
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.<<BR>>
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.

## AUTOGENERATED DO NOT DELETE
## TutorialCategory
## FILL IN THE STACK TUTORIAL CATEGORY HERE