SteveMacenski / slam_toolbox

Slam Toolbox for lifelong mapping and localization in potentially massive maps with ROS
GNU Lesser General Public License v2.1
1.6k stars 513 forks source link

Lidar data moving instead of robot #688

Closed SchlackBoles closed 5 months ago

SchlackBoles commented 5 months ago

Hi.

I am running Ubuntu 22.04 on both my laptop and my raspberry pi5 (docker container here) and I have a LD19 lidar which I run on the pi. I am currently using Ros2 Humble on both devices.

I start the Lidar by using

ros2 launch ldlidar_stl_ros2 ld19.launch.py

which I got from this https://github.com/ldrobotSensorTeam/ldlidar_stl_ros2.git. Then I launch my robot launch file which is a simplification of a toy excavator (basically just a square box with wheels and a lidar on top). So far, so good. I open Rviz2 up and add the laserscan (/scan) so I can see the lidar data, RobotModel (/robot_description) so I can see the robot and tf so I can see the tree and the reference frames. At this point I launch slam_toolbox_online_async_launch.py and I add a slam_params_file in which I have set:

 # ROS Parameters
    odom_frame: base_link
    map_frame: map
    base_frame: base_link
    scan_topic: /scan
    mode: mapping

as I do not have any odometry data. I add a map in rviz2 and subscribe to the /map topic and it looks like the mapping process has started. Unfortunately, when I move the robot around (does not matter if I carry it around or drive it around), the lidar points move, but both the map and the robot are completely still. I understand that there is something I am missing, but I do not understand what.

I want to use the lidar data to update the robot position if that was not clear.

SteveMacenski commented 5 months ago

You require odometry and a TF tree compliant with REP 105