This package converts maps in ROS format (as defined by map_server
) to Pedsim
scenarios.
Obstacles are created according to the boundaries of the free space in the map, and waypoints and agents can optionally be included through a separate YAML file.
A map can be converted in a scenario by using the included launchfile:
roslaunch ros_maps_to_pedsim ros_maps_to_pedsim.launch
The launchfile takes the following arguments:
-
map_path
(default:.
): path to the folder where the map is located -
map_name
(default:map.yaml
): name of the map metadata file (details on the map format here) -
scenario_path
(default: same folder asmap_path
): path to the folder where the scenario should be saved -
scenario_name
(default:scene.xml
): name of the generated scenario file -
use_map_origin
(default:false
): iftrue
reads the map origin from the map metadata file, otherwise sets it to[0.0, 0.0, 0.0]
. Integration withpedsim_ros
works better in the latter case. -
add_agents
(default:true
): iftrue
, agents will be added to the scenario according to the agents YAML file given byagents_info_path
andagents_info_name
; iffalse
, no agents or waypoints are added to the scenario and those two arguments are not used -
agents_info_path
(default: same folder asmap_path
): path to the folder where the YAML file containing agents and waypoints info is located -
agents_info_name
(default:agents.yaml
): name of the agents and waypoints info file
The scripts expects the map info to be given in the form of a YAML file (containing the map metadata) and an image file. Information on the format of these files is available in the ROS wiki.
Maps generated by ROS map_server
should work out of the box, but by following
the same template, maps built manually can also be used.
Pedsim scenarios can include groups of agents moving through a set of waypoints (more details in Pedsim's documentation).
An optional YAML file containing a set of waypoints and agents can also be provided to the script to include them in the generated scenario. The YAML file should be formatted as follows:
waypoints:
waypoint_id_1: [x, y, radius]
waypoint_id_2: [x, y, radius]
waypoint_id_3: [x, y, radius]
agent_1:
n: 1
x: 0
y: 0
w: [waypoint_id_1, waypoint_id_2]
agent_2:
n: 1
x: 0
y: 0
w: [waypoint_id_2, waypoint_id_3]
Optionally, values for type
, dx
and dy
can be provided for each agent. If
no value is provided, by default type: 1
, dx: 0.5
and dy: 0.5
.
The script expects at least the waypoints
header and another header
representing one agent.
Waypoints are provided with their id
as key, and their x
, y
and radius
properties as numerical values in a list.
Each agent is defined by a multiplier n
(how many copies of that agent should
be spawned), an initial (x
, y
) position, and a list w
of waypoint id
s.
NB: headers for different agents can have any name (except waypoints
),
but they need to have unique names.
The generated scenario can be used with pedsim_ros
by the included
launchfile:
roslaunch ros_maps_to_pedsim ros_map_simulator.launch
This launchfile has most arguments in common with the launchfile found in the
pedsim_ros
package, the most important of which is the scene_file
argument
that should be used to give the path to the generated scenario XML file.
Additionally, this launchfile has a map_file
argument that can be used to
give the path to the map used to generate the scenario. The map will be opened
by map_server
and should be perfectly aligned with the pedsim scene.