SteveMacenski / slam_toolbox

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

[slam_toolbox]: Failed to compute odom pose #678

Closed jagauthier closed 4 months ago

jagauthier commented 4 months ago

Sorry for posting this here. This is not a bug (I don't think) I'm using ROS2, on docker containers (debian bookworm) with an RPLIDAR A1.

I've started the LIDAR which published /scan. I've set up a static transform from base_link to laser. I've started the laser scanner matcher, which publishes odom transforms

Then I start up the SLAM toolkit like so:

ros2 launch slam_toolbox online_sync_launch.py \
odom_frame:=odom \
base_frame:=base_link \
map_frame:=map \
scan_topic:=/scan \
map_update_interval:=1 \
max_laser_rang:=5 \
minimum_travel_distance:=0.1 \
use_scan_matching:=true \
minimum_travel_heading:=1.57 \
do_loop_closing:=true

I've detailed this here: https://robotics.stackexchange.com/questions/109756/trouble-with-slam-toolkit/109769#109769

My estimate is that this piece of code is returning false:

  bool getOdomPose(karto::Pose2 & karto_pose, const rclcpp::Time & t)
  {
    geometry_msgs::msg::TransformStamped base_ident, odom_pose;
    base_ident.header.stamp = t;
    base_ident.header.frame_id = base_frame_;
    base_ident.transform.rotation.w = 1.0;

    try {
      odom_pose = tf_->transform(base_ident, odom_frame_);
    } catch (tf2::TransformException & e) {
      return false;
    }

So I would guess it's something wrong with the odom frame to base_ident (which is defined/assigned in this function). But I don't know how to fix it. or troubleshoot it further

Thanks for looking,

jagauthier commented 4 months ago

I solved this. Apparently using the launch file is the wrong way to do this.