Localization module for HD maps.
The localization module uses sensor data from camera, radar, or lidar to localize the vehicle to a precise pose on an HD map.
Data Structures | |
struct | dwLocalizationCameraParameters |
Parameters for initializing the camera localization module. More... | |
struct | dwLocalizationRadarParameters |
Parameters for initializing the radar / lidar localization module. More... | |
struct | dwLocalizationResult |
Output structure obtained from any of the localization modules (camera, radar, lidar, fusion). More... | |
Modules | |
Localization Fusion Interface | |
Localization fusion module for HD maps. | |
Macros | |
#define | DW_LOCALIZATION_MAX_CAMERA_COUNT 8 |
Typedefs | |
typedef struct dwLocalizationObject * | dwLocalizationHandle_t |
Handle to a localization module object. More... | |
typedef dwLocalizationRadarParameters | dwLocalizationLidarParameters |
Functions | |
DW_API_PUBLIC dwStatus | dwLocalization_cameraInitialize (dwLocalizationHandle_t *localization, dwConstMapHandle_t map, const dwLocalizationCameraParameters *params, dwContextHandle_t context) |
Create a new camera localization module. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_cameraInitParamsFromRig (dwLocalizationCameraParameters *params, dwConstRigHandle_t rig, uint32_t numCameras, const uint32_t cameraIndices[]) |
Initializes a camera localization parameters struct for an existing rig. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_cameraLocalize (dwLocalizationResult *localizationResult, const dwLaneDetection laneDetectionsPerCamera[], const dwLandmarkDetection poleDetectionsPerCamera[], const dwObjectArray signAndLightDetectionsPerCamera[], const dwGlobalEgomotionResult *globalEgoResult, const dwGlobalEgomotionUncertainty *globalEgoUncertainty, const dwTransformation3f *currToPrev, const dwEgomotionRelativeUncertainty *currToPrevUncertainty, dwTime_t timestamp, dwLocalizationHandle_t localization) |
Localize the rig based on the latest measurements with camera. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_cameraSetExtrinsics (uint32_t cameraIndex, const dwTransformation3f *cameraToRig, dwLocalizationHandle_t localization) |
Sets the camera-to-rig extrinsic transformation for a specified camera. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_getCUDAStream (cudaStream_t *stream, dwLocalizationHandle_t localization) |
Gets the CUDA stream used by all landmark detections. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_lidarInitialize (dwLocalizationHandle_t *localization, dwConstMapHandle_t map, dwMapProviderHandle_t mapProvider, const dwMapsContentLayerBuffer *contentLayers, const dwLocalizationLidarParameters *params, dwContextHandle_t context) |
Create a new lidar localization module. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_lidarLocalize (dwLocalizationResult *localizationResult, const dwLidarPointXYZI *lidarPoints, size_t numPoints, const dwGlobalEgomotionResult *globalEgoResult, const dwGlobalEgomotionUncertainty *globalEgoUncertainty, const dwTransformation3f *currToPrev, const dwEgomotionRelativeUncertainty *currToPrevUncertainty, dwTime_t timestamp, dwLocalizationHandle_t localization) |
Localize the rig based on the latest measurements with lidar. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_radarInitialize (dwLocalizationHandle_t *localization, dwConstMapHandle_t map, dwMapProviderHandle_t mapProvider, const dwMapsContentLayerBuffer *contentLayers, const dwLocalizationRadarParameters *params, dwContextHandle_t context) |
Create a new radar localization module. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_radarLocalize (dwLocalizationResult *localizationResult, const dwVector4f *radarPoints, size_t numPoints, const dwGlobalEgomotionResult *globalEgoResult, const dwGlobalEgomotionUncertainty *globalEgoUncertainty, const dwTransformation3f *currToPrev, const dwEgomotionRelativeUncertainty *currToPrevUncertainty, dwTime_t timestamp, dwLocalizationHandle_t localization) |
Localize the rig based on the latest measurements with radar. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_release (dwLocalizationHandle_t localization) |
Releases the localization module. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_reset (dwLocalizationHandle_t localization) |
Resets all internal state of the localization module; does not modify properties specified in each initialization function. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_setCUDAStream (cudaStream_t stream, dwLocalizationHandle_t localization) |
Sets the CUDA stream for CUDA related operations. More... | |
DW_API_PUBLIC dwStatus | dwLocalization_setMap (dwConstMapHandle_t map, dwLocalizationHandle_t localization) |
Sets a new HD Map to localize to. More... | |
struct dwLocalizationCameraParameters |
Data Fields | ||
---|---|---|
dwFThetaCameraConfig | cameraIntrinsics[DW_LOCALIZATION_MAX_CAMERA_COUNT] | The intrinsic parameters of each camera. |
dwTransformation3f | camerasToRig[DW_LOCALIZATION_MAX_CAMERA_COUNT] | The extrinsic transformations of each camera to the rig. |
uint32_t | numCameras | The number of cameras to use for localization. |
struct dwLocalizationRadarParameters |
struct dwLocalizationResult |
Data Fields | ||
---|---|---|
float32_t | confidence |
A [0, 1] floating point number that indicates the confidence of the localization result. Note that this feature is not available yet in this release and is set to 1. |
dwQuaterniond | globalOrientation |
Global orientation (quaternion) in the local ENU frame set at globalPosition. When isMapAvailable is true, globalOrientation is computed by combining relativeOrientation and the rotation from the local ENU frame set at the road segment origin to the local ENU frame set at globalPosition. Otherwise, globalOrientation corresponds to the passed-in global egomotion orientation. |
dwMapsGeoPoint | globalPosition |
Global WGS84 position (LLA). When isMapAvailable is true, globalPosition is computed by combining relativePosition and the ENU origin of the road segment. Otherwise, globalPosition corresponds to the passed-in global egomotion position. |
dwLocalizationResultIndicator | indicator |
Localization indicator indicates whether there are any problems. Note that this feature is not available yet in this release and set to DW_LOCALIZATION_RESULT_INDICATOR_NORMAL. |
bool | isMapAvailable |
A boolean flag indicating if map is available in the surrounding of the vehicle. If true, then roadSegmentId, relativePosition, and relativeOrientation are valid. Otherwise, these three fields are invalid. |
dwMatrix3d | orientationUncertainty | A 3x3 covariance matrix indicating orientation uncertainty with respect to the rig frame itself (order: rotation around x, y, z axes) [rad]. |
dwMatrix3d | positionUncertainty | A 3x3 covariance matrix indicating position uncertainty with respect to the rig frame itself (order: x,y,z) [m]. |
dwQuaterniond | relativeOrientation | Relative orientation in a local ENU frame set at the road segment origin. |
dwVector3f | relativePosition | Relative position in a local ENU frame set at the road segment origin. |
dwMapsRoadSegmentId | roadSegmentId | ID of the road segment that relative pose is with respect to. |
dwTime_t | timestamp | Timestamp that localization was run on. |
#define DW_LOCALIZATION_MAX_CAMERA_COUNT 8 |
Definition at line 150 of file Localization.h.
typedef struct dwLocalizationObject* dwLocalizationHandle_t |
Handle to a localization module object.
Definition at line 71 of file Localization.h.
Definition at line 180 of file Localization.h.
Defines all the possible localization result indicators, set via bits.
Definition at line 76 of file Localization.h.
DW_API_PUBLIC dwStatus dwLocalization_cameraInitialize | ( | dwLocalizationHandle_t * | localization, |
dwConstMapHandle_t | map, | ||
const dwLocalizationCameraParameters * | params, | ||
dwContextHandle_t | context | ||
) |
Create a new camera localization module.
[out] | localization | Handle to the camera localization module being initialized. |
[in] | map | Handle to the maps module used for map data. |
[in] | params | Localization initialization parameters. |
[in] | context | Handle to the current driveworks context. |
DW_API_PUBLIC dwStatus dwLocalization_cameraInitParamsFromRig | ( | dwLocalizationCameraParameters * | params, |
dwConstRigHandle_t | rig, | ||
uint32_t | numCameras, | ||
const uint32_t | cameraIndices[] | ||
) |
Initializes a camera localization parameters struct for an existing rig.
[out] | params | Pointer to the camera localization parameters struct being initialized. |
[in] | rig | Handle to a vehicle rig configuration instance. |
[in] | numCameras | The number of cameras to use for localization. |
[in] | cameraIndices | The indices of the cameras to use from the vehicle rig handle. |
DW_API_PUBLIC dwStatus dwLocalization_cameraLocalize | ( | dwLocalizationResult * | localizationResult, |
const dwLaneDetection | laneDetectionsPerCamera[], | ||
const dwLandmarkDetection | poleDetectionsPerCamera[], | ||
const dwObjectArray | signAndLightDetectionsPerCamera[], | ||
const dwGlobalEgomotionResult * | globalEgoResult, | ||
const dwGlobalEgomotionUncertainty * | globalEgoUncertainty, | ||
const dwTransformation3f * | currToPrev, | ||
const dwEgomotionRelativeUncertainty * | currToPrevUncertainty, | ||
dwTime_t | timestamp, | ||
dwLocalizationHandle_t | localization | ||
) |
Localize the rig based on the latest measurements with camera.
[out] | localizationResult | Localization estimation, including the timestamp, the absolute position in wgs84, orientation to ENU coordinate at the absoulte position of the rig, ID of the closest road segment, relative rotation and translation to the origin of the closest road segment, and a flag indicating validity of the relative pose. |
[in] | laneDetectionsPerCamera | Per-camera detected lanes at the current timestamp. The size of the array is assumed to be equal to the number of the cameras that the module was initialized with. |
[in] | poleDetectionsPerCamera | Per-camera detected poles at the current timestamp (can be null if none exists). The size of the array is assumed to be equal to the number of the cameras that the module was initialized with. |
[in] | signAndLightDetectionsPerCamera | Per-camera detected traffic lights or traffic signs in the current timestamp (can be null if none exists). The size of the array is assumed to be equal to the number of the cameras that the module was initialized with. |
[in] | globalEgoResult | Global rig position in LLA and orientation (x, y, z, w) mapping from the rig to ENU at global rig position the rig, both at the same timestamp as the detections. Note that both globalEgoResult.validPosition and globalEgoResult.validOrientation have to be true for localization to run successfully for at least once. Otherwise this function will return DW_NOT_AVAILABLE. |
[in] | globalEgoUncertainty | Uncertainty of global position, represented by a 3x3 covariance in ENU in [m], and uncertainty of global orientation, represented by a 3x3 covariance of the equivalent euler angles (order: roll, pitch, yaw) in [rad]. |
[in] | currToPrev | The relative transformation mapping the current frame's pose to the previous frame's pose. Previous denotes the timestamp of the last time dwLocalization_cameraLocalize was called. If this is the first time calling dwLocalization_cameraLocalize, the identity transformation is expected. |
[in] | currToPrevUncertainty | The uncertainty of the relative transformation. If this is the first time calling dwLocalization_lidarLocalize, any arbitrary uncertainty is accepted. |
[in] | timestamp | Timestamp for the camera frame that landmark detections are from. |
[in] | localization | Handle to the localization module. |
DW_API_PUBLIC dwStatus dwLocalization_cameraSetExtrinsics | ( | uint32_t | cameraIndex, |
const dwTransformation3f * | cameraToRig, | ||
dwLocalizationHandle_t | localization | ||
) |
Sets the camera-to-rig extrinsic transformation for a specified camera.
This only needs to be called if transformations specified in dwLocalizationCameraParameters::camerasToRig need be modified after initialization of the localization module.
[in] | cameraIndex | The index of the camera to set the extrinsic transformation for. This index must correspond with the camera index inside the dwLocalizationCameraParameters used to initialize the module. |
[in] | cameraToRig | Transformation from the specified camera's coordinate system to the vehicle rig's coordinate system. |
[in] | localization | A handle to the localization module. |
DW_API_PUBLIC dwStatus dwLocalization_getCUDAStream | ( | cudaStream_t * | stream, |
dwLocalizationHandle_t | localization | ||
) |
Gets the CUDA stream used by all landmark detections.
[out] | stream | The CUDA stream currently used. |
[in] | localization | A handle to the localization module. |
DW_API_PUBLIC dwStatus dwLocalization_lidarInitialize | ( | dwLocalizationHandle_t * | localization, |
dwConstMapHandle_t | map, | ||
dwMapProviderHandle_t | mapProvider, | ||
const dwMapsContentLayerBuffer * | contentLayers, | ||
const dwLocalizationLidarParameters * | params, | ||
dwContextHandle_t | context | ||
) |
Create a new lidar localization module.
[out] | localization | Handle to the localization module being initialized. |
[in] | map | Handle to the maps module used for map data. |
[in] | mapProvider | Handle to map provider for image data. |
[in] | contentLayers | Requested maps image layers for lidar localization. |
[in] | params | Lidar localization initialization parameters. |
[in] | context | Handle to the current driveworks context. |
DW_API_PUBLIC dwStatus dwLocalization_lidarLocalize | ( | dwLocalizationResult * | localizationResult, |
const dwLidarPointXYZI * | lidarPoints, | ||
size_t | numPoints, | ||
const dwGlobalEgomotionResult * | globalEgoResult, | ||
const dwGlobalEgomotionUncertainty * | globalEgoUncertainty, | ||
const dwTransformation3f * | currToPrev, | ||
const dwEgomotionRelativeUncertainty * | currToPrevUncertainty, | ||
dwTime_t | timestamp, | ||
dwLocalizationHandle_t | localization | ||
) |
Localize the rig based on the latest measurements with lidar.
[out] | localizationResult | Localization estimation including the absolute position in wgs84, orientation to ENU coordinate at the absolute position of the rig, id to the closest road segment, relative rotation and translation to the origin of the closest road segment, and a flag indicating validity of relative pose. |
[in] | lidarPoints | Buffer of lidar points with (x, y, z, intensity) each. |
[in] | numPoints | Number of lidar points in buffer. |
[in] | globalEgoResult | Global rig position in LLA and orientation (x, y, z, w) mapping from the rig to ENU at global rig position the rig, both at the same timestamp as timestamp. Note that both globalEgoResult.validPosition and globalEgoResult.validOrientation have to be true for localization to run successfully for at least once. Otherwise this function will return DW_NOT_AVAILABLE. |
[in] | globalEgoUncertainty | Uncertainty of global position, represented by a 3x3 covariance in ENU in [m], and uncertainty of global orientation, represented by a 3x3 covariance of the equivalent euler angles (order: roll, pitch, yaw) in [rad]. |
[in] | currToPrev | The relative transformation mapping the current frame's pose to the previous frame's pose. Previous denotes the timestamp of the last time dwLocalization_lidarLocalize was called. If this is the first time calling dwLocalization_lidarLocalize, the identity transformation is expected. |
[in] | currToPrevUncertainty | The uncertainty of the relative transformation. If this is the first time calling dwLocalization_lidarLocalize, any arbitrary uncertainty is accepted. |
[in] | timestamp | Timestamp of points in lidarPoints buffer. |
[in] | localization | Handle to the localization module. |
DW_API_PUBLIC dwStatus dwLocalization_radarInitialize | ( | dwLocalizationHandle_t * | localization, |
dwConstMapHandle_t | map, | ||
dwMapProviderHandle_t | mapProvider, | ||
const dwMapsContentLayerBuffer * | contentLayers, | ||
const dwLocalizationRadarParameters * | params, | ||
dwContextHandle_t | context | ||
) |
Create a new radar localization module.
[out] | localization | Handle to the localization module being initialized. |
[in] | map | Handle to the maps module used for map data. |
[in] | mapProvider | Handle to map provider for image data. |
[in] | contentLayers | Requested maps image layers for radar localization. |
[in] | params | Radar localization initialization parameters. |
[in] | context | Handle to the current driveworks context. |
DW_API_PUBLIC dwStatus dwLocalization_radarLocalize | ( | dwLocalizationResult * | localizationResult, |
const dwVector4f * | radarPoints, | ||
size_t | numPoints, | ||
const dwGlobalEgomotionResult * | globalEgoResult, | ||
const dwGlobalEgomotionUncertainty * | globalEgoUncertainty, | ||
const dwTransformation3f * | currToPrev, | ||
const dwEgomotionRelativeUncertainty * | currToPrevUncertainty, | ||
dwTime_t | timestamp, | ||
dwLocalizationHandle_t | localization | ||
) |
Localize the rig based on the latest measurements with radar.
[out] | localizationResult | Localization estimation including the absolute position in wgs84, orientation to ENU coordinate at the absolute position of the rig, id to the closest road segment, relative rotation and translation to the origin of the closest road segment, and a flag indicating validity of relative pose. |
[in] | radarPoints | Buffer of radar points with (x, y, z, rcs) each. |
[in] | numPoints | Number of radar points in buffer. |
[in] | globalEgoResult | Global rig position in LLA and orientation (x, y, z, w) mapping from the rig to ENU at global rig position the rig, both at the same timestamp as timestamp. Note that both globalEgoResult.validPosition and globalEgoResult.validOrientation have to be true for localization to run successfully for at least once. Otherwise this function will return DW_NOT_AVAILABLE. |
[in] | globalEgoUncertainty | Uncertainty of global position, represented by a 3x3 covariance in ENU in [m], and uncertainty of global orientation, represented by a 3x3 covariance of the equivalent euler angles (order: roll, pitch, yaw) in [rad]. |
[in] | currToPrev | The relative transformation mapping the current frame's pose to the previous frame's pose. Previous denotes the timestamp of the last time dwLocalization_radarLocalize was called. If this is the first time calling dwLocalization_radarLocalize, the identity transformation is expected. |
[in] | currToPrevUncertainty | The uncertainty of the relative transformation. If this is the first time calling dwLocalization_radarLocalize, any arbitrary uncertainty is accepted. |
[in] | timestamp | Timestamp of points in radarPoints buffer. |
[in] | localization | Handle to the localization module. |
DW_API_PUBLIC dwStatus dwLocalization_release | ( | dwLocalizationHandle_t | localization | ) |
Releases the localization module.
[in] | localization | Handle to the localization module being released. |
DW_API_PUBLIC dwStatus dwLocalization_reset | ( | dwLocalizationHandle_t | localization | ) |
Resets all internal state of the localization module; does not modify properties specified in each initialization function.
[in] | localization | Handle to the localization module being reset. |
DW_API_PUBLIC dwStatus dwLocalization_setCUDAStream | ( | cudaStream_t | stream, |
dwLocalizationHandle_t | localization | ||
) |
Sets the CUDA stream for CUDA related operations.
[in] | stream | The CUDA stream to be used. Default is the default CUDA stream 0. |
[in] | localization | A handle to the localization module for which to set CUDA stream. |
DW_API_PUBLIC dwStatus dwLocalization_setMap | ( | dwConstMapHandle_t | map, |
dwLocalizationHandle_t | localization | ||
) |
Sets a new HD Map to localize to.
The new map is assumed to have consistent road segment IDs with the old map.
[in] | map | Handle to the maps module used for map data. |
[in] | localization | Handle to the localization module. |