I am working on a LiDAR-enhanced robotic system. My robot uses ROS 2 (running on a Raspberry Pi 4B) for 2D SLAM-based navigation and mapping. The robot uses a differential drive controller for movement, and I am controlling it via teleop twist keyboard. However, I have noticed that the LaserScan data moves along with the robot instead of staying fixed in the environment.
Steps Taken to Debug:
✔ Checked the /scan topic to confirm LaserScan data is being published.
✔ Verified ros2 topic echo /scan and the LaserScan visualization in RViz.
✔ Confirmed the static transform (tf) between base_link and laser_frame is set correctly.
✔ Verified that the odometry transform (base_link → odom) is dynamic, while the LiDAR frame remains statically linked to base_link
Issue:
When the robot moves using teleop, the LaserScan data moves with it instead of boundaries staying fixed to the world.
This makes the LiDAR readings inaccurate for mapping and navigation.