bjuspi / tmr_ros1

techman robot ROS1 driver (experiment)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TM ROS Driver

1. Overview

Techman 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 support 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

  • publish feedback state on /feedback_states
    feedback state include robot position, error code, io state, etc. (see tm_msgs/msg/FeedbackState.msg)
  • publish joint states on /joint_states
  • publish 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]]

Installation

Just clone the TM ROS driver of git repository into your working directory and then built it.
The user can directly refer to the chapters introduced in the following text: steps 1 to 4 of § Usage with demo code & driver.

3. Usage

§ TMflow Listen node setup

The Listen node: a socket server can be established and be connected with ROS by an external device to communicate according to the defined protocol. The user can make the robot communicate with the user's ROS (remote) computer equipment through a wired network, when all the network parameters in the Network setting are set.

  1. Create a Listen task of flow project of TMflow software, and then drag the Listen node from the nodes menu onto the project flow, as shown below. 1

  2. Set the Network settings: mouse-click to enter the page of System ⇒ Network in order.
    Example: Set the Subnet mask: 255.255.255.0 and IP address 192.168.10.2
    Note: Set the network mask, and the communication with the TM Robot must be in the set domain.
    2

  3. Set the Ethernet Slave Data Table settings: mouse-click to enter the page of Setting ⇒ Connection ⇒ Ethernet Slave in order.
    Enable the Data Table Setting item and check the following boxes as item predefined to receive/send specific data:

    • 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

  4. Press the Play/Pause Button on the Robot Stick to start running this Listen task project.

    Note: Software TMflow version changes may have slightly different settings.(SW1.76_Rev2.00) (SW1.82_Rev1.00)

§ Remote connection to TM ROBOT

Static IP of remote connection network settings through the wired network .

  1. Set the wired network of the user's (remote) Ubuntu computer by mouse-click on the top right of the desktop ⇒ Click on "Wired Settings" ⇒ Click on the gear icon ⇒ In the IPv4 feature options, click on "Manual" in order.
    user_remote_network_settings
  2. Set the Static IP settings: where the IP address is fixed for the first three yards same as the previous setting 192.168.10, last yards 3-254 machine numbers are available. (Because TM ROBOT, you have been set to 192.168.10.2 )
    Example: Set the Netmask: 255.255.255.0 and IP address 192.168.10.30
    user_remote_IP_example
  3. Check Internet connection: start a terminal to test the connectivity with the target host TM ROBOT, by typing ping 192.168.10.2 ping_target_host.png

§ TM ROS driver usage

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) network settings are ready and the Listen node is running.

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

rosrun tm_driver tm_driver <robot_ip_address>

Example :rosrun tm_driver tm_driver 192.168.10.2, if the <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 the <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.

Usage with MoveIt

See Moveit tutorial.

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

roslaunch tm5_900_moveit_config tm5_900_moveit_planning_execution.launch sim:=True

The user can also manipulate TM Robot in the real world, by typing
💡 Do you prepare the TM Robot ready ? Make sure that TM Robot's operating software (TMflow) network settings are ready and the Listen node is running.

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 TM Robot.
⚠️[CAUTION] This demo will let the real TM Robot move, please be careful.

4. Program script demonstration

§ Demo package description

There are some demo codes showing how to use TM ROS driver.

  • demo_send_script:
    In this demo code, it shows how to send a Listen node script to control the TM Robot.
    The user can use service named "send_script" to send script.
    "id" → The transaction number expressed in any alphanumeric 1 characters.
    "script" → the script which the user want to send.
    "ok" → the correctness of the script.
    1 If a non-alphanumeric byte is encountered, a CPERR 04 error is reported. When used as a communication packet response, it is a transaction number and identifies which group of commands to respond.

  • demo_ask_item:
    In this demo code, the user can use this service to send TMSCT 2 cmd.
    2 More details please refer to defined protocol: Expression Editor and Listen Node.pdf (Chapter7.4 TMSCT)

  • demo_ask_sta:
    In this demo code, the user can use this service to send TMSTA 3 cmd.
    3 More details please refer to defined protocol (Chapter7.5 TMSTA)

  • demo_connect_tm:
    In this demo code, the user can set the connection type.
    If the user sets reconnect to true, every time the driver disconnects from the Listen node, it will try to reconnect.
    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 TMflow connection.

  • 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

  • demo_set_io:
    In this demo code, the user should set module, type, pin and state. 4
    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 value, or other value (if type expressed in analog control module)
    4 More details please refer to defined protocol (Chapter6.5 IO)

  • demo_set_positions:
    In this demo code, the user should pay attention to the parameter definition of the data format setting 5 and the unit of the parameter to be operated.
    motion_type → PTP_J , PTP_T , LINE_J , LINE_T , CIRC_J ,CIRC_T , PLINE_J ,PLINE_T
    positions → motion target position: If expressed in Cartesian coordinate (unit: m), if expressed in joint angles (unit: rad)
    velocity → motion velocity: if expressed in Cartesian coordinate (unit: m/s) 6 , if expressed in joint velocity (unit: rad/s, and the maximum value is limited to π ) 6
    acc_time → time to reach maximum speed (unit: ms)
    blend_percentage → blending value: expressed as a percentage (unit: %, and the minimum value of 0 means no blending)
    fine_goal → precise position mode : If activated, the amount of error in the final position will converge more, but it will take a few more milliseconds.
    5 More details please refer to defined protocol (Chapter8 PTP, Line, Circle, Pline, Move_PTP, Move_Line, Move_PLine)
    6 The unit of the parameters are different, the user can find the conversion in the program of TM ROS driver.

  • demo_write_item:
    In this demo code, the user can use this service to send TMSVR 7 cmd.
    7 More details please refer to defined protocol (Chapter9.3 svr_write())

  • 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] Some demos will let the TM Robot move, please be careful.

5. 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.

§ GUI 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 Listen node of TMflow is not started normally. 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".

§ Usage with 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

About

techman robot ROS1 driver (experiment)

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 75.3%Language:Python 19.4%Language:CMake 5.2%Language:C 0.1%