DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

planning/safetyforcefield/docs/usecase1.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2 
3 @page safetyforcefield_usecase1 Safety Force Field Workflow
4 @tableofcontents
5 
6 @note SW Release Applicability: This tutorial is applicable to modules in **NVIDIA DRIVE Software** releases.
7 
8 @section safetyforcefield_initialization Initialization
9 
10 #### To initialize the Safety Force Field default parameters
11 
12 ```{.cpp}
13 dwStatus dwSafetyForceField_initDefaultParams(dwSafetyForceFieldParams* params);
14 ```
15 
16 An actor's claimed set is the likely trajectory in space-time of the actor executing its safety procedure.
17 For example, the green set in the following figure is a claimed set if the safety procedure is driving straight and braking:
18 
19 ![](safetyforcefield/claimedSet.png)
20 
21 
22 The underlying space of the green claimed set is space-time where the space is the xy-plane. Its projection on xy-plane is a long rectangle, showing the obstacle is moving along a fixed direction. Its projection on the plane spanned by the obstacle direction and time axis is a parabola opening downwards. This indicates the obstacle is slowing down over time.
23 
24 The following attributes for the `dwSafetyForceFieldParams` struct configure the shape for each actor's claimed set:
25 - `forceStraight`.
26 - `useRoadStructure`.
27 - `expandClaimedSets`.
28 
29 The default value for these attributes is `false`, so the default claimed set comes from holding the steering wheel and braking.
30 
31 The following figures are examples of claimed sets when each of these attributes are enabled:
32 - `forceStraight = true`, and other attributes are default.
33 The claimed set is continued straight in the actor's current heading throughout the safety procedure.
34 
35 ![](safetyforcefield/forceStraight.png)
36 
37 
38 - `useRoadStructure = true`, and other attributes are default. The claimed sets align with the ego-vehicle's current path.
39 
40 ![](safetyforcefield/useRoad.png)
41 
42 
43 - `expandClaimedSets = true`, and other attributes are default.
44 The claimed sets expand laterally and longitudinally to take account of control uncertainties and reaction time. In the following figure, the quadrilateral time slices of the green claimed set grow over time.
45 
46 ![](safetyforcefield/expandClaimedSets.png)
47 
48 
49 About combining the attributes, you can set `useRoadStructure = true` and `expandClaimedSets = true` together.
50 However, the setting `forceStraight = true` ignores what `useRoadStructure` and `expandClaimedSets` are set, so that road structure is not used and claimed sets are not expanded.
51 
52 #### To initialize a pointer to a Safety Force Field handle
53 
54 ```{.cpp}
55 dwStatus dwSafetyForceField_initialize(dwSafetyForceFieldHandle_t* handle,
56  const dwSafetyForceFieldParams* params,
57  dwContextHandle_t context);
58 ```
59 
60 @section safetyforcefield_binding_inputs Binding Inputs
61 
62 The inputs for a Safety Force Field module must be bound before you run the process function.
63 These include obstacles, egomotion, the vehicleIO state, and a lane graph.
64 
65 #### To bind an objects pointer
66 
67 ```{.cpp}
68 dwStatus dwSafetyForceField_bindInputObjects(const uint32_t* slotId,
69  dwObjectArray* objects,
70  dwSafetyForceFieldHandle_t handle);
71 
72 ```
73 The Safety Force Field module consumes obstacles on the ground within 120 meters of the ego-vehicle.
74 The `maxNumActors` attribute for the `dwSafetyForceFieldParams` struct determines the upper bound of the number of these obstacles to be processed.
75 
76 The egomotion and vehicleIO state decide the ego-vehicle's state (including speed and front wheel steering angle).
77 This is used as input to generate the ego-vehicle's claimed set.
78 
79 #### To bind an egomotion handle
80 
81 ```{.cpp}
82 dwStatus dwSafetyForceField_setEgomotion(dwEgomotionConstHandle_t egomotion,
83  dwSafetyForceFieldHandle_t handle);
84 ```
85 
86 #### To bind the vehicleIO state
87 
88 ```{.cpp}
89 dwStatus dwSafetyForceField_bindInputVehicleIOState(const dwVehicleIOState* vioState,
90  dwSafetyForceFieldHandle_t handle);
91 ```
92 
93 
94 #### To bind a lane graph pointer
95 
96 ```{.cpp}
97 dwStatus dwSafetyForceField_bindInputLaneGraph(const dwLaneGraph* lg,
98  dwSafetyForceFieldHandle_t handle);
99 ```
100 
101 @section safetyforcefield_process_function Process Function
102 
103 The process function computes the claimed set for each actor, checks for collisions between the ego-vehicle and an actor, and computes
104 a Safety Force Field for each collision point.
105 
106 ```{.cpp}
107 dwStatus dwSafetyForceField_process(dwSafetyForceFieldHandle_t handle);
108 ```
109 
110 Each Safety Force Field generates one control constraint.
111 
112 #### To obtain the control constraints from a Safety Force Field module for actuation
113 
114 ```{.cpp}
115 dwStatus dwSafetyForceField_getControlConstraints(dwSafetyForceFieldControlConstraints* constraints,
116  dwSafetyForceFieldHandle_t handle);
117 ```
118 
119 @section safetyforcefield_release Release
120 
121 #### To release a Safety Force Field module
122 
123 ```{.cpp}
124 dwStatus dwSafetyForceField_release(dwSafetyForceFieldHandle_t handle);
125 ```
126 
127 For a more detailed workflow, please refer to the @ref dwx_safetyforcefield_sample.