Your real issue is that this demo.launch.py is configured (by default) to not publish TF on the standard /tf and /tf_static topics.
In your demo.launch.py you have this argument:
one_tf_tree = LaunchConfiguration('one_tf_tree')
one_tf_tree_cmd = DeclareLaunchArgument(
'one_tf_tree',
default_value='false',
description='on true all tfs are published with a namespace on /tf and /tf_static')So by default (false), Stage commonly publishes TF on namespaced topics like:
/robot_0/tf
/robot_0/tf_static
…and therefore you see no messages on /tf and /tf_static, which then breaks SLAM Toolbox (TF2 listens to /tf and /tf_static).
Fix option A (recommended): launch with one_tf_tree:=true
Run:
source /opt/ros/jazzy/setup.bash
source ~/nav_class_ws/install/setup.bash
ros2 launch stage_ros2 demo.launch.py one_tf_tree:=trueThen immediately verify:
ros2 topic echo /tf --once
ros2 topic echo /tf_static --onceIf those print → TF is fixed and SLAM Toolbox will work.
Fix option B: change the default in demo.launch.py
Edit your file and change the default from false to true:
Before
one_tf_tree_cmd = DeclareLaunchArgument(
'one_tf_tree',
default_value='false',
description='on true all tfs are published with a namespace on /tf and /tf_static')After
one_tf_tree_cmd = DeclareLaunchArgument(
'one_tf_tree',
default_value='true',
description='on true all tfs are published with a namespace on /tf and /tf_static')Then re-run:
ros2 launch stage_ros2 demo.launch.pyOne more note (important for SLAM)
Your demo loads cave_three_robots.world (3 robots). That’s heavy and causes “queue full” quickly. For SLAM teaching, it’s best to use one robot if you have a single-robot world/launch available.
Do this now (minimal)
Stop current demo (Ctrl+C)
Relaunch:
ros2 launch stage_ros2 demo.launch.py one_tf_tree:=trueVerify:
ros2 topic echo /tf --once
ros2 topic echo /tf_static --onceIf you paste the output of ros2 topic list | grep tf after relaunch, I’ll tell you exactly which TF topic layout you’re getting (and what to use for SLAM params).