This is a work in progress version
A ROS2 wrapper to use the HuNavSim with the Gazebo Simulator (tested with ROS Humble and Gazebo 11). Different scenarios (a cafe, a warehouse, and a house) are included. A set of different human models are available too.
The wrapper is based on two components:
-
The hunav_gazebo_world_generator node. It is in charge of reading the simulation configuration parameters (human agents parameters) from the hunav_loader node, and the base Gazebo world file. With these parameters, the node modifies the base world file and includes the indicated human agents and the Gazebo plugin to control them (HuNavPlugin).
-
The HuNavPlugin is a Gazebo plugin in charge of interacting with the HuNavSim to control the human movements. This interaction is performed through ROS2 services.
The hunav_gazebo_world_generator node has these parameters:
gazebo_world_file
. Name of the base Gazebo world file. This world should contain the static models (obstacles, rooms, furniture, etc). The human agents will be added automatically to this world. The world files must be placed inside the directory worlds.
The plugin parameters are read as ROS2 parameters also by the hunav_gazebo_world_generator node, which is in charge of adding the plugin to the Gazebo world file.
update_rate
. Update rate (Hz) of the plugin proccess.robot_name
. Name of the Gazebo model corresponding to the robot that will be spawned.use_gazebo_obs
. If True, the closest obstacle for each agent will be computed and added to the agent features (Default: True).global_frame_to_publish
. Coordinate frame in which the pedestrian positions are provided.use_navgoal_to_start
. Boolean to indicate whether the plugin must wait for the robot to receive a navigation goal to start the movement of the human agents (Default: False).-
navgoal_topic
. Name topic in which the robot navigation goal will be received. The message must be type geometry_msgs/msg/PoseStamped. This parameter is used only if the parameteruse_navgoal_to_start
is True. (Default: /goal_pose).
ignore_models
. List of the Gazebo models than must be ignored by the pedestrians like the ground plane.
An example snippet of the HuNavPlugin which is automatically inserted in the world file:
<plugin name="hunav_plugin" filename="libHuNavPlugin.so">
<update_rate>100.0</update_rate>
<robot_name>robot</robot_name>
<use_gazebo_obs>True</use_gazebo_obs>
<global_frame_to_publish>map</global_frame_to_publish>
<use_navgoal_to_start>false</use_navgoal_to_start>
<navgoal_topic>goal_pose</navgoal_topic>
<ignore_models>
<model>cafe</model>
<model>ground_plane</model>
</ignore_models>
</plugin>
- The HuNavSim: https://github.com/robotics-upo/hunav_sim
- The ROS2 package gazebo_ros_pkgs is also required:
sudo apt install ros-humble-gazebo-ros-pkgs
- The gazebo models should be reacheable through the enviroment variable 'GAZEBO_MODEL_PATH'. You can source /usr/share/gazebo/setup.sh to stablish it.
- This is a ROS2 package so it must be placed inside a ROS2 workspace and compiled through the regular colcon tool.
colcon build --packages-select hunav_gazebo_wrapper
- Example of a Gazebo world of a café with a static actor (Actor3) playing the role of the robot:
ros2 launch hunav_gazebo_wrapper example_cafe.launch.py
-
You can modify the hunav agents spawned by modifiying the agents' configuration file in:
[your_workspace]/src/hunav_sim/hunav_agent_manager/config/agents.yaml
-
If you prefer to create the agents' configuration file by using the GUI, you can do it by launching:
ros2 launch hunav_rviz2_panel hunav_rviz2_launch.py
- If you want to use your robot instead, you can check the launch file pmb2_cafe.launch.py, and replace the pmb2 robot by yours, and spawn it in Gazebo.
In the directory docker_pmb2_hunavsim, we provide a docker with the HuNavSim and the PMB2 Robot (ROS 2) from PAL Robotics
Before building the docker image, it is recommended to clean the build caché of Docker:
docker buildx prune
Then, to build the docker image, from the docker directory, execute the folowing command in a terminal:
docker build -t pmb2_hunavsim -f Dockerfile.pmb2_hunavsim .
After the image has been build, you can run a container by executing the bash file:
./run_container-pmb2_hunavsim.bash
Once you are inside the container, you have three different example scenarios to launch the Pmb2 robot (with autonomous navigation) with the hunansim agents:
- Café scenario:
ros2 launch hunav_gazebo_wrapper pmb2_cafe.launch.py
- House environment:
ros2 launch hunav_gazebo_wrapper small_house.launch.py
- Small warehouse scenario:
ros2 launch hunav_gazebo_wrapper small_warehouse.launch.py
NOTE: SOMETIMES, GAZEBO TAKES A LONG TIME TO LAUNCH THE FIRST TIME LEADING TO ERRORS IN THE SYSTEM. IN THAT CASE, RE-RUN THE ROS LAUNCH FILE AGAIN. IT SHOULD WORK THE SECOND TIME.
- Augment the number and quality of the 3d models that represent the hunav_agents
This work is partially supported by Programa Operativo FEDER Andalucia 2014-2020, Consejeria de Economía, Conocimiento y Universidades (DeepBot, PY20_00817) and the project NHoA (PLEC2021-007868) and NORDIC (TED2021-132476B-I00), funded by MCIN/AEI/10.13039/501100011033 and the European Union NextGenerationEU/PRTR.