Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0f6c927

Browse files
author
Sebastian Zęderowski
committedNov 5, 2024·
feat(map_loader) add support for local cartesian projection to lanelet map loader
Signed-off-by: Sebastian Zęderowski <szederowski@autonomous-systems.pl>
1 parent f0f5736 commit 0f6c927

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed
 

‎common/autoware_geography_utils/src/lanelet2_projector.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <autoware_lanelet2_extension/projection/mgrs_projector.hpp>
1818
#include <autoware_lanelet2_extension/projection/transverse_mercator_projector.hpp>
1919

20+
#include <lanelet2_projection/LocalCartesian.h>
2021
#include <lanelet2_projection/UTM.h>
2122

2223
namespace autoware::geography_utils
@@ -44,6 +45,13 @@ std::unique_ptr<lanelet::Projector> get_lanelet2_projector(const MapProjectorInf
4445
lanelet::Origin origin{position};
4546
lanelet::projection::TransverseMercatorProjector projector{origin};
4647
return std::make_unique<lanelet::projection::TransverseMercatorProjector>(projector);
48+
} else if (projector_info.projector_type == MapProjectorInfo::LOCAL_CARTESIAN) {
49+
lanelet::GPSPoint position{
50+
projector_info.map_origin.latitude, projector_info.map_origin.longitude,
51+
projector_info.map_origin.altitude};
52+
lanelet::Origin origin{position};
53+
lanelet::projection::LocalCartesianProjector projector{origin};
54+
return std::make_unique<lanelet::projection::LocalCartesianProjector>(projector);
4755
}
4856
const std::string error_msg =
4957
"Invalid map projector type: " + projector_info.projector_type +

‎map/autoware_map_projection_loader/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ map_origin:
7070
altitude: 0.0 # [m]
7171
```
7272
73+
### Using LocalCartesian
74+
75+
If you want to use local cartesian WGS84, please specify the map origin as well.
76+
77+
```yaml
78+
# map_projector_info.yaml
79+
projector_type: LocalCartesian
80+
vertical_datum: WGS84
81+
map_origin:
82+
latitude: 35.6762 # [deg]
83+
longitude: 139.6503 # [deg]
84+
altitude: 0.0 # [m]
85+
```
86+
7387
### Using TransverseMercator
7488
7589
If you want to use Transverse Mercator projection, please specify the map origin as well.

‎map/autoware_map_projection_loader/src/map_projection_loader.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ tier4_map_msgs::msg::MapProjectorInfo load_info_from_yaml(const std::string & fi
3737

3838
} else if (
3939
msg.projector_type == tier4_map_msgs::msg::MapProjectorInfo::LOCAL_CARTESIAN_UTM ||
40+
msg.projector_type == tier4_map_msgs::msg::MapProjectorInfo::LOCAL_CARTESIAN ||
4041
msg.projector_type == tier4_map_msgs::msg::MapProjectorInfo::TRANSVERSE_MERCATOR) {
4142
msg.vertical_datum = data["vertical_datum"].as<std::string>();
4243
msg.map_origin.latitude = data["map_origin"]["latitude"].as<double>();
@@ -48,7 +49,8 @@ tier4_map_msgs::msg::MapProjectorInfo load_info_from_yaml(const std::string & fi
4849

4950
} else {
5051
throw std::runtime_error(
51-
"Invalid map projector type. Currently supported types: MGRS, LocalCartesianUTM, "
52+
"Invalid map projector type. Currently supported types: MGRS, LocalCartesian, "
53+
"LocalCartesianUTM, "
5254
"TransverseMercator, and local");
5355
}
5456
return msg;

0 commit comments

Comments
 (0)
Please sign in to comment.