File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -601,8 +601,18 @@ void tryWriteMapToFile(
601
601
e << YAML::Key << " origin" << YAML::Flow << YAML::BeginSeq << map.info .origin .position .x <<
602
602
map.info .origin .position .y << yaw << YAML::EndSeq;
603
603
e << YAML::Key << " negate" << YAML::Value << 0 ;
604
- e << YAML::Key << " occupied_thresh" << YAML::Value << save_parameters.occupied_thresh ;
605
- e << YAML::Key << " free_thresh" << YAML::Value << save_parameters.free_thresh ;
604
+
605
+ if (save_parameters.mode == MapMode::Trinary) {
606
+ // For Trinary mode, the thresholds depend on the pixel values in the saved map,
607
+ // not on the thresholds used to threshold the map.
608
+ // As these values are fixed above, the thresholds must also be fixed to separate the
609
+ // pixel values into occupied, free and unknown.
610
+ e << YAML::Key << " occupied_thresh" << YAML::Value << 0.65 ;
611
+ e << YAML::Key << " free_thresh" << YAML::Value << 0.196 ;
612
+ } else {
613
+ e << YAML::Key << " occupied_thresh" << YAML::Value << save_parameters.occupied_thresh ;
614
+ e << YAML::Key << " free_thresh" << YAML::Value << save_parameters.free_thresh ;
615
+ }
606
616
607
617
if (!e.good ()) {
608
618
RCLCPP_ERROR_STREAM (
You can’t perform that action at this time.
0 commit comments