-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Hi everyone,
im currently working on the simulation_manager.cpp. My goal is to load new layers from bitmap png files on every episode while training and deleting the old layers. For this purpose i wrote a ros::Subscriber inside the simulation_manager.cpp and defined a callback function.
ros::Subscriber goal_sub = n.subscribe("/goal", 1, &SimulationManager::callback_goal, this);
void SimulationManager::callback_goal(geometry_msgs::PoseStamped goal_msg) {
YamlReader world_reader = YamlReader(map_layer_yaml_file_);
YamlReader layers_reader = world_reader.Subnode("layers", YamlReader::LIST);
for (auto &layer : world_->layers_) { // delete layers
if (layer->body_ != nullptr) {
layer->body_->physics_body_ = nullptr;
}
delete layer;
}
world_->cfr_.layer_id_table_.clear(); // empty the layer_id_table
world_->LoadLayers(layers_reader); // load "map" layer from png file
world_->DebugVisualize();
}
During roslaunch i start the simulation with an empty map
properties:
velocity_iterations: 10
position_iterations: 10
layers:
- name: static
map: empty.yaml
color: [0, 1, 0, 1]
and afterwards use world_->LoadLayers(layers_reader); to load the real map for training via this yaml file:
properties:
velocity_iterations: 10
position_iterations: 10
layers:
- name: map
map: map.yaml
color: [0, 0, 1, 1]
This works for the first episode of training and the visualization works as well, but flatland server process dies after the first episode.
[flatland_server-2] process has died [pid 9515, exit code -11, cmd /home/ducanor/catkin_ws/devel/lib/flatland_server/flatland_server __name:=flatland_server __log:=/home/ducanor/.ros/log/978f8eb0-d9aa-11eb-8ae5-00155d6d5b70/flatland_server-2.log].
log file: /home/ducanor/.ros/log/978f8eb0-d9aa-11eb-8ae5-00155d6d5b70/flatland_server-2*.log
My guess is that there is a problem with the deleting during the callback. Maybe "map" layer is not deleted properly and this causes the process to die.
P.S.: I tried without deleting, but this causes the process to die after loading layers the maximum amount of times (16). The layers will not be overwritten.