Skip to content

TakumiOkamotoRist/tmr_ros1

 
 

Repository files navigation

TM ROS Driver

1. Overview

The TM Robot is a state-of-the-art production tool that is highly compatible and flexible to collaboration between human and machine. The Robot Operating System (ROS) provides abundant libraries and tools which can be utilized to reduce the cost of trivial development software tool and build robot applications without struggling. Our TM ROS driver provides nodes for communication with Techman Robot controllers, data including robot states, images from the eye-in-hand camera and URDF models for various robot arms via TMFlow.

2. Feature

This driver is for ROS1 Melodic version.
For using the driver, please make sure your ROS PC is installed correct.
If the user want to use ROS2 driver version, please go to TM ROS2 driver.

More information: TM ROS driver list

ROS Distribution (ROS Environment Setup) TM ROS driver version TM ROS Vision Remark: switch GitHub branches
ROS Noetic Ninjemys TM ROS1 Noetic driver x noetic
ROS Melodic Morenia TM ROS1 Melodic driver x master
ROS 2 Foxy Fitzroy TM ROS2 Foxy driver supported master
ROS 2 Dashing Diademata TM ROS2 Dashing driver supported dashing-devel
Note: The two current master branches are ROS1 Melodic and ROS2 Foxy.

ROS1 Driver

The TM ROS driver connects to TMFlow Ethernet Slave to control TMFlow project. Robot state is transmitted through this connection. A working driver also connects to a listen node (running at a TMFlow project) at the same time. To control the robot locomotion ,IO ,etc., the TM ROS driver sends robot script (TM Robot Expression) through this connection. More information about TM Robot Expression and Ethernet Slave, see [Expression Editor and Listen Node.pdf] The TM ROS driver for ROS1 is a single ROS node which creates a ROS interface such as topics and services:

Action Server

  • An action interface on /follow_joint_trajectory for seamless integration with MoveIt

Topic Publisher

  • publishes feedback state on /feedback_states
    feedback state include robot position, error code, io state, etc. (see tm_msgs/msg/FeedbackState.msg)
  • publishes joint states on /joint_states
  • publishes tool pose on /tool_pose

Service Server

  • /tm_driver/send_script (see tm_msgs/srv/SendScript.srv) :
    send robot script (TM Robot Expression) to listen node
  • /tm_driver/set_event (see tm_msgs/srv/SetEvent.srv) :
    send "Stop", "Pause" or "Resume" command to listen node
  • /tm_driver/set_io (see tm_msgs/srv/SetIO.srv) :
    send digital or analog output value to listen node
  • _/tm_driver/set_position (see tm_msgs/srv/SetPosition.srv) :
    send motion command to listen node, the motion type include PTP, LINE, CIRC ans PLINE, the position value is joint angle(J) or tool pose(T), see [[Expression Editor and Listen Node.pdf]]

ROS1 driver usage

After the user has set up the ROS1 environment and built the TM driver based on the specific workspace, please enter your workspace <workspace> by launching the terminal, and remember to make the workspace visible to ROS.

source /opt/ros/melodic/setup.bash
cd <workspace>
source ./devel/setup.bash

⚠️ Do you prepare the TM Robot ready ? Make sure that TM Robot's operating software (TMFlow) system/network settings are ready and the listening node is running.

Then, run the driver to maintain the connection with the TM Robot by type

rosrun tm_driver tm_driver <robot_ip_address>

Example :rosrun tm_driver tm_driver 192.168.10.2, if your <robot_ip_address> is 192.168.10.2

Another way, the user can execute the specific existing launch file (example: tm5_900_bringup.launch) to enable the driver to connect to tm5-900 robot

roslaunch tm_driver tm5_900_bringup.launch robot_ip:=<robot_ip_address>

Example :roslaunch tm_driver tm5_900_bringup.launch robot_ip:=192.168.10.2, if your <robot_ip_address> is 192.168.10.2

Now, the user can use a new terminal to run each ROS node or command, but don't forget to source the correct setup shell files as starting a new terminal.

3. Usage

TMFlow setup

Listen node

  1. Create a flow project; then choose the listen node and the Goto node 1

  2. Go to the System/Network setting page
    Type network parameters of device for ROS 2

  3. Go to the Setting/Connection page
    Enable the Ethernet Slave item
    Click on the Data Table Setting button and check the following boxes:

    • Robot_Error
    • Project_Run
    • Project_Pause
    • Safeguard_A
    • ESTOP
    • Camera_Light
    • Error_Code
    • Joint_Angle
    • Coord_Robot_Flange
    • Coord_Robot_Tool
    • TCP_Force
    • TCP_Force3D
    • TCP_Speed
    • TCP_Speed3D
    • Joint_Speed
    • Joint_Torque
    • Project_Speed
    • MA_Mode
    • Robot Light
    • Ctrl_DO0~DO7
    • Ctrl_DI0~DI7
    • Ctrl_AO0
    • Ctrl_AI0~AI1
    • END_DO0~DO3
    • END_DI0~DI2
    • END_AI0

    2

TM ROS driver usage

Usage with MoveIt

See Moveit tutorial.

To bring up MoveIt environment in simulation mode with virtual TM Robot , by type

roslaunch tm5_900_moveit_config tm5_900_moveit_planning_execution.launch sim:=True

The user can also manipulate TM Robot in the real world:

roslaunch tm5_900_moveit_config tm5_900_moveit_planning_execution.launch sim:=False robot_ip:=<robot_ip_address>

The parameter <robot_ip_address> means the IP address of the robot control pc.

4. Code of Demo

There are some demo codes showing how to use this driver.

  1. demo_send_script:
    In this demo code, it shows how to send a listen node script to control the robot.
    The user can use service named "send_script" to send script.
    "id"->The transaction number expressed in any alphanumeric characters . (Reports the CPERR 04 error if a non-alphanumeric byte is encountered . When used as a communication packet response , it is a transaction number and identifies which group of commands to respond.
    "script"-> the script which the user want to send.
    "ok" -> Correctness of the script.
  2. demo_ask_item:
    In this demo code, the user can use this service to send TMSCT cmd. More details please refer to the Expression Editor and Listen Node.pdf(Chapter7.4 TMSCT)
  3. demo_ask_sta:
    In this demo code, the user can use this service to send TMSTA cmd. More details please refer to the Expression Editor and Listen Node.pdf(Chapter7.5 TMSTA)
  4. demo_connect_tm:
    In this demo code, the user can set the connection type.
    If the user set to reconnect as true, every time when driver disconnects from listen node, it will try to re-connect it.
    There are two kind connection settings the user can select, one is "connect_tmsvr" for Ethernet server connection, and the other is "connect_tmsct" for setting TM-Flow connection.
  5. demo_set_event:
    In this demo code, six event types can be selected.
    func: TAG, WAIT_TAG, STOP, PAUSE, RESUME and EXIT
    arg0: if func is TAG or WAIT_TAG, arg0 is timeout in ms
    arg1: if func is TAG or WAIT_TAG, arg1 is id
  6. demo_set_io:
    In this demo code, the user should set module, type, pin and state. More details please refer to the Expression Editor and Listen Node.pdf(Chapter6.5 IO)
    module : MODULE_CONTROLBOX or MODULE_ENDEFFECTOR
    type: TYPE_DIGITAL_IN, TYPE_DIGITAL_OUT, TYPE_INSTANT_DO, TYPE_ANALOG_IN, TYPE_ANALOG_OUT, TYPE_INSTANT_AO
    pin: pin number
    state: STATE_OFF or STATE_ON or other value(if digitial IO)
  7. demo_set_positions:
    In this demo, the user should be careful with parameter units to operation.
    motion_type : PTP_J , PTP_T , LINE_J , LINE_T , CIRC_J ,CIRC_T , PLINE_J ,PLINE_T. More details please refer to the Expression Editor and Listen Node.pdf(Chapter8 PTP, Line, Circle, Pline, Move_PTP, Move_Line, Move_PLine)
    positions : target position or target joint(rad)
    velocity : joint velocity-> max value is Pi -> 3.14 rad/s , line velocity ->m/s
    acc_time : to max speed time in millisecond
    blend_percentage : 0 has no blending fine_goal : In a real situation, the controller will check the erro of the final position and should wait a few milliseconds.
  8. demo_write_item:
    In this demo code, the user can use this service to send TMSVR cmd. More details please refer to the Expression Editor and Listen Node.pdf(Chapter9.3 svr_write())
  9. demo_leave_listen_node:
    In this demo code, the user can use send_script service sending a script to leave the listen node.

Usage with demo code & driver

Note: If the user have even successfully built a specific code(tmr_ros1), the user only need to change to the TM driver workspace path cd ~/tmdriver_ws , and then directly refer to steps 5~7 below.

  1. Type to create a root workspace directory by starting a terminal: For example, tmdriver_ws or catkin_ws, then type to change current directory into the workspace directory path.
    mkdir ~/tmdriver_ws
    cd ~/tmdriver_ws
  2. Clone the the TM driver of git repository into the current directory by typing
    git clone https://github.com/TechmanRobotInc/tmr_ros1.git
  3. After the download done, rename the download folder tmr_ros1(or tmr_ros1-master) to src by typing
    mv tmr_ros1 src
    (or right-click on the download folder, select "Rename...")
  4. At the workspace directory to build the download packages and source 'setup.bash' in this workspace to make the worksapce visible to ROS of this terminal 1.
    Note: Do you setsource /opt/ros/melodic/setup.bash ready? Make sure to obtain the correct setup file according to your workspace hierarchy, and then type the following below to compile.
    catkin_make
    source ./devel/setup.bash
  5. Terminal 1: Startup ROS core and type
    roscore
  6. In a new terminal 2: Source setup.bash in the workspace path and run the driver to connect to TM Robot by typing
    source ./devel/setup.bash
    rosrun tm_driver tm_driver <robot_ip_address>
    The <robot_ip_address> is the IP address of the TM Robot, the user can get it through TM Flow, for example 192.168.10.2
  7. In another new terminal: Source setup.bash in the workspace path and type specific demo node function which the user want to study for applications. For example: the user select to run demo_set_io, the user can type
    source ./devel/setup.bash
    rosrun demo demo_set_io
    [CAUTION]:warning: Some demos will let the robot move, please be careful.

Note: The user also can add your workspace to the .bashrc such that it is sourced every time you start a new terminal.

echo "source ~/tmdriver_ws/devel/setup.bash" >> ~/.bashrc

TM GUI debugging and demonstration

The GUI displays tm_driver connection status, sct, sta, svr messages and robot status. Easily judge the message between the driver and the robot through the GUI display. If the connection fails, the user can also try to send a reconnect command on this GUI for debugging.

Usage with TM GUI debugging

Note: If the user have even successfully built a specific code(tmr_ros1), the user only need to change to the TM driver workspace path cd ~/tmdriver_ws , and then directly refer to steps 5~7 below.

  1. Type to create a root workspace directory by starting a terminal: For example, tmdriver_ws or catkin_ws, then type to change current directory into the workspace directory path.
    mkdir ~/tmdriver_ws
    cd ~/tmdriver_ws
  2. Clone the the TM driver of git repository into the current directory by typing
    git clone https://github.com/TechmanRobotInc/tmr_ros1.git
  3. After the download done, rename the download folder tmr_ros1(or tmr_ros1-master) to src by typing
    mv tmr_ros1 src
    (or right-click on the download folder, select "Rename...")
  4. At the workspace directory to build the download packages and source 'setup.bash' in this workspace to make the worksapce visible to ROS of this terminal 1.
    Note: Do you setsource /opt/ros/melodic/setup.bash ready? Make sure to obtain the correct setup file according to your workspace hierarchy, and then type the following below to compile.
    catkin_make
    source ./devel/setup.bash
  5. Terminal 1: Startup ROS core and type
    roscore
  6. In a new terminal 2: Source setup.bash in the workspace path and run the driver to connect to TM Robot by typing
    source ./devel/setup.bash
    rosrun tm_driver tm_driver <robot_ip_address>
    The <robot_ip_address> is the IP address of the TM Robot, the user can get it through TM Flow, for example 192.168.10.2
  7. In another new terminal 3: Source setup.bash in the workspace path and start GUI debug by typing
    source ./devel/setup.bash
    rosrun ui_for_debug_and_demo robot_ui

Debugging description

  • If is_srv_connect and is_sct_connect are true, it means that all connection is success.
  • If is_srv_connect is false, the user should check whether the data table is correct.
  • If is_sct_connect is false, the user should check whether the project is running.
  • If is_srv_connect and is_sct_connect are true, and the robot link is false, it means that the driver has connected to the TM project, but the TMFlow listen node is set to abnormal. Therefore, when the user send the move command, it does not work.
  • When the user send a command or click "change control box IO", the user will see a response item embedded in the Robot Response. For details of this item, please refer to SctResponse.msg, StaResponse.msg and SvrResponse.msg.
  • The user can click "clear" to clear the old response items.
  • If the user forget to run the tm_ros_driver, the user will see all items displayed as "Not ini".

About

techman robot ROS1 driver (experiment)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 75.3%
  • Python 19.4%
  • CMake 5.2%
  • C 0.1%