Compute Graph Framework SDK Reference  5.8
dwGlobalEgomotionNode.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_GLOBAL_EGOMOTION_NODE_HPP_
32#define DW_FRAMEWORK_GLOBAL_EGOMOTION_NODE_HPP_
33
34#include <dwcgf/node/Node.hpp>
35#include <dwcgf/port/Port.hpp>
36#include <dwcgf/pass/Pass.hpp>
38
43/* Need to include the appropriate ChannelPacketTypes.hpp since port initialization requires
44 the parameter_trait overrides. Otherwise, it will be considered as a packet of generic type. */
46
47#include <dw/egomotion/Egomotion.h>
48#include <dw/egomotion/global/GlobalEgomotion.h>
49#include <dw/egomotion/global/GlobalEgomotionSerialization.h>
51#include <dw/roadcast/base_types/RoadCastPacketTypes.hpp>
52
53namespace dw
54{
55namespace framework
56{
57
59{
60 dwConstRigHandle_t rigHandle;
61 const char* gpsSensorName;
62 uint32_t historySize;
63};
64
78{
79public:
80 static constexpr auto describeInputPorts()
81 {
83 DW_DESCRIBE_PORT(dwGPSFrame, "GPS_FRAME"_sv),
84 DW_DESCRIBE_PORT(dwEgomotionStateHandle_t, "EGOMOTION_STATE"_sv));
85 };
86 static constexpr auto describeOutputPorts()
87 {
89 DW_DESCRIBE_PORT(dwGlobalEgomotionState, "GLOBAL_EGOMOTION"_sv),
90 DW_DESCRIBE_PORT(dwGlobalEgomotionResultPayload, "GLOBAL_EGOMOTION_RESULT_PAYLOAD"_sv));
91 };
92 static constexpr auto describePasses()
93 {
95 describePass("SETUP"_sv, DW_PROCESSOR_TYPE_CPU),
96 describePass("ADD_GPS"_sv, DW_PROCESSOR_TYPE_CPU),
97 describePass("ADD_RELATIVE_EGOMOTION"_sv, DW_PROCESSOR_TYPE_CPU),
98 describePass("SEND_STATE"_sv, DW_PROCESSOR_TYPE_CPU),
99 describePass("TEARDOWN"_sv, DW_PROCESSOR_TYPE_CPU));
100 };
101
102 static std::unique_ptr<dwGlobalEgomotionNode> create(ParameterProvider& provider);
103
106 const dwContextHandle_t ctx);
107
108 dwStatus setAsyncReset() override
109 {
110 return Exception::guardWithReturn([&]() {
111 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
112 if (asyncResetNode != nullptr)
113 {
114 return asyncResetNode->setAsyncReset();
115 }
116 return DW_FAILURE;
117 });
118 }
119
120 dwStatus executeAsyncReset() override
121 {
122 return Exception::guardWithReturn([&]() {
123 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
124 if (asyncResetNode != nullptr)
125 {
126 return asyncResetNode->executeAsyncReset();
127 }
128 return DW_FAILURE;
129 });
130 }
131
132 static constexpr auto describeParameters()
133 {
134 return describeConstructorArguments<dwGlobalEgomotionNodeInitParams, dwContextHandle_t>(
137 dwConstRigHandle_t,
140 const char*,
144 uint32_t,
145 "historySize"_sv,
149 dwContextHandle_t)));
150 }
151
152 dwStatus preShutdown() override
153 {
154 auto* preShutdownNode = dynamic_cast<IContainsPreShutdownAction*>(m_impl.get());
155 if (preShutdownNode)
156 {
157 return preShutdownNode->preShutdown();
158 }
159 return DW_NOT_SUPPORTED;
160 }
161};
162}
163}
164
165#endif //DW_FRAMEWORK_EGOMOTION_NODE_HPP_
#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 global vehicle state and motion over time using signals from GPS and relative ...
dwGlobalEgomotionNode(const dwGlobalEgomotionNodeInitParams &params, const dwContextHandle_t ctx)
static std::unique_ptr< dwGlobalEgomotionNode > create(ParameterProvider &provider)
constexpr auto describePortCollection(Args &&... args)
constexpr std::tuple< dw::core::StringView, dwProcessorType > describePass(dw::core::StringView const &&name, dwProcessorType processorType)
constexpr auto describeConstructorArgument(const Args &&... args)
constexpr auto describePassCollection(const Args &&... args)
Definition: Exception.hpp:47