@@ -93,15 +93,19 @@ void Lanelet2MapLoaderNode::on_map_projector_info(
93
93
throw std::invalid_argument (
94
94
" allow_unsupported_version is false, so stop loading lanelet map" );
95
95
}
96
- } else if (const int map_major_ver = static_cast <int >(format_version[0 ] - ' 0' );
97
- map_major_ver > static_cast <int >(version)) {
98
- RCLCPP_WARN (
99
- get_logger (),
100
- " format_version(%d) of the provided map(%s) is larger than the supported version(%d)" ,
101
- map_major_ver, lanelet2_filename.c_str (), static_cast <int >(version));
102
- if (!allow_unsupported_version) {
103
- throw std::invalid_argument (
104
- " allow_unsupported_version is false, so stop loading lanelet map" );
96
+ } else if (const auto map_major_ver_opt = lanelet::io_handlers::parseMajorVersion (format_version);
97
+ map_major_ver_opt.has_value ()) {
98
+ const auto map_major_ver = map_major_ver_opt.value ();
99
+ if (map_major_ver > static_cast <uint64_t >(lanelet::autoware::version)) {
100
+ RCLCPP_WARN (
101
+ get_logger (),
102
+ " format_version(%ld) of the provided map(%s) is larger than the supported version(%ld)" ,
103
+ map_major_ver, lanelet2_filename.c_str (),
104
+ static_cast <uint64_t >(lanelet::autoware::version));
105
+ if (!allow_unsupported_version) {
106
+ throw std::invalid_argument (
107
+ " allow_unsupported_version is false, so stop loading lanelet map" );
108
+ }
105
109
}
106
110
}
107
111
RCLCPP_INFO (get_logger (), " Loaded map format_version: %s" , format_version.c_str ());
0 commit comments