Skip to content

Commit a59da39

Browse files
author
YH.Wang
committed
1.0.3 Add the tm_description, tm_mod_urdf package and tutorials, available for the TM12S, TM14S, and TM25S Cobot model simulation.
1 parent 17379f0 commit a59da39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2462806
-3
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ This chapter describes a simplified GUI for displaying tm_driver connection stat
116116
- Embedded TM ROS Driver [Usage Guideline](./doc/tm_humble_gui_e.md)
117117
<div> </div>
118118

119-
## __6. Contact us / Technical support__
119+
## __6. Generate your TM Robot-Specific Kinematics Parameters Files__
120+
Real kinematic values vary from TM robot to another one as each robot is calibrated at the factory.<br/>
121+
This chapter describes that the user can use a script program to extract specific kinematic values from your TM robot. The Python script function automatically generates a new URDF robot file that has XML macros in it (i.e. a new Xacro robot file) using a specific set of commands.
122+
- External TM ROS Driver [Usage Guideline](./doc/tm_humble_description.md)
123+
- Embedded TM ROS Driver [Usage Guideline](./doc/tm_humble_description_e.md)
124+
125+
**Note 1**: If the user just want to use the TM Robot nominal model to control the robot, the user can skip the rest of this chapter.<br/>
126+
**Note 2**: The tm_description package contains description files and meshes, available for the TM12S model, and some Cobot models will be added later.
127+
<div> </div>
128+
129+
## __7. Contact us / Technical support__
120130
More Support & Service, please contact us. [@TECHMAN ROBOT](https://www.tm-robot.com/zh-hant/contact-us/)``[https://www.tm-robot.com/zh-hant/contact-us/] ``<br/>
121131
<div> </div>

doc/tm_humble_description.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# __Generate your TM Robot-Specific Kinematics Parameters Files__
2+
Real kinematic values vary from TM robot to another one as each robot is calibrated at the factory.<br/>
3+
The user can use the tm_mod_urdf package to extract specific kinematic values from your TM robot, which are taken into account by a Python script function using a specific set of commands to automatically generate a new Xacro robot model description file.
4+
> If the user just wants to use the TM Robot nominal model to control the robot, the user can skip the rest of this chapter.<br/>
5+
6+
## &sect; Corrected kinematics value description
7+
> The precise kinematic parameters of a robot are useful for improving the end-point accuracy of the robot.<br/>
8+
> Due to manufacturing tolerances during manufacturing and the installation error in the robot assembly process, the positioning accuracy and precision of the mechanism will be affected. The error between the reality and the nominal robot model is significantly reduced by the corrected robot description. The kinematic parameter compensated deviations of the robot can improve the absolute positioning accuracy of the robot.<br/>
9+
> If the user needs to improve simulation accuracy or end effector tracking performance, it is recommended that the user import the corrected calibrated kinematic parameters from the real TM Robot to replace the nominal set of D-H parameters. Techman Robot provides the Xacro file that configures the TM Robot model with a set of nominal DH parameters, and one that uses the programming scripts to obtain calibrated kinematic parameters from a parameter server connected to your TM robot and perform a set of overrides to output a new corrected Xacro file.<br/>
10+
> <br/>
11+
> The common Python script is used as follows:
12+
>```bash
13+
> python3 <script_name> <urdf_from> <urdf_gen>
14+
>```
15+
> * <script_name> : Provide modify_xacro.py or modify_urdf.py two Python scripts program as options.
16+
> * <urdf_from>: The first argument represents the original URDF model form of the TM Robot, and the file part naming <sup>1</sup> is <urdf_from>.<br/>
17+
> <sup>1</sup> There will be several built-in TM Robot nominal robot model settings, available for TM5S, TM7S, TM12S, TM14S, and TM25S models.<br/>
18+
> For example, select your real robot type as the input nominal model form. If your TM robot is TM12S, then the user can type tm12s as the <urdf_from>.<br/>
19+
> * <urdf_gen>: The second argument means the newly generated URDF model form of the TM Robot, and the file <sup>2</sup> name is <urdf_gen>.<br/>
20+
> <sup>2</sup> For example, if the user names it test and select modify_xacro.py as script program, a test.urdf.xacro robot description file will be generated.<br/>
21+
>
22+
> The Python script for more specific arguments is used as follows:
23+
>```bash
24+
> python3 <script_name> <urdf_from> <urdf_gen> <specific_para>
25+
>```
26+
> * <specific_para>: The third argument is provided for use in some special cases. Please refer to the scripting program <sup>3</sup> for details of this item.<br/>
27+
> <sup>3</sup> For a simple third argument example, type the argument "-M" as follows:<br/>
28+
> Example : ``python3 modify_xacro.py tm12s test -M``<br/>
29+
> &rarr; A robot description file "`macro.test.urdf.xacro`" will be generated, and the string 'macro.' is prepended to the <urdf_gen> name.<br/>
30+
31+
32+
## &sect; Create with specific kinematic parameters of the local TM Robot
33+
> :bulb: Do you run the driver to maintain the connection with TM Robot, make sure that TM Robot's operating software (TMflow) network settings are ready and the Listen node is running.<br/>
34+
> <br/>
35+
> * #### __Take generating a new Xacro file as an example__
36+
> The following steps describe how to import specific kinematic values using a real TM12S Robot following the procedure below, and select the corresponding type tm12s as an example of <urdf_from>.<br/>
37+
>
38+
> 1. In a terminal: Source setup.bash in the workspace path and run the driver to connect to TM Robot by typing<br/>
39+
>
40+
> ```bash
41+
> source /opt/ros/humble/setup.bash
42+
> cd <workspace>
43+
> source ./install/setup.bash
44+
> ros2 run tm_driver tm_driver robot_ip:=<robot_ip_address>
45+
> ```
46+
> The parameter `<robot_ip_address>` means the IP address of your TM Robot, the user can get it through TM Flow.<br/>
47+
>
48+
> 2. In another new terminal: Source setup.bash in the workspace path, change the current directory to the directory path of the Python script to get the specific kinematic parameters of your TM Robot, and then enter the specified command format to generate a new name by the <urdf_gen> argument, for example, named user_defined.<br/>
49+
>
50+
> ```bash
51+
> source /opt/ros/humble/setup.bash
52+
> cd <workspace>
53+
> source ./install/setup.bash
54+
> cd src/tm_mod_urdf/tm_mod_urdf
55+
> python3 modify_xacro.py tm12s user_defined
56+
> ```
57+
> When this procedure is completed, the user can find that the newly generated named robot description file has been saved, e.g."``user_defined.urdf.xacro``".<br/>
58+
> :bookmark_tabs: Note: In the previous chapter, we renamed the download folder tm2_ros2 (or tm2_ros2-master) to src. If the user misses this step, they will encounter such an error "``[Error] [modify_xacro]: workspace directory not find ``" on the screen when executing the above command.<br/>
59+
>
60+
> 3. Next, the user must modify the filename part of the default pre-built nominal robot model in tm12s.urdf.xacro to a newly generated robot model description naming file.<br/>
61+
> ```bash
62+
> cd src\tm_description\xacro\
63+
> sudo vim tm12s.urdf.xacro
64+
> ```
65+
>> or use ``gedit`` text editor instead of ``vim`` to edit the file contents, by typing<br/>
66+
> ```bash
67+
> sudo gedit tm12s.urdf.xacro
68+
> ```
69+
>
70+
> :bookmark_tabs: Note: If your real Robot is a TM25S, in the above example, you should type tm25s as an example for <urdf_from> and modify the tm25s.urdf.xacro file.<br/>
71+
>
72+
> Please refer to the following to modify the content format of the filename line:<br/>
73+
> ```bash
74+
> # Before modification : (Take the pre-built TM12S nominal robot model as an example)
75+
> <xacro:include filename="$(find tm_description)/xacro/macro.tm12s-nominal.urdf.xacro" />
76+
> # After modification : (Replace with your actual newly generated Xacro file)
77+
> <xacro:include filename="$(find tm_description)/xacro/user_defined.urdf.xacro" />
78+
> ```
79+
> Finally, the user can launch the modified robot file "``tm12s.urdf.xacro``" to run your TM Robot or simulate the robot more accurately.<br/>
80+
>> :bulb: **Tip**: Remember to recompile since the code has been changed.<br/>
81+
>> Please go back to your specific workspace. Then you can choose `colcon build --cmake-clean-cache` to rebuild, or you can clean the build, install and log directories with `rm -r build install log` before executing `colcon build`.<br/>
82+
>
83+
>
84+
## &sect; Import information available on the screen
85+
> * How can the user confirm that the data conversion process has been completed?<br/>
86+
> Ans: The user can find the string "``File saved with new kinematic values.``" displayed on the screen.<br/>
87+
> * How can the user find the location of the newly generated named robot description file?<br/>
88+
> Ans: The user can first find the displayed string "``[new save file path:] ``" on the screen, and the following string is the file save location.<br/>
89+
90+

doc/tm_humble_description_e.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# __Generate your TM Robot-Specific Kinematics Parameters Files__
2+
Real kinematic values vary from TM robot to another one as each robot is calibrated at the factory.<br/>
3+
The user can use the tm_mod_urdf package to extract specific kinematic values from your TM robot, which are taken into account by a Python script function using a specific set of commands to automatically generate a new Xacro robot model description file.
4+
> If the user just wants to use the TM Robot nominal model to control the robot, the user can skip the rest of this chapter.<br/>
5+
6+
## &sect; Corrected kinematics value description
7+
> The precise kinematic parameters of a robot are useful for improving the end-point accuracy of the robot.<br/>
8+
> Due to manufacturing tolerances during manufacturing and the installation error in the robot assembly process, the positioning accuracy and precision of the mechanism will be affected. The error between the reality and the nominal robot model is significantly reduced by the corrected robot description. The kinematic parameter compensated deviations of the robot can improve the absolute positioning accuracy of the robot.<br/>
9+
> If the user needs to improve simulation accuracy or end effector tracking performance, it is recommended that the user import the corrected calibrated kinematic parameters from the real TM Robot to replace the nominal set of D-H parameters. Techman Robot provides the Xacro file that configures the TM Robot model with a set of nominal DH parameters, and one that uses the programming scripts to obtain calibrated kinematic parameters from a parameter server connected to your TM robot and perform a set of overrides to output a new corrected Xacro file.<br/>
10+
> <br/>
11+
> The common Python script is used as follows:
12+
>```bash
13+
> python3 <script_name> <urdf_from> <urdf_gen>
14+
>```
15+
> * <script_name> : Provide modify_xacro.py or modify_urdf.py two Python scripts program as options.
16+
> * <urdf_from>: The first argument represents the original URDF model form of the TM Robot, and the file part naming <sup>1</sup> is <urdf_from>.<br/>
17+
> <sup>1</sup> There will be several built-in TM Robot nominal robot model settings, available for TM5S, TM7S, TM12S, TM14S, and TM25S models.<br/>
18+
> For example, select your real robot type as the input nominal model form. If your TM robot is TM12S, then the user can type tm12s as the <urdf_from>.<br/>
19+
> * <urdf_gen>: The second argument means the newly generated URDF model form of the TM Robot, and the file <sup>2</sup> name is <urdf_gen>.<br/>
20+
> <sup>2</sup> For example, if the user names it test and select modify_xacro.py as script program, a test.urdf.xacro robot description file will be generated.<br/>
21+
>
22+
> The Python script for more specific arguments is used as follows:
23+
>```bash
24+
> python3 <script_name> <urdf_from> <urdf_gen> <specific_para>
25+
>```
26+
> * <specific_para>: The third argument is provided for use in some special cases. Please refer to the scripting program <sup>3</sup> for details of this item.<br/>
27+
> <sup>3</sup> For a simple third argument example, type the argument "-M" as follows:<br/>
28+
> Example : ``python3 modify_xacro.py tm12s test -M``<br/>
29+
> &rarr; A robot description file "`macro.test.urdf.xacro`" will be generated, and the string 'macro.' is prepended to the <urdf_gen> name.<br/>
30+
31+
32+
## &sect; Create with specific kinematic parameters of the local TM Robot
33+
> :bulb: Do you run the driver to maintain the connection with TM Robot, make sure that TM Robot's operating software (TMflow) network settings are ready and the Listen node is running.<br/>
34+
> <br/>
35+
> * #### __Take generating a new Xacro file as an example__
36+
> The following steps describe how to import specific kinematic values using a real TM12S Robot following the procedure below, and select the corresponding type tm12s as an example of <urdf_from>.<br/>
37+
>
38+
> 1. In a terminal: Source setup.bash in the workspace path and connect to TM Robot by typing<br/>
39+
>
40+
> ```bash
41+
> source /opt/ros/humble/setup.bash
42+
> cd <workspace>
43+
> export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
44+
> export ROS_DOMAIN_ID=<ROS_DOMAIN_ID>
45+
> source ./install/setup.bash
46+
> ```
47+
> **Note**: Domain ID is the key to ROS communication, and please make sure the ROS node works under the ROS environment setup with the same Domain ID as the robot.<br/>
48+
>
49+
> 2. In this terminal: Change the current directory to the directory path of the Python script to get the specific kinematic parameters of your TM Robot, and then enter the specified command format to generate a new name by the <urdf_gen> argument, for example, named user_defined.<br/>
50+
>
51+
> ```bash
52+
> cd src/tm_mod_urdf/tm_mod_urdf
53+
> python3 modify_xacro.py tm12s user_defined
54+
> ```
55+
> When this procedure is completed, the user can find that the newly generated named robot description file has been saved, e.g."``user_defined.urdf.xacro``".<br/>
56+
> :bookmark_tabs: Note: In the previous chapter, we renamed the download folder tm2_ros2 (or tm2_ros2-master) to src. If the user misses this step, they will encounter such an error "``[Error] [modify_xacro]: workspace directory not find ``" on the screen when executing the above command.<br/>
57+
>
58+
> 3. Next, the user must modify the filename part of the default pre-built nominal robot model in tm12s.urdf.xacro to a newly generated robot model description naming file.<br/>
59+
> ```bash
60+
> cd src\tm_description\xacro\
61+
> sudo vim tm12s.urdf.xacro
62+
> ```
63+
>> or use ``gedit`` text editor instead of ``vim`` to edit the file contents, by typing<br/>
64+
> ```bash
65+
> sudo gedit tm12s.urdf.xacro
66+
> ```
67+
>
68+
> :bookmark_tabs: Note: If your real Robot is a TM25S, in the above example, you should type tm25s as an example for <urdf_from> and modify the tm25s.urdf.xacro file.<br/>
69+
>
70+
> Please refer to the following to modify the content format of the filename line:<br/>
71+
> ```bash
72+
> # Before modification : (Take the pre-built TM12S nominal robot model as an example)
73+
> <xacro:include filename="$(find tm_description)/xacro/macro.tm12s-nominal.urdf.xacro" />
74+
> # After modification : (Replace with your actual newly generated Xacro file)
75+
> <xacro:include filename="$(find tm_description)/xacro/user_defined.urdf.xacro" />
76+
> ```
77+
> Finally, the user can launch the modified robot file "``tm12s.urdf.xacro``" to run your TM Robot or simulate the robot more accurately.<br/>
78+
>> :bulb: **Tip**: Remember to recompile since the code has been changed.<br/>
79+
>> Please go back to your specific workspace. Then you can choose `colcon build --cmake-clean-cache` to rebuild, or you can clean the build, install and log directories with `rm -r build install log` before executing `colcon build`.<br/>
80+
>
81+
>
82+
## &sect; Import information available on the screen
83+
> * How can the user confirm that the data conversion process has been completed?<br/>
84+
> Ans: The user can find the string "``File saved with new kinematic values.``" displayed on the screen.<br/>
85+
> * How can the user find the location of the newly generated named robot description file?<br/>
86+
> Ans: The user can first find the displayed string "``[new save file path:] ``" on the screen, and the following string is the file save location.<br/>
87+
88+

image_sub/src/sub_img.cpp

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ void SubImg::get_new_image_callback(sensor_msgs::msg::Image::SharedPtr msg){
6060
std::cout << "Width : " << frame.size().width << std::endl;
6161
std::cout << "Height: " << frame.size().height << std::endl;
6262
frame.copyTo(this->image);
63-
std::cout<<"after set this->image = frame";
63+
std::cout<<"after setting this->image = frame";
6464
}
6565
catch(std::runtime_error &exception){
66-
std::cout<<"there is a exception "<< exception.what()<< std::endl;
66+
std::cout<<"there is an exception "<< exception.what()<< std::endl;
6767
}
6868
}
6969

tm_description/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 3.10.2)
2+
project(tm_description)
3+
4+
find_package(ament_cmake REQUIRED)
5+
6+
install(
7+
DIRECTORY launch meshes rviz xacro
8+
DESTINATION share/${PROJECT_NAME}
9+
)
10+
11+
ament_package()
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import os
2+
3+
from ament_index_python.packages import get_package_share_directory
4+
from launch import LaunchDescription
5+
from launch_ros.actions import Node
6+
import xacro
7+
8+
# Prerequisites: joint-state-publisher-gui
9+
# Terminal: [key-in] shell cmd $ sudo apt install ros-humble-joint-state-publisher
10+
# $ sudo apt install ros-humble-joint-state-publisher-gui
11+
# Usage: Spawn a Techman robot model in the Rviz2.
12+
# Example: Take TM12S Techman robot model as the default, so set 'tm12s.urdf.xacro' in robot_description_config
13+
# Terminal: [key-in] shell cmd $ ros2 launch tm_description view_robot.launch.py
14+
15+
16+
def generate_launch_description():
17+
robot_description_config = xacro.process_file(
18+
os.path.join(
19+
get_package_share_directory('tm_description'),
20+
'xacro',
21+
'tm12s.urdf.xacro',
22+
)
23+
)
24+
robot_description = {'robot_description': robot_description_config.toxml()}
25+
26+
# RViz
27+
rviz_config_file = get_package_share_directory('tm_description') + '/rviz/view_robot.rviz'
28+
rviz_node = Node(
29+
package='rviz2',
30+
executable='rviz2',
31+
name='rviz2',
32+
output='log',
33+
arguments=['-d', rviz_config_file],
34+
parameters=[robot_description]
35+
)
36+
37+
# Static TF
38+
static_tf = Node(
39+
package='tf2_ros',
40+
executable='static_transform_publisher',
41+
name='static_transform_publisher',
42+
output='log',
43+
arguments=['0.0', '0.0', '0.0', '0.0', '0.0', '0.0', 'world', 'base']
44+
)
45+
46+
# Publish TF
47+
robot_state_publisher = Node(
48+
package='robot_state_publisher',
49+
executable='robot_state_publisher',
50+
name='robot_state_publisher',
51+
output='both',
52+
parameters=[robot_description]
53+
)
54+
55+
joint_state_publisher_node = Node(
56+
package='joint_state_publisher_gui',
57+
executable='joint_state_publisher_gui',
58+
name='joint_state_publisher_gui'
59+
)
60+
61+
return LaunchDescription([static_tf, robot_state_publisher, joint_state_publisher_node, rviz_node])
172 KB
Binary file not shown.
235 KB
Binary file not shown.
204 KB
Binary file not shown.
207 KB
Binary file not shown.

0 commit comments

Comments
 (0)