ROS2 launch multiple turtlebots in namespaces dynamically
Hello,
I want to simulate many turtlebot3 in Gazebo (ROS2 Foxy). Because the amount could vary, it would be best for me to have an option like the namespace argument of the gazebo spawner. Sadly when I spawn via
ros2 run gazebo_ros spawn_entity.py -entity robot1 -x 0 -y 0 -z 0 -file ~/turtlebot3_ws/install/turtlebot3_gazebo/share/turtlebot3_gazebo/models/turtlebot3_waffle_pi/model.sdf -robot_namespace robot1
I am able to spawn, but when I run slam, I get errors. My first idea was, that maybe the robot_state_publisher is necessary, but so far I was not able to launch it properly afterwards.
This tutorial shows, how to do it with a package, but wants to edit a yaml by hand and is only for the physical robot. Also this answer has a very tideous way do do it by hand for a fixed amount of bots.
On the official website, there is no tutorial for foxy here. The multi robot spawn seems only supported for Kinetic.
Is there a better way, to spawn a turtlebot3 inside a namespace with a single command? So that this command can be executed in a for loop? Thanks