TF coordinate transformation of ROS-9 ROS common components

1. Concept

Coordinate transformation is simply normalization, which is to replace the measured position information between other objects and sensors on the robot with information between the object and the origin of the robot.

According to the knowledge we learned in high school, as long as the relative relationship between different coordinate systems is clarified, any coordinate point can be converted between different coordinate systems, but the calculation implementation is more commonly used, and the algorithm is also a bit complicated. Therefore, the related modules are directly encapsulated in ROS: Coordinate Transformation (TF). TF coordinate transformation is used to realize the conversion of points or vectors between different coordinate systems in ROS.

TF coordinate transformation is realized by broadcasting TF transformation and monitoring TF transformation

2. Check whether the current coordinate systems in the system are connected

rosrun tf view_frames

Running the above specification will generate two files, .gv and .pdf, in the main directory, which are used to display the connectivity of each coordinate system in the current system

For example, if you run turtle_tf_demo in ros, three coordinate systems are defined in this routine: the coordinate origin, turtle1, and turtle2. Turtle2 will monitor the position transformation of turtle1d relative to the world, and then change its position. to follow turtle1 in real time.

Install the package before doing this:

sudo apt-get install ros-melodic-turtle-tf

The running routine code is as follows:

roslaunch turtle_tf turtle_tf_demo.launch

Then run: rosrun tf view_frames to view the relationship between the coordinate systems in the current system.

 3. Query the positional relationship between any two coordinate systems of the tf tree species in real time:

rosrun tf tf_echo 根坐标系 目标坐标系

 For example: I still run the turtle_tf_demo.launch routine, and then run

rosrun tf tf_echo turtle1 turtle 2

When I control the movement of the first turtle with the keyboard, the coordinate position relationship between the second turtle and the first turtle is as follows:

 Where Translation is translation, which is the translation of the target coordinates relative to the root coordinates x, y, and z directions

Rotation is a rotation, indicating how the target coordinate system can be rotated to reach the root coordinate system. Rotation has three representations

Fourth, view the positional relationship between coordinate systems through rviz

run

rosrun rviz rviz 'rospack find turtle_tf' /rviz/turtle_rviz.rviz

You can see the process of coordinate change between world, turtle1, and turtle2 

Guess you like

Origin blog.csdn.net/m0_46093829/article/details/122287020