Skip to content

Commit 790e5ab

Browse files
authored
RFC Feature - Georeference (#93)
Signed-off-by: Michał Pełka <[email protected]>
1 parent 5688d70 commit 790e5ab

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

rfcs/RFC Feature - Georeference.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Support for georefrence
2+
3+
## Summary
4+
5+
This RFC proposes to create a separate canonical gem in o3de-extras repository that will allow georeferencing O3DE level.
6+
7+
## What is the relevance of this feature?
8+
9+
This feature enables advanced robotics cases, simulation, Earth science, geodesy, cartography, and surveying.
10+
It will expose API that will simplify integration with formats like [KML](https://pl.wikipedia.org/wiki/Keyhole_Markup_Language) or [GeoJSON](https://pl.wikipedia.org/wiki/GeoJSON).
11+
12+
## Feature design description
13+
14+
## Technical design description
15+
16+
A new gem called "Georeference" is proposed.
17+
It is implemented and documented as part of ROS 2 gem, but in this RFC I propose to move it to separated canonical gem.
18+
The Gem will contain public API and LevelComponent that will perform conversion calculation.
19+
20+
In the proposed form, it will allow to perform conversion from [WGS-84](https://en.wikipedia.org/wiki/World_Geodetic_System) to local level's coordinate system and vice-versa.
21+
Conversion from WGS-84 to Level will be performed via:
22+
- converting WGS-84 coordinates (longitude in degrees, latitude in degrees, altitude in meters) to 3D cartesian coordinate system using WGS-84 ellipsoid reference. New coordinates will be in meters in Earth-centered, [Earth-fixed coordinate system](https://en.wikipedia.org/wiki/Earth-centered,_Earth-fixed_coordinate_system).
23+
- Apply conversion from ECEF to local ENU(East North Up) frame at given location [conversion details](https://gssc.esa.int/navipedia/index.php/Transformations_between_ECEF_and_ENU_coordinates).
24+
- Apply affine transform (rotation and translation) to fit configured using GeoReferenceLevelComponent.
25+
26+
27+
### Representation in the engine
28+
29+
The Gem will expose a public API that will allow user to convert [WGS-84](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinates to level and vice versa.
30+
API will in the form of EventBus:
31+
```cpp
32+
struct WGS84Coordinate
33+
{
34+
AZ_RTTI(WGS84Coordinate, "{577a5637-b31a-44c5-a33f-50df2922af2a}");
35+
static void Reflect(AZ::ReflectContext* context);
36+
37+
double m_latitude = 0.0; //!< Latitude in degrees.
38+
double m_longitude = 0.0; //!< Longitude in degrees.
39+
double m_altitude = 0.0; //!< Altitude in meters.
40+
};
41+
42+
//! Interface that allows to convert between level and WGS84 coordinates.
43+
class GeoreferenceRequests
44+
{
45+
public:
46+
47+
//! Function converts from Level's coordinate system to WGS84.
48+
//! @param xyz Vector3 in Level's coordinate system.
49+
//! @return Vector3 in WGS84 coordinate system as @class WGS::WGS84Coordinate.
50+
virtual WGS::WGS84Coordinate ConvertFromLevelToWGS84(const AZ::Vector3& xyz) = 0;
51+
52+
//! Function converts from WGS84 coordinate system to Level's.
53+
//! @param latLon Vector3 in WGS84 coordinate system, where x is latitude, y is longitude and z is altitude.
54+
//! @return Vector3 in Level's coordinate system.
55+
virtual AZ::Vector3 ConvertFromWGS84ToLevel(const WGS::WGS84Coordinate& latLon) = 0;
56+
57+
//! Function returns rotation from Level's frame to ENU's (East-North-Up) rotation.
58+
//! Function is useful to fin georeference rotation of the level.
59+
//! @return Quaternion in ENU coordinate system.
60+
virtual AZ::Quaternion GetRotationFromLevelToENU() = 0;
61+
};
62+
63+
class GeoreferenceRequestsTraits : public AZ::EBusTraits
64+
{
65+
public:
66+
// EBusTraits overrides ...
67+
static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
68+
static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
69+
};
70+
```
71+
This Event bus will be handled by a level component.
72+
73+
74+
### New components
75+
76+
**GeoReferenceLevelComponent.**
77+
This component will have a reference to another entity (called `ENU entity`).
78+
`ENU entity` will have:
79+
- known WGS-84 coordinates
80+
- will be oriented in a way to point:
81+
- X in East direction
82+
- Y in North direction
83+
- Z is up.
84+
85+
## What are the advantages of the feature?
86+
87+
- Standard way to convert WGS-84 coordinates to level coordinates system and _vice versa_.
88+
- No need to design the level with the geodetic orientation of the level.
89+
90+
## What are the disadvantages of the feature?
91+
92+
- Adding new gem to maintain.
93+
- It assumes that Earth is flat (locally).
94+
- Will work fine for small (few kilometers level). Larger levels still will need a custom solution.
95+
96+
## Are there any alternatives to this feature?
97+
98+
The current alternative is to keep this feature as part of ROS 2 Gem.
99+
100+
## How will users learn this feature?
101+
102+
Documentation in o3de.org
103+
104+
## Are there any open questions?
105+
106+
- Is the proposed API complete?
107+
- Is this feature is needed outside ROS 2 gem?
108+
109+
---
110+
111+
[Current implementation in ROS2 gem](https://github.com/o3de/o3de-extras/tree/development/Gems/ROS2/Code/Source/Georeference)
112+
113+
[Documentation of the feature in ROS2 gem](https://development--o3deorg.netlify.app/docs/user-guide/interactivity/robotics/georeference/)

0 commit comments

Comments
 (0)