Localization¶
Introduction¶
This module provides localization services. There are two ways in which localization is provided:
The RTK (Real Time Kinematic) based method which incorporates GPS and IMU (Inertial Measurement Unit) information
The multi-sensor fusion method which incorporates GPS, IMU, and LiDAR information.
Input¶
In the provided RTK localization method, there are two inputs:
GPS - The Global Positioning System
IMU - Inertial Measurement Unit
In the multi-sensor fusion localization method, there are three inputs:
GPS - The Global Positioning System
IMU - Inertial Measurement Unit
LiDAR - Light Detection And Ranging Sensor
For more information, refer to
Guowei Wan, Xiaolong Yang, Renlan Cai, Hao Li, Yao Zhou, Hao Wang, Shiyu Song. “Robust and Precise Vehicle Localization Based on Multi-Sensor Fusion in Diverse City Scenes,” 2018 IEEE International Conference on Robotics and Automation (ICRA), Brisbane, QLD, 2018, pp. 4670-4677. doi: 10.1109/ICRA.2018.8461224. link
Output¶
An object instance defined by Protobuf message LocalizationEstimate
, which can be found in file localization/proto/localization.proto
.
Implementing Localization¶
Currently the RTK based localization is implemented in class RTKLocalization
. If you are implementing a new localization method, for example, FooLocalization
, you would need to perform the following steps:
In
proto/localization_config.proto
, add a valueFOO
to theLocalizationType
enum typeGo to the
modules/localization
directory, and create afoo
directory. In thefoo
directory, implement the classFooLocalization
by following the code in theRTKLocalization
class in thertk
directory.FooLocalization
has to be a subclass ofLocalizationBase
. Also create a filefoo/BUILD
by following the filertk/BUILD
You need to register the
FooLocalization
class in the functionLocalization::RegisterLocalizationMethods()
, which is located in thelocalization.cc
file. You can register it by inserting the following code at the end of the function:
localization_factory_.Register(LocalizationConfig::FOO, []()->LocalizationBase* { return new FooLocalization(); });
Make sure your code compiles by including the header files that defines class
FooLocalization
Now you can go back to the
apollo
root directory and build your code with commandbash apollo.sh build