Compute Graph Framework SDK Reference  5.14
dwRelativeEgomotionIMUNode.hpp
Go to the documentation of this file.
1
2//
3// Notice
4// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
5// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
6// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
7// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8//
9// NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
10// information or for any infringement of patents or other rights of third parties that may
11// result from its use. No license is granted by implication or otherwise under any patent
12// or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
13// expressly authorized by NVIDIA. Details are subject to change without notice.
14// This code supersedes and replaces all information previously supplied.
15// NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
16// components in life support devices or systems without express written approval of
17// NVIDIA CORPORATION & AFFILIATES.
18//
19// SPDX-FileCopyrightText: Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
20// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
21//
22// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
23// property and proprietary rights in and to this material, related
24// documentation and any modifications thereto. Any use, reproduction,
25// disclosure or distribution of this material and related documentation
26// without an express license agreement from NVIDIA CORPORATION or
27// its affiliates is strictly prohibited.
28//
30
31#ifndef DWFRAMEWORK_DWNODES_EGOMOTION_DWRELATIVEEGOMOTIONIMUNODE_DWRELATIVEEGOMOTIONIMUNODE_HPP_
32#define DWFRAMEWORK_DWNODES_EGOMOTION_DWRELATIVEEGOMOTIONIMUNODE_DWRELATIVEEGOMOTIONIMUNODE_HPP_
33
34#include <dw/egomotion/base/Egomotion.h>
35#include <dw/roadcast/base_types/RoadCastPacketTypes.hpp>
37#include <dwcgf/node/Node.hpp>
40#include <dwcgf/pass/Pass.hpp>
42#include <dwcgf/port/Port.hpp>
44#include <dwframework/dwnodes/common/channelpackets/DwframeworkTypes.hpp>
45#include <dwframework/dwnodes/common/channelpackets/EgomotionState.hpp>
46#include <dwframework/dwnodes/common/channelpackets/IMU.hpp>
47#include <dwframework/dwnodes/common/channelpackets/SelfCalibrationTypes.hpp>
48#include <dwframework/dwnodes/common/channelpackets/SensorCommonTypes.hpp>
49#include <dwframework/dwnodes/common/channelpackets/VehicleIOValStructures.hpp>
50
51namespace dw
52{
53namespace framework
54{
55
57{
58 dwConstRigHandle_t rigHandle;
59 const char* imuSensorName;
60 const char* vehicleSensorName;
61
62 dwMotionModel motionModel;
66 uint32_t historySize;
67 dwEgomotionSpeedMeasurementType speedMeasurementType;
68 dwEgomotionLinearAccelerationFilterParams linearAccelerationFilterParameters;
69};
70
71template <>
72struct EnumDescription<dwMotionModel>
73{
74 static constexpr auto get()
75 {
76 return describeEnumeratorCollection<dwMotionModel>(
77 DW_DESCRIBE_C_ENUMERATOR(DW_EGOMOTION_ODOMETRY),
78 DW_DESCRIBE_C_ENUMERATOR(DW_EGOMOTION_IMU_ODOMETRY));
79 }
80};
81
82template <>
83struct EnumDescription<dwEgomotionSpeedMeasurementType>
84{
85 static constexpr auto get()
86 {
87 return describeEnumeratorCollection<dwEgomotionSpeedMeasurementType>(
88 DW_DESCRIBE_C_ENUMERATOR(DW_EGOMOTION_FRONT_SPEED),
89 DW_DESCRIBE_C_ENUMERATOR(DW_EGOMOTION_REAR_SPEED),
90 DW_DESCRIBE_C_ENUMERATOR(DW_EGOMOTION_REAR_WHEEL_SPEED));
91 }
92};
93
94template <>
95struct EnumDescription<dwEgomotionLinearAccelerationFilterMode>
96{
97 static constexpr auto get()
98 {
99 return describeEnumeratorCollection<dwEgomotionLinearAccelerationFilterMode>(
100 DW_DESCRIBE_C_ENUMERATOR(DW_EGOMOTION_ACC_FILTER_NO_FILTERING),
101 DW_DESCRIBE_C_ENUMERATOR(DW_EGOMOTION_ACC_FILTER_SIMPLE));
102 }
103};
104
121{
122public:
123 // coverity[autosar_cpp14_a7_1_5_violation] RFD Accepted: TID-1984
124 static constexpr auto describeInputPorts()
125 {
126 // TODO(csketch): RFD -- user defined literal being interpreted as c style cast.
127 // coverity[autosar_cpp14_a5_2_2_violation] RFD Pending: TID-1983
129 DW_DESCRIBE_PORT(dwIMUFrame, "IMU_FRAME"_sv),
130 DW_DESCRIBE_PORT(dwVehicleIOSafetyState, "VEHICLE_IO_SAFETY_STATE"_sv),
131 DW_DESCRIBE_PORT(dwVehicleIONonSafetyState, "VEHICLE_IO_NON_SAFETY_STATE"_sv),
132 DW_DESCRIBE_PORT(dwVehicleIOActuationFeedback, "VEHICLE_IO_ACTUATION_FEEDBACK"_sv),
133 DW_DESCRIBE_PORT(dwSensorNodeProperties, "IMU_EXTRINSICS"_sv),
134 DW_DESCRIBE_PORT(dwCalibratedWheelRadii, "WHEEL_RADII"_sv));
135 };
136 // coverity[autosar_cpp14_a7_1_5_violation] RFD Accepted: TID-1984
137 static constexpr auto describeOutputPorts()
138 {
139 // TODO(csketch): RFD -- user defined literal being interpreted as c style cast.
140 // coverity[autosar_cpp14_a5_2_2_violation] RFD Pending: TID-1983
142 DW_DESCRIBE_PORT(dwEgomotionStateHandle_t, "EGOMOTION_STATE"_sv),
143 DW_DESCRIBE_PORT(void*, "MODULE_HANDLE"_sv),
144 DW_DESCRIBE_PORT(dwEgomotionPosePayload, "EGOMOTION_POSE_PAYLOAD"_sv),
145 DW_DESCRIBE_PORT(dwCalibratedIMUIntrinsics, "IMU_INTRINSICS"_sv));
146 };
147 // coverity[autosar_cpp14_a7_1_5_violation] RFD Accepted: TID-1984
148 static constexpr auto describePasses()
149 {
151 describePass(StringView{"SETUP"}, DW_PROCESSOR_TYPE_CPU),
152 describePass(StringView{"ADD_IMU"}, DW_PROCESSOR_TYPE_CPU),
153 describePass(StringView{"ADD_VEHICLE_STATE"}, DW_PROCESSOR_TYPE_CPU),
154 describePass(StringView{"UPDATE_IMU_EXTRINSICS"}, DW_PROCESSOR_TYPE_CPU),
155 describePass(StringView{"UPDATE_WHEEL_RADII"}, DW_PROCESSOR_TYPE_CPU),
156 describePass(StringView{"SEND_STATE"}, DW_PROCESSOR_TYPE_CPU),
157 describePass(StringView{"TEARDOWN"}, DW_PROCESSOR_TYPE_CPU));
158 };
159
160 static std::unique_ptr<dwRelativeEgomotionIMUNode> create(ParameterProvider& provider);
161
162 dwStatus setAsyncReset() override
163 {
165 // coverity[autosar_cpp14_a8_5_2_violation] FP: nvbugs/3904083
166 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
167 if (asyncResetNode != nullptr)
168 {
169 return asyncResetNode->setAsyncReset();
170 }
171 return DW_FAILURE;
172 },
173 dw::core::Logger::Verbosity::DEBUG);
174 }
175
176 dwStatus executeAsyncReset() override
177 {
179 // coverity[autosar_cpp14_a8_5_2_violation] FP: nvbugs/3904083
180 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
181 if (asyncResetNode != nullptr)
182 {
183 return asyncResetNode->executeAsyncReset();
184 }
185 return DW_FAILURE;
186 },
187 dw::core::Logger::Verbosity::DEBUG);
188 }
189
190 dwStatus preShutdown() override
191 {
192 // coverity[autosar_cpp14_a8_5_2_violation] FP: nvbugs/3904083
193 auto* preShutdownNode = dynamic_cast<IContainsPreShutdownAction*>(m_impl.get());
194 if (preShutdownNode)
195 {
196 return preShutdownNode->preShutdown();
197 }
198 return DW_NOT_SUPPORTED;
199 }
200
201 // coverity[autosar_cpp14_a7_1_5_violation] RFD Accepted: TID-1984
202 static constexpr auto describeParameters()
203 {
204 // TODO(csketch): RFD -- user defined literal being interpreted as c style cast.
205 // coverity[autosar_cpp14_a5_2_2_violation] RFD Pending: TID-1983
206 return describeConstructorArguments<dwRelativeEgomotionIMUNodeInitParams, dwContextHandle_t>(
209 dwConstRigHandle_t,
212 const char*,
216 const char*,
220 dwMotionModel,
221 "motionModel"_sv,
224 bool,
225 "estimateInitialOrientation"_sv,
228 bool,
229 "automaticUpdate"_sv,
232 bool,
233 "enableSuspension"_sv,
236 uint32_t,
237 "historySize"_sv,
240 dwEgomotionSpeedMeasurementType,
241 "speedMeasurementType"_sv,
243 // when params.motionModel is DW_EGOMOTION_ODOMETRY following filter parameters take no effect.
245 dwEgomotionLinearAccelerationFilterMode,
246 "linearAccelerationFilterMode"_sv,
247 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::mode),
249 float32_t,
250 "linearAccelerationFilterTimeConst"_sv,
251 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::accelerationFilterTimeConst),
253 float32_t,
254 "linearAccelerationFilterProcessNoiseStdevSpeed"_sv,
255 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::processNoiseStdevSpeed),
257 float32_t,
258 "linearAccelerationFilterProcessNoiseStdevAcceleration"_sv,
259 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::processNoiseStdevAcceleration),
261 float32_t,
262 "linearAccelerationFilterMeasurementNoiseStdevSpeed"_sv,
263 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::measurementNoiseStdevSpeed),
265 float32_t,
266 "linearAccelerationFilterMeasurementNoiseStdevAcceleration"_sv,
267 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::measurementNoiseStdevAcceleration)),
270 dwContextHandle_t)));
271 }
272
275 const dwContextHandle_t ctx);
276};
277} // namespace framework
278} // namespace dw
279
280#endif // DWFRAMEWORK_DWNODES_EGOMOTION_DWRELATIVEEGOMOTIONIMUNODE_DWRELATIVEEGOMOTIONIMUNODE_HPP_
#define DW_DESCRIBE_C_ENUMERATOR(NAME)
Syntactic sugar calling describeEnumerator().
#define DW_DESCRIBE_UNNAMED_PARAMETER_WITH_SEMANTIC(TYPE_NAME, SEMANTIC_TYPE_NAME, args...)
#define DW_DESCRIBE_UNNAMED_PARAMETER(TYPE_NAME, args...)
#define DW_DESCRIBE_PARAMETER(TYPE_NAME, args...)
#define DW_DESCRIBE_PORT(TYPE_NAME, args...)
static dwStatus guardWithReturn(TryBlock const &tryBlock, ::dw::core::Logger::Verbosity verbosity=::dw::core::Logger::Verbosity::ERROR)
Definition: Exception.hpp:161
virtual dwStatus setAsyncReset()=0
Set the async reset flag.
virtual dwStatus executeAsyncReset()=0
Executes a reset if the async reset flag is set.
virtual dwStatus preShutdown()=0
actions to be taken before node shutdown
The interface to access parameter values identified by name and/or (semantic) type.
This node computes the vehicle state and relative motion over time using signals from IMU and wheelsp...
dwRelativeEgomotionIMUNode(const dwRelativeEgomotionIMUNodeInitParams &params, const dwContextHandle_t ctx)
static std::unique_ptr< dwRelativeEgomotionIMUNode > create(ParameterProvider &provider)
constexpr auto describeConstructorArgument(const Args &&... args) -> dw::core::Tuple< Args... >
dwEgomotionLinearAccelerationFilterParams linearAccelerationFilterParameters
constexpr auto describePassCollection(const Args &&... args) -> std::tuple< Args... >
constexpr auto describePortCollection(Args &&... args) -> dw::core::Tuple< Args... >
constexpr PassDescriptorT< 0 > describePass(dw::core::StringView const &&name, dwProcessorType processorType)
Definition: Buffer.hpp:40