[ROS2 Foxy] [nav2] Map_saver crash when calling service /save_map
Hello, I am working with ros2 foxy and nav2. I am using a map server to publish a static map for my global_costmap node. and I am also using a map_saver so I can call the service /map_saver/save_map whenever I need. This service is called in a python node with the following code : (The fill_map function is used to process the .pgm file created)
req = SaveMap.Request()
req.map_topic = "/global_costmap/costmap"
req.map_url = self.last_map
req.image_format = "pgm"## Heading ##
req.map_mode = "trinary"
req.free_thresh = 0.1
req.occupied_thresh = 0.65
try:
while not self.client_save_map.wait_for_service(timeout_sec=1.0):
self.get_logger().info('service "save_map" not available, waiting again...')
future = self.client_save_map.call_async(req)
future.add_done_callback(self.fill_map)
rclpy.spin_until_future_complete(self, future)
except Exception as e:
return 1
When this code calls the service to save the map I get the following error half the time :
[map_saver_server-15] [INFO] [1657705013.677320999] [map_saver]: Saving map from '/global_costmap/costmap' topic to 'map_20220713_113653' file
[map_saver_server-15] Magick: abort due to signal 11 (SIGSEGV) "Segmentation Fault"...
[ERROR] [map_saver_server-15]: process has died [pid 74196, exit code -6, cmd '/opt/ros/foxy/lib/nav2_map_server/map_saver_server --ros-args --params-file /tmp/launch_params_laosjfut --params-file /home/user/my_robot_application/install/my_robot/share/my_robot/config/nav2_params.yaml'].
So I looked at the mentionned file and nothing seemed wrong :
temp file :
/**:
ros__parameters:
use_sim_time: true
config file (striped down to important nodes) :
global_costmap:
global_costmap:
ros__parameters:
publish_frequency: 1.0
update_frequency: 5.0
global_frame: map
robot_base_frame: base_link
use_sim_time: False
robot_radius: 0.5
resolution: 0.05
track_unknown_space: true
plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /scan
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
static_layer:
plugin: "nav2_costmap_2d::StaticLayer"
map_subscribe_transient_local: True
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
cost_scaling_factor: 3.0
inflation_radius: 0.55
always_send_full_costmap: True
global_costmap_client:
ros__parameters:
use_sim_time: False
global_costmap_rclcpp_node:
ros__parameters:
use_sim_time: False
map_saver:
ros__parameters:
use_sim_time: False
save_map_timeout: 15000
free_thresh_default: 0.1
occupied_thresh_default: 0.65
It seems to be a know issue (https://github.com/ros-planning/navig...) and to resolve it one must simply build from source magick but i can't figure out how to do it. I would greatly appreciate any direction as to where to search ? Thank you all for taking the time to read my question