TF is ROS’s way of determining the robot’s location and relationships between coordinate frames. For more comprehensive explanation about TF, click here.
5.1 The robot’s transforms
5.1.1 odom -> base_link
This transform is the relationship between the robot’s current position from its origin. This transform is broadcasted concurrently as /odom topic is published from lino_base_node. Below is the block of commented codes where the TF is broadcasted. /linorobot/src/lino_base_node.cpp
5.1.2 base_link -> laser
This transform is the static relationship between the lidar and the robot’s base. Basically, this tells ROS the lidar’s offset in x, y and z axis from the center of the robot’s base. Imagine a lidar (mounted behind a 10cm long base) detects an obstacle 10 cm in front of the robot. The actual distance of the robot from the obstacle would be 5 cm since there’s a 5 cm offset from the center of the base to the rear. Without this transform, the robot would have hit the obstacle prematurely as it thinks that the obstacle is still 10 cm away when it’s only 5cm away from the obstacle.
5.2 Configuring Laser’s TF
Determine the lidar’s location from the center of the base and change the first three numbers in “args” to your measured offsets. What these values mean is that the lidar is 6.5 cm forward and 19.6 cm from the ground.
You can Click here to know more about configuring your transforms.
5.3 Checking Laser’s TF
Open two terminals on the robot’s computer.
On your development computer, run rviz:
Once rviz is open, import laser.rviz by clicking File > Config and choose ~/catkin_ws/src/lino_visualize/rviz/laser.rviz.
Place the robot 1 m away from a wall. Check on rviz if the wall detected is~1m. Each square in rviz is 1 square meter.
If the wall detected on rviz doesn’t match with the actual distance between the wall and the robot, confirm that your x, y, and z offsets defined at laser.launch are correct.
6. Creating a map
The robot is all set. Continue to creating a map for SLAM.