• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • Compute Graph Framework SDK Reference  5.10
    All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
    dwRelativeEgomotionIMUNodeImpl.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 DWFRAMEWORK_DWNODES_EGOMOTION_DWRELATIVEEGOMOTIONIMUNODE_IMPL_DWRELATIVEEGOMOTIONIMUNODEIMPL_HPP_
    32#define DWFRAMEWORK_DWNODES_EGOMOTION_DWRELATIVEEGOMOTIONIMUNODE_IMPL_DWRELATIVEEGOMOTIONIMUNODEIMPL_HPP_
    33
    38#include <dw/sensors/imu/IMU.h>
    39#include <dw/sensors/canbus/CAN.h>
    40#include <dw/egomotion/EgomotionState.h>
    41#include <dw/rig/Rig.hpp>
    42
    43namespace dw
    44{
    45namespace framework
    46{
    47
    48class dwRelativeEgomotionIMUNodeImpl : public SimpleProcessNodeT<dwRelativeEgomotionIMUNode>, public IAsyncResetable, public IContainsPreShutdownAction
    49{
    50public:
    51 static constexpr char LOG_TAG[] = "dwRelativeEgomotionIMUNode";
    52
    54 const dwContextHandle_t ctx);
    55 dwRelativeEgomotionIMUNodeImpl(const dwContextHandle_t ctx)
    56 : m_ctx(ctx){};
    57
    59
    60 dwStatus reset() override;
    61
    62 dwStatus setAsyncReset() override;
    63 dwStatus executeAsyncReset() override;
    64 dwStatus preShutdown() override;
    65
    66 dwStatus setupImpl() override;
    67 dwStatus validate() override;
    68
    69 dwStatus addIMU(ManagedPortInput<dwIMUFrame>& imuFramePort);
    71 ManagedPortInput<dwVehicleIONonSafetyState>& vehicleNonSafetyStatePort,
    72 ManagedPortInput<dwVehicleIOActuationFeedback>& vehicleActuationFeedbackPort);
    75
    81
    86
    87 inline const dwEgomotionParameters& getEgomotionParameters() { return m_egomotionParams; };
    88 inline dwEgomotionHandle_t& getEgomotionHandle() { return m_egomotion; };
    90
    92
    93protected:
    96
    97 void monitorSignals(dwTime_t const currentHostTime, dwTime_t const latestEgomotionTimestamp) const;
    98
    99 // Vehicle copy
    100 dwVehicle m_vehicle{};
    101
    102 // Time bookkeeping
    103 dwTime_t m_lastUpdate{};
    104
    105 dwEgomotionHandle_t m_egomotion = DW_NULL_HANDLE;
    106 const dwContextHandle_t m_ctx = DW_NULL_HANDLE;
    107
    108 dwEgomotionParameters m_egomotionParams{};
    109 void** m_outputHandle{nullptr};
    110
    111 uint32_t m_imuSensorID = 0U;
    112
    113 static const dwTime_t INITIALIZATION_TIMEOUT = 5'000'000; // [us]
    114 static const dwTime_t MISSING_SIGNAL_TIMEOUT = 50'000; // [us]
    115 static const uint64_t MINIMUM_INPUT_COUNT = 100; // [-]
    116
    117 dwTime_t m_latestVioTimestamp = DW_TIME_INVALID;
    118 dwTime_t m_latestIMUTimestamp = DW_TIME_INVALID;
    119 dwTime_t m_initTimestamp = DW_TIME_INVALID;
    120 mutable bool m_isDrained = false; // marked mutable for usage in logging functions otherwise const
    121
    122 uint64_t m_vioInputCounter = 0U;
    123 uint64_t m_imuInputCounter = 0U;
    124
    125private:
    126 void initializePorts(const dwRelativeEgomotionIMUNodeInitParams& params);
    127
    128 void monitorVIOTimeOffset(const dwTime_t& currentHostTime) const;
    129 void monitorIMUTimeOffset(const dwTime_t& currentHostTime) const;
    130 void monitorEgomotionTimeOffset(const dwTime_t& currentHostTime, const dwTime_t& latestEgomotionTimestamp) const;
    131
    132 dwStatus processAddIMU();
    133 dwStatus processAddVehicleState();
    134 dwStatus processUpdateIMUExtrinsics();
    135 dwStatus processUpdateWheelRadii();
    136 dwStatus processSendState();
    137
    138 bool m_shutdown = false;
    139};
    140
    141} // namespace framework
    142} // namespace dw
    143
    144#endif // DWFRAMEWORK_DWNODES_EGOMOTION_DWRELATIVEEGOMOTIONIMUNODE_IMPL_DWRELATIVEEGOMOTIONIMUNODEIMPL_HPP_
    dwRelativeEgomotionIMUNodeImpl(const dwRelativeEgomotionIMUNodeInitParams &params, const dwContextHandle_t ctx)
    void sendRoadCast(ManagedPortOutput< dwEgomotionResultPayload > &resultPayloadPort, ManagedPortOutput< dwTransformation3fPayload > &transPayloadPort, ManagedPortOutput< dwEgomotionPosePayload > &posePayloadPort)
    void monitorSignals(dwTime_t const currentHostTime, dwTime_t const latestEgomotionTimestamp) const
    dwStatus sendState(ManagedPortOutput< dwEgomotionStateHandle_t > &egomotionStatePort, ManagedPortOutput< dwEgomotionResultPayload > &resultPayloadPort, ManagedPortOutput< dwTransformation3fPayload > &transPayloadPort, ManagedPortOutput< dwEgomotionPosePayload > &posePayloadPort)
    dwStatus updateIMUExtrinsics(ManagedPortInput< dwSensorNodeProperties > &imuExtrinsicPort)
    dwStatus updateWheelRadii(ManagedPortInput< dwCalibratedWheelRadii > &wheelRadiiPort)
    dwStatus addIMU(ManagedPortInput< dwIMUFrame > &imuFramePort)
    void initializeParams(const dwRelativeEgomotionIMUNodeInitParams &params)
    dwStatus sendState(ManagedPortOutput< dwEgomotionStateHandle_t > &egomotionStatePort, ManagedPortOutput< dwEgomotionResultPayload > &resultPayloadPort, ManagedPortOutput< dwTransformation3fPayload > &transPayloadPort, ManagedPortOutput< dwEgomotionPosePayload > &posePayloadPort, ManagedPortOutput< dwCalibratedIMUIntrinsics > &IMUIntrinsicsPort)
    dwStatus addVehicleState(ManagedPortInput< dwVehicleIOSafetyState > &vehicleSafetyStatePort, ManagedPortInput< dwVehicleIONonSafetyState > &vehicleNonSafetyStatePort, ManagedPortInput< dwVehicleIOActuationFeedback > &vehicleActuationFeedbackPort)
    dwStatus sendGyroBias(ManagedPortOutput< dwCalibratedIMUIntrinsics > &IMUIntrinsicsPort)
    Definition: Buffer.hpp:40
    人人超碰97caoporen国产