ROBOTIS-GIT / turtlebot3

ROS packages for Turtlebot3
http://turtlebot3.robotis.com
Apache License 2.0
1.52k stars 1.03k forks source link

Problem with making maps using Turtlebot3 #960

Open GitHubGM opened 1 year ago

GitHubGM commented 1 year ago

ISSUE TEMPLATE ver. 0.4.0

  1. Which TurtleBot3 platform do you use?

    • [x] Burger
    • [ ] Waffle
    • [ ] Waffle Pi
  2. Which ROS is working with TurtleBot3?

    • [ ] ROS 1 Kinetic Kame
    • [ ] ROS 1 Melodic Morenia
    • [ ] ROS 1 Noetic Ninjemys
    • [ ] ROS 2 Dashing Diademata
    • [ ] ROS 2 Eloquent Elusor
    • [x] ROS 2 Foxy Fitzroy
    • [ ] etc (Please specify your ROS Version here)
  3. Which SBC(Single Board Computer) is working on TurtleBot3?

    • [ ] Intel Joule 570x
    • [ ] Raspberry Pi 3B+
    • [x] Raspberry Pi 4
    • [ ] etc (Please specify your SBC here)
  4. Which OS you installed on SBC?

    • [x] Raspbian distributed by ROBOTIS
    • [ ] Ubuntu MATE (16.04/18.04/20.04)
    • [ ] Ubuntu preinstalled server (18.04/20.04)
    • [ ] etc (Please specify your OS here)
  5. Which OS you installed on Remote PC?

    • [ ] Ubuntu 16.04 LTS (Xenial Xerus)
    • [ ] Ubuntu 18.04 LTS (Bionic Beaver)
    • [x] Ubuntu 20.04 LTS (Focal Fossa)
    • [ ] Windows 10
    • [ ] MAC OS X (Specify version)
    • [ ] etc (Please specify your OS here)
  6. Specify the software and firmware version(Can be found from Bringup messages)

    • Software version: []
    • Firmware version: []
  7. Specify the commands or instructions to reproduce the issue.

    • HERE
  8. Copy and Paste the error messages on terminal.

    • HERE
  9. Please describe the issue in detail. Screenshot from 2023-05-22 16-32-48

My map is moving with turtlebot3 in cartographer, when I'm standing in place, I'm getting this kind of maps: Screenshot from 2023-05-22 16-49-01

Same problem in nav2, I made map little without moving turtlebot3, but in nav2 map is moving with robot and it's colliding with an obstacle

Lorenzuser commented 1 year ago

I have the same issue using Ubuntu 22.04 on both Pi and dev-Pc. With ROS2 Humble and the turtlebot3-burger. I guess the issues may be some error with inverted positional values. I assume this should lead to that type of error., but just a guess of mine, I couldn't already find that out.

Lorenzuser commented 1 year ago

I frequently get this warn-message aswell. So maybe something with the communication?: [cartographer_node-1] [WARN] [1685612940.829999826] [cartographer logger]: W0601 11:49:00.000000 13241 range_data_collator.cc:82] Dropped 1 earlier points.

alanmillard commented 1 year ago

I'm also experiencing the same issue as @GitHubGM - I tried to get Cartographer working last year with Ubuntu 20.04 and ROS 2 Foxy, but couldn't figure out how to fix it. The problem may have been related to the following debug message that I received at the time:

[rviz2-3] [INFO] [1657104665.991447799] [rviz2]: Message Filter dropping message: frame 'base_scan' at time 1657104664.548 for reason 'Unknown'

I'm now trying again with Ubuntu 22.04 and ROS 2 Humble and observing a similar issue, but getting the same debug message as @Lorenzuser:

[cartographer_node-1] [WARN] [1686835803.215531200] [cartographer logger]: W0615 14:30:03.000000 13206 range_data_collator.cc:82] Dropped 4 earlier points.

A similar issue has been reported on the Cartographer GitHub repo (cartographer-project/cartographer_ros#1303), which suggested that it might be a time sync problem, so I followed the instructions on the ROBOTIS wiki to sync time between the PC and the robot using ntp, but it didn't help.

I've tried flashing the OpenCR board with various different firmware versions. I initially followed the OpenCR setup instructions on the wiki for Humble to flash firmware version 0.2.1 (latest) from the OpenCR-Binaries GitHub repo.

The README.md suggests that this release should fix odometry issues, but it doesn't seem to make any difference to the issue described in this thread:

  • ROS2 F/W V0.2.1 (2023. Jan. 27th)
    • Fixes TB3 ROS2 Odometry issue fixed (See here for more related threads)

I then tried following the instructions on flashing the OpenCR board from a PC using the Arduino IDE, which seems to use the code from this separate GitHub repo: https://github.com/ROBOTIS-GIT/OpenCR. I tried the latest version (1.5.2), as well as (1.5.0) based on the suggestion in #940, but this didn't seem to make any difference to using the 0.2.1 binary.

The instructions on the wiki for Humble suggest using "File > Examples > turtlebot3 > turtlebot3_burger > turtlebot3_core", but there is also an option for "File > Examples > TurtleBot3 ROS2 > turtlebot3_burger" - I had to install the Dynamixel2Arduino library (0.6.3) to get this to compile, but it doesn't seem to make a difference either.

I'm not sure how these GitHub repositories relate to each other - presumably the OpenCR repo is the source code for the OpenCR-Binaries repo, but the version numbering is confusing. Version 1.5.2 of the source code was released on 13th October 2022, but the version 0.2.1 binary was released on 27th January 2023, which suggests that it is newer.

The OpenCR-Binaries repo appears to be specific to the turtlebot3, while the OpenCR repo contains code for several different applications, which perhaps explains the different version numbering. However, there are various version numbers in the turtlebot3 code that don't seem to match up with the releases in OpenCR-Binaries.

There are at least two other (seemingly unresolved) issues that describe the same problem as the one detailed in this thread:

I'm not sure if this is even an issue with the OpenCR board firmware - roslaunch turtlebot3_bringup turtlebot3_robot.launch runs without errors, and roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch works fine. Also, if I set the reference frame in rviz2 to /odom instead of /map, this shows that the robot is able to estimate its position quite accurately based on odometry alone, and I can see that LaserScan is visualising as expected. Could this therefore be a problem with Cartographer itself? i.e. is the SLAM algorithm just failing to generate the /map reference frame correctly?

By following these instructions on the ROBOTIS wiki I was able to confirm that Cartographer accurately performs SLAM when used in conjunction with the Gazebo simulator, just not with the physical robot. If the robot remains stationary after starting Cartographer, it is able to produce a stable map of the surrounding area, but once it starts moving (either translation or rotation, or both) the /map reference frame occasionally "jumps" and creates overlapping maps that result in a blurry mess.

Is it just that the Cartographer configuration file turtlebot3_lds_2d.lua is tuned to work with the Gazebo simulation, rather than the physical robot? There is some guidance on how to tune Cartographer, but it has a lot of settings and I'm not entirely sure where to start with this:

https://google-cartographer-ros.readthedocs.io/en/latest/tuning.html https://emanual.robotis.com/docs/en/platform/turtlebot3/slam/#tuning-guide

I have tried switching the RMW from the default Fast DDS to Cyclone DDS (on the robot and the PC), as described here: https://roboticsbackend.com/ros2-nav2-tutorial/, but this didn't help.

I'm also not clear on which version of the turtlebot3 ROS drivers should be used for Humble. The setup instructions for the Raspberry Pi on the ROBOTIS wiki tell you to clone the humble-devel branch from https://github.com/ROBOTIS-GIT/turtlebot3.git. However, there is also a hotfix-humble branch - should this be used instead?

@ROBOTIS-Will could you please help with this? Given that the instructions on the wiki do not seem to produce reliable results, it would be useful to have a definitive set of instructions that work for Humble, in terms of: