Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to slam using YDLidar #25

Open
hyng809 opened this issue Jan 20, 2023 · 3 comments
Open

How to slam using YDLidar #25

hyng809 opened this issue Jan 20, 2023 · 3 comments

Comments

@hyng809
Copy link

hyng809 commented Jan 20, 2023

Hello
This is the first time using YDLidar.
I have verified that Lidar works through Rviz on Ubuntu.
I want to create maps and use navigation using Lidar, which I am currently using.
I would like to know more detailed process and tutorial about this.
This is the development environment I am currently developing.

  • Ubuntu 20.04
  • ROS2 foxy
    -YDLidar TG15
  • Raspberry Pi 4
    -PC
@anasderkaoui
Copy link

anasderkaoui commented Nov 30, 2023

  • Make sure you install "slam_toolbox" (package to do SLAM): sudo apt update && sudo apt install ros-foxy-slam-toolbox
  • Turn on the LiDAR: ros2 launch ydlidar_ros2_driver ydlidar_launch_view.py (This also launches the tf tree required for slam, but you have to change "base_link" in this line to "base_footprint" and rebuild the package)
  • In another terminal, run: ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 odom base_footprint Do this only if you don't have an odometry output from like wheel encoders...
  • Now run in another terminal: ros2 launch slam_toolbox online_sync_launch.py This is just an example, there are other options, you can view them by double pressing the tab key. After that, you should see "Registering Sensor..."
  • Finally, run RVIZ2 and add the topic "map", it takes a moment to load the map but it eventually shows up!!

@ndp-seee-hust
Copy link

ndp-seee-hust commented Jun 3, 2024

Hello @anasderkaoui. Thank for sharing!
I have followed your instructions and I have a problem. My map cannot update or expand when I rotate and move the Lidar. Please help me fix this problem!

  • YDLidar X3
  • Ubuntu 20.04
  • ROS2 foxy

map

@anasderkaoui
Copy link

Hello @ndp-seee-hust, make sure that you have the odometry node running.
This was, in my case, one of the main reasons the map did not update. And also, move the lidar very slowly and don't rotate it suddenly because that will overlap the maps that will be created.
I advise you to take a look at my repo for more detailed information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants