Compute Graph Framework SDK Reference  5.8
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-2022 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 DW_FRAMEWORK_RELATIVE_EGOMOTION_IMU_NODE_HPP_
32#define DW_FRAMEWORK_RELATIVE_EGOMOTION_IMU_NODE_HPP_
33
34#include <dwcgf/node/Node.hpp>
38#include <dwcgf/port/Port.hpp>
40#include <dwcgf/pass/Pass.hpp>
44/* Need to include the appropriate ChannelPacketTypes.hpp since port initialization requires
45 the parameter_trait overrides. Otherwise, it will be considered as a packet of generic type. */
47
48#include <dw/egomotion/Egomotion.h>
49#include <dw/roadcast/base_types/RoadCastPacketTypes.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 static constexpr auto describeInputPorts()
124 {
126 DW_DESCRIBE_PORT(dwIMUFrame, "IMU_FRAME"_sv),
127 DW_DESCRIBE_PORT(dwVehicleIOState, "VEHICLE_STATE"_sv),
128 DW_DESCRIBE_PORT(dwVehicleIOSafetyState, "VEHICLE_SAFETY_STATE"_sv),
129 DW_DESCRIBE_PORT(dwVehicleIONonSafetyState, "VEHICLE_NON_SAFETY_STATE"_sv),
130 DW_DESCRIBE_PORT(dwVehicleIOActuationFeedback, "VEHICLE_ACTUATION_FEEDBACK"_sv),
131 DW_DESCRIBE_PORT(dwSensorNodeProperties, "IMU_EXTRINSICS"_sv),
132 DW_DESCRIBE_PORT(dwCalibratedWheelRadii, "WHEEL_RADII"_sv));
133 };
134 static constexpr auto describeOutputPorts()
135 {
137 DW_DESCRIBE_PORT(dwEgomotionStateHandle_t, "EGOMOTION_STATE"_sv),
138 DW_DESCRIBE_PORT(void*, "MODULE_HANDLE"_sv),
139 DW_DESCRIBE_PORT(dwTransformation3fPayload, "TRANSFORMATION_PAYLOAD"_sv),
140 DW_DESCRIBE_PORT(dwEgomotionResultPayload, "EGOMOTION_RESULT_PAYLOAD"_sv),
141 DW_DESCRIBE_PORT(dwCalibratedIMUIntrinsics, "IMU_INTRINSICS"_sv));
142 };
143 static constexpr auto describePasses()
144 {
146 describePass("SETUP"_sv, DW_PROCESSOR_TYPE_CPU),
147 describePass("ADD_IMU"_sv, DW_PROCESSOR_TYPE_CPU),
148 describePass("ADD_ODOMETRY"_sv, DW_PROCESSOR_TYPE_CPU),
149 // TODO(abuehler): AVT-1162
150 // describePass("ADD_VEHICLE_STATE"_sv, DW_PROCESSOR_TYPE_CPU),
151 describePass("UPDATE_IMU_EXTRINSICS"_sv, DW_PROCESSOR_TYPE_CPU),
152 describePass("UPDATE_WHEEL_RADII"_sv, DW_PROCESSOR_TYPE_CPU),
153 describePass("SEND_STATE"_sv, DW_PROCESSOR_TYPE_CPU),
154 describePass("TEARDOWN"_sv, DW_PROCESSOR_TYPE_CPU));
155 };
156
157 static std::unique_ptr<dwRelativeEgomotionIMUNode> create(ParameterProvider& provider);
158
159 dwStatus setAsyncReset() override
160 {
161 return Exception::guardWithReturn([&]() {
162 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
163 if (asyncResetNode != nullptr)
164 {
165 return asyncResetNode->setAsyncReset();
166 }
167 return DW_FAILURE;
168 });
169 }
170
171 dwStatus executeAsyncReset() override
172 {
173 return Exception::guardWithReturn([&]() {
174 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
175 if (asyncResetNode != nullptr)
176 {
177 return asyncResetNode->executeAsyncReset();
178 }
179 return DW_FAILURE;
180 });
181 }
182
183 dwStatus preShutdown() override
184 {
185 auto* preShutdownNode = dynamic_cast<IContainsPreShutdownAction*>(m_impl.get());
186 if (preShutdownNode)
187 {
188 return preShutdownNode->preShutdown();
189 }
190 return DW_NOT_SUPPORTED;
191 }
192
193 static constexpr auto describeParameters()
194 {
195 return describeConstructorArguments<dwRelativeEgomotionIMUNodeInitParams, dwContextHandle_t>(
198 dwConstRigHandle_t,
201 const char*,
205 const char*,
209 dwMotionModel,
210 "motionModel"_sv,
213 bool,
214 "estimateInitialOrientation"_sv,
217 bool,
218 "automaticUpdate"_sv,
221 bool,
222 "enableSuspension"_sv,
225 uint32_t,
226 "historySize"_sv,
229 dwEgomotionSpeedMeasurementType,
230 "speedMeasurementType"_sv,
232 // when params.motionModel is DW_EGOMOTION_ODOMETRY following filter parameters take no effect.
234 dwEgomotionLinearAccelerationFilterMode,
235 "linearAccelerationFilterMode"_sv,
236 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::mode),
238 float32_t,
239 "linearAccelerationFilterTimeConst"_sv,
240 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::accelerationFilterTimeConst),
242 float32_t,
243 "linearAccelerationFilterProcessNoiseStdevSpeed"_sv,
244 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::processNoiseStdevSpeed),
246 float32_t,
247 "linearAccelerationFilterProcessNoiseStdevAcceleration"_sv,
248 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::processNoiseStdevAcceleration),
250 float32_t,
251 "linearAccelerationFilterMeasurementNoiseStdevSpeed"_sv,
252 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::measurementNoiseStdevSpeed),
254 float32_t,
255 "linearAccelerationFilterMeasurementNoiseStdevAcceleration"_sv,
256 &dwRelativeEgomotionIMUNodeInitParams::linearAccelerationFilterParameters, &dwEgomotionLinearAccelerationFilterParams::measurementNoiseStdevAcceleration)),
259 dwContextHandle_t)));
260 }
261
264 const dwContextHandle_t ctx);
265};
266} // namespace framework
267} // namespace dw
268
269#endif //DW_FRAMEWORK_RELATIVE_EGOMOTION_IMU_NODE_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 tryBlock, dw::core::Logger::Verbosity verbosity=dw::core::Logger::Verbosity::DEBUG)
Definition: Exception.hpp:122
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 describePortCollection(Args &&... args)
constexpr std::tuple< dw::core::StringView, dwProcessorType > describePass(dw::core::StringView const &&name, dwProcessorType processorType)
dwSensorNodeProperties { uint64_t sensorId dwSensorNodeProperties
CalibratedIMUIntrinsics { dwVector3f gyroscopeBias dwCalibratedIMUIntrinsics
dwEgomotionLinearAccelerationFilterParams linearAccelerationFilterParameters
constexpr auto describeConstructorArgument(const Args &&... args)
constexpr auto describePassCollection(const Args &&... args)
CalibratedWheelRadii { float32_t currentWheelRadius[DW_VEHICLE_NUM_WHEELS] dwCalibratedWheelRadii
Definition: Exception.hpp:47