Why Rviz2 not confused when ydlidar publishes static tf2?
I am building a ROS2 Foxy robot with the YDLIDAR X4 for 360 degree range scans. I'm a ROS2 noob and not comfortable that I understand what the robot_state_publisher and joint_state_publisher generate from the URDF.
I have been launching robot_state and joint_state publisher nodes on my ROS2 desktop when I launch Rviz2.
I was looking at the YDLIDAR ROS2 node running on the bot, and surprised to see that the launch file contains a static transform publisher:
tf2_node = Node(package='tf2_ros',
executable='static_transform_publisher',
name='static_tf_pub_laser',
arguments=['0', '0', '0.02','0', '0', '0', '1','base_link','laser_frame'],
)
return LaunchDescription([
params_declare,
driver_node,
tf2_node,
and my URDF has:
<!-- LIDAR -->
<link name="laser_frame">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<cylinder length="0.020" radius="0.0325" />
</geometry>
<material name="blue" />
</visual>
</link>
<joint name="joint_ydlidar" type="fixed">
<parent link="base_link"/>
<child link="laser_frame"/>
<origin xyz="-0.014 0 0.200" rpy="0 0 0" />
</joint>
Why does the ydlidar pub that static transform?
Why does Rviz2 not get confused?
Is it because I launch the robot_state pub, joint_state pub, and Rviz2 after the bot and LIDAR are already running, so the LIDAR tf2 was pub'd into the ether with no subscriber at the time?)
C:\fakepath\Rviz2_LIDAR_Ultrasonic_V53L0X.png
ubuntu@rosdesk:~/handsonros2$ ros2 run tf2_ros tf2_echo base_link laser_frame
[INFO] [1632353862.239498120] [tf2_echo]: Waiting for transform base_link -> laser_frame: Invalid frame ID "base_link" passed to canTransform argument target_frame - frame does not exist
(this is after the bot and LIDAR start up)
At time 0.0
- Translation: [0.000, 0.000, 0.020]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
At time 0.0
- Translation: [0.000, 0.000, 0.020]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
(this is after robot_state and joint_state pubs, and rviz2 start up)
At time 0.0
- Translation: [-0.014, 0.000, 0.200]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
At time 0.0
- Translation: [-0.014, 0.000, 0.200]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
At time 0.0
- Translation: [-0.014, 0.000, 0.200]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
This is very interesting. Could you edit your question to include your tf tree and the output of
ros2 run tf2_ros tf2_echo base_link laser_frame
AFTER you have launched everything?Thank you @janindu for not just answering my question but showing me how to answer the question.