How can I simulate multiple Huskies in a single Gazebo environment? This question pops up from time to time from customers who have adopted multiple Clearpath robots. While there are various options, including the Multimaster FKIE ROS package, many customers seem to struggle with finding an acceptable working solution. Thankfully, there is a new ROS package that spawns multiple Huskies in a single Gazebo simulation environment, and it is the subject of this month’s ROS Spotlight.
Brian Bingham is an Associate Professor in the Department of Mechanical and Aerospace Engineering at the Naval Postgraduate School in Monterey, California. He is currently developing a course on multi-robot control that uses three Husky UGV mobile robot platforms. In his lab, a big part of the process is testing first in simulation in preparation for and in parallel with experiments using physical robots. The need to simulate multi-robot control using multiple Huskies lead Brian to develop a new multi-robot ROS package.
Built as an extension of the Simulating Husky tutorial, the nre_simmultihusky package provides a “minimal” working example of multiple Huskies simulated in a Gazebo environment. “While the package doesn’t contain any real localization and the simulation world is fairly empty, the idea was to provide a “hello world” example from which students could develop their multi-robot simulation.” said Brian. The package comes with a launch script that spawns two simulated Huskies with interactive controllers in rviz. Additional Huskies can be easily added if needed.
Though Brian has worked with other robot software suites before recently diving into the world of ROS, he found instantiating multiple robots in Gazebo in a consistent, scalable way to be surprisingly challenging. These challenges mostly stemmed from managing the namespsaces and the tf_prefixes. “My impression was that the ROS namespaces would allow me to modularize the instantiation of the robots to manage multiple instances on the same ROS master”, said Brian. “My experience was that support for these namespaces was not consistent. For example, some modules needed me to specify the namespace explicitly, effectively ruining the modularity. In addition, I found the tf frames to be effectively an entire parallel namespaces where the “tf_prefix” was even more challenging to handle in a scalable way.” Through some insight from the community on ROS Answers and by carefully inspecting some of ROS’ “black boxes”, Brian made it work.