DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

SafetyForceField.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed
3 // under the Mutual Non-Disclosure Agreement.
4 //
5 // Notice
6 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
7 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
8 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
9 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10 //
11 // NVIDIA Corporation assumes no responsibility for the consequences of use of such
12 // information or for any infringement of patents or other rights of third parties that may
13 // result from its use. No license is granted by implication or otherwise under any patent
14 // or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
15 // expressly authorized by NVIDIA. Details are subject to change without notice.
16 // This code supersedes and replaces all information previously supplied.
17 // NVIDIA Corporation products are not authorized for use as critical
18 // components in life support devices or systems without express written approval of
19 // NVIDIA Corporation.
20 //
21 // Copyright (c) 2019-2020 NVIDIA Corporation. All rights reserved.
22 //
23 // NVIDIA Corporation and its licensors retain all intellectual property and proprietary
24 // rights in and to this software and related documentation and any modifications thereto.
25 // Any use, reproduction, disclosure or distribution of this software and related
26 // documentation without an express license agreement from NVIDIA Corporation is
27 // strictly prohibited.
28 //
30 
31 #ifndef DW_PLANNING_SAFETYFORCEFIELD_H_
32 #define DW_PLANNING_SAFETYFORCEFIELD_H_
33 
34 #include <dw/core/Types.h>
35 #include <dw/core/Status.h>
36 #include <dw/world/ObjectArray.h>
37 #include <dw/image/Image.h>
38 #include <dw/egomotion/Egomotion.h>
42 
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80 
81 #define DW_SAFETY_FORCE_FIELD_MAX_NUM_ACTORS_LIMIT 150
82 #define DW_SAFETY_FORCE_FIELD_NUM_SLICES 16
83 #define DW_SAFETY_FORCE_FIELD_METRICS_MAX_NUM_COLLIDING_OBJECTS 200
84 #define DW_SAFETY_FORCE_FIELD_NUM_VERTICES_EXPANDING_CLAIMED_SETS 6
85 #define DW_SAFETY_FORCE_FIELD_MAX_NUM_CLOSE_ACTORS 10
86 
87 //#######################################################################################
88 // Handles
89 //#######################################################################################
90 typedef struct dwSafetyForceFieldObject* dwSafetyForceFieldHandle_t;
91 typedef struct dwSafetyForceFieldObject const* dwConstSafetyForceFieldHandle_t;
92 
93 //#######################################################################################
94 // Structs
95 //#######################################################################################
96 
101 {
105 
107 {
108  uint32_t maxNumActors;
109  bool useGPU;
120 
122 {
123  uint32_t totalNumFrames;
130  // current frame information
134 
136  uint32_t collidingObjectSensorIds[DW_SAFETY_FORCE_FIELD_METRICS_MAX_NUM_COLLIDING_OBJECTS];
138 
140 {
141  uint64_t objectId;
142  uint32_t objectSensorId;
147 
151 
153 {
160 
161  uint32_t numActors;
163 
164  uint32_t numClaimedSets;
165  uint32_t claimedSetsActorIndices[DW_SAFETY_FORCE_FIELD_MAX_NUM_CLOSE_ACTORS];
170 
171 //#######################################################################################
172 // Functions
173 //#######################################################################################
174 
184 
195 DW_API_PUBLIC dwStatus dwSafetyForceField_initialize(dwSafetyForceFieldHandle_t* handle,
196  const dwSafetyForceFieldParams* params,
197  dwContextHandle_t context);
198 
206 DW_API_PUBLIC dwStatus dwSafetyForceField_release(dwSafetyForceFieldHandle_t handle);
207 
215 DW_API_PUBLIC dwStatus dwSafetyForceField_reset(dwSafetyForceFieldHandle_t handle);
216 
226 DW_API_PUBLIC dwStatus dwSafetyForceField_setCUDAStream(cudaStream_t stream, dwSafetyForceFieldHandle_t handle);
227 
237 DW_API_PUBLIC dwStatus dwSafetyForceField_getCUDAStream(cudaStream_t* stream, dwSafetyForceFieldHandle_t handle);
238 
249  dwSafetyForceFieldHandle_t handle);
250 
265  uint32_t numObjectArrays,
266  const dwVehicleIOState* vioState,
267  const dwLaneGraph* lg,
268  dwSafetyForceFieldHandle_t handle);
269 
289  const dwSafetyForceFieldControl* beforeActuation,
290  const dwSafetyForceFieldControl* afterActuation,
291  float32_t steeringLimit,
292  float32_t minAccel,
293  float32_t maxAccel,
294  float32_t steerRange,
295  float32_t accelRange,
296  dwSafetyForceFieldHandle_t handle);
297 
308  dwSafetyForceFieldHandle_t handle);
309 
337  uint32_t inCount,
339  uint32_t constraintBits);
340 
350 
360 
371  dwSafetyForceFieldHandle_t handle);
372 
387  const dwSafetyForceFieldControl* beforeActuation,
388  const dwSafetyForceFieldControl* afterActuation,
389  bool relative,
390  dwSafetyForceFieldHandle_t handle);
391 
392 #ifdef __cplusplus
393 }
394 #endif
395 
398 #endif // DW_PLANNING_SAFETYFORCEFIELD_H_
float32_t margin
distance margin in [m]
bool forceStraight
true to use straight claimed sets, i.e. the safety procedure has no lateral movement ...
float32_t collisionTime
time of collision of actor with ego, -1.0 if there is no collision
NVIDIA DriveWorks API: Core Types
dwSafetyForceFieldControl Control parameters used in Safety Force Field.
DW_API_PUBLIC dwStatus dwSafetyForceField_getCUDAStream(cudaStream_t *stream, dwSafetyForceFieldHandle_t handle)
Get the cuda stream to be used.
#define DW_SAFETY_FORCE_FIELD_NUM_VERTICES_EXPANDING_CLAIMED_SETS
float float32_t
Specifies POD types.
Definition: Types.h:70
struct dwImageObject * dwImageHandle_t
Definition: Image.h:99
NVIDIA DriveWorks API: Egomotion Methods
The state data.
Definition: VehicleIO.h:288
NVIDIA DriveWorks API: World Module
Request for safety force field auto engagement.
Defines a two-element single-precision floating-point vector.
Definition: Types.h:291
uint32_t objectSensorId
sensor IDs of the actor
DW_API_PUBLIC dwStatus dwSafetyForceField_setEgomotion(dwEgomotionConstHandle_t egomotion, dwSafetyForceFieldHandle_t handle)
Bind egomotion model handle.
NVIDIA DriveWorks API: VehicleIO car controller
bool activationRequest
Activation request.
dwSafetyForceFieldCombinationType
dwSafetyForceFieldCombinationType How control constraints are combined
DW_API_PUBLIC dwStatus dwSafetyForceField_initDefaultParams(dwSafetyForceFieldParams *params)
Initialize module parameters with default values.
uint32_t totalNumSequencesWithActuation
number of continuous sequences of frames with altered controls
float32_t collisionEMA
exponential moving average of collision number to visualize the average false positives and focus mor...
float32_t desiredLongitudinalAccel
SFF chosen acceleration minus vdc attempted acceleration.
uint32_t numClaimedSets
Number of claimed sets reported.
bool useRoadStructure
true if structured safety procedures should be used
DW_API_PUBLIC dwStatus dwSafetyForceField_initializeControlConstraints(dwSafetyForceFieldControlConstraints *c)
Helper function to initialize control constraints.
DW_API_PUBLIC dwStatus dwSafetyForceField_initializeMultiControlConstraints(dwSafetyForceFieldMultiControlConstraints *c)
Helper function to initialize multi control constraints.
NVIDIA DriveWorks API: Image Conversion and Streaming Functionality
bool useGPU
use true if cuda optimization should be used
dwSafetyForceFieldConeType
uint32_t totalNumFramesWithActuation
number of frames that altered the controls checked
float32_t minConfidence
object velocity confidence threshold.
dwSafetyForceFieldMultiControlConstraints An array of Safety Force Field control constraints.
uint32_t actuationSequenceLength
length of ongoing continuous sequence of frames with altered controls
float32_t maxStopTime
Time horizon of the SFF simulation.
dwVehicle vehicleProps
ego vehicle properties
dwStatus
Status definition.
Definition: Status.h:166
struct dwSafetyForceFieldObject const * dwConstSafetyForceFieldHandle_t
float32_t maxClearance
always filter objects with absolute clearance above this threshold [m]
uint64_t objectId
object IDs of the actor
NVIDIA DriveWorks API: LaneGraph
uint32_t numActors
Number of actors reported.
DW_API_PUBLIC dwStatus dwSafetyForceField_getMetrics(dwSafetyForceFieldMetrics *metrics, dwSafetyForceFieldHandle_t handle)
Getter of statistics of safety force field collisions.
DW_API_PUBLIC dwStatus dwSafetyForceField_process(dwObjectArray **objectsList, uint32_t numObjectArrays, const dwVehicleIOState *vioState, const dwLaneGraph *lg, dwSafetyForceFieldHandle_t handle)
Main process.
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
DW_API_PUBLIC dwStatus dwSafetyForceField_reset(dwSafetyForceFieldHandle_t handle)
Reset the safety force field module.
float32_t controlImageEnd
left boundary of the cone of safe controls in radians, depending on cone type
dwSafetyForceFieldConeType controlImageConeType
Shape of the cone of safe controls.
DW_API_PUBLIC dwStatus dwSafetyForceField_setCUDAStream(cudaStream_t stream, dwSafetyForceFieldHandle_t handle)
Set the cuda stream to be used.
DW_API_PUBLIC dwStatus dwSafetyForceField_release(dwSafetyForceFieldHandle_t handle)
Release the safety force field module.
dwVector2f collisionPoint
2D collision point in rig; only valid if collisionTime is positive
uint32_t totalNumFramesWithCollision
number of frames that had predicted collisions
struct dwEgomotionObject const * dwEgomotionConstHandle_t
Definition: Egomotion.h:80
DW_API_PUBLIC dwStatus dwSafetyForceField_getState(dwSafetyForceFieldState *state, const dwSafetyForceFieldControl *beforeActuation, const dwSafetyForceFieldControl *afterActuation, bool relative, dwSafetyForceFieldHandle_t handle)
Getter of SFF state for roadcast.
uint32_t totalNumFrames
number of frames processed
DW_API_PUBLIC dwStatus dwSafetyForceField_getControlImage(dwImageHandle_t *img, const dwSafetyForceFieldControl *beforeActuation, const dwSafetyForceFieldControl *afterActuation, float32_t steeringLimit, float32_t minAccel, float32_t maxAccel, float32_t steerRange, float32_t accelRange, dwSafetyForceFieldHandle_t handle)
Control image getter.
Lane graph defined by a container of dwLaneGraphLane objects and qualifier.
Definition: LaneGraph.h:184
float32_t actuationEMA
exponential moving average of actuation number to visualize the average false positives and focus mor...
Homogeneous array of structs.
Definition: ObjectArray.h:68
#define DW_SAFETY_FORCE_FIELD_METRICS_MAX_NUM_COLLIDING_OBJECTS
float32_t desiredLateralAccel
SFF chosen lateral acceleration minus vdc attempted lateral acceleration.
uint32_t numCollidingObjects
number of objects in current frame that ego has predicted collision with
bool filterActors
true to filter actors by keeping the ones that are close to ego-vehicle and have high velocity confid...
float32_t longitudinalSafetyForce
longitudinal force from this collision point; only valid if collisionTime is positive ...
dwTime_t timeStamp
Timestamp for request.
float32_t lateralSafetyForce
lateral force from this collision point; only valid if collisionTime is positive
uint32_t totalNumSequencesWithCollision
number of continuous sequences of frames with predicted collisions
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:80
#define DW_SAFETY_FORCE_FIELD_NUM_SLICES
struct dwSafetyForceFieldObject * dwSafetyForceFieldHandle_t
#define DW_SAFETY_FORCE_FIELD_MAX_NUM_ACTORS_LIMIT
DW_API_PUBLIC dwStatus dwSafetyForceField_combineControlConstraints(dwSafetyForceFieldMultiControlConstraints *out, const dwSafetyForceFieldControlConstraints *ins, uint32_t inCount, dwSafetyForceFieldCombinationType type, uint32_t constraintBits)
Helper function to combine control constraints.
uint32_t maxNumActors
max number of input objects
uint32_t collisionSequenceLength
length of ongoing continuous sequence of frames with predicted collisions
bool expandClaimedSets
true to inflate claimed sets that represent reaction time, uncertainties, etc.
bool restrictToMoving
true to ignore obstacles that are not moving (requires valid obstacleState)
float32_t controlImageStart
right boundary of the cone of safe controls in radians, depending on cone type
DW_API_PUBLIC dwStatus dwSafetyForceField_getControlConstraints(dwSafetyForceFieldControlConstraints *constraints, dwSafetyForceFieldHandle_t handle)
Getter of the SFF control constraints for actuation for safety.
DW_API_PUBLIC dwStatus dwSafetyForceField_initialize(dwSafetyForceFieldHandle_t *handle, const dwSafetyForceFieldParams *params, dwContextHandle_t context)
Initialize a safety force field module.
#define DW_API_PUBLIC
Definition: Exports.h:56
dwSafetyForceFieldControlConstraints A collection of constraints, which is derived from Safety Force ...
#define DW_SAFETY_FORCE_FIELD_MAX_NUM_CLOSE_ACTORS
for roadcast
NVIDIA DriveWorks API: Core Status Methods
Properties of the vehicle.
Definition: Rig.h:348