21#include <imgui_internal.h>
42 const auto* imuIntegrator =
static_cast<const ImuIntegrator*
>(node);
43 return !inputPin.queue.empty() && imuIntegrator->_inertialIntegrator.hasInitialPosition();
57 return "ImuIntegrator";
67 return "Data Processor";
94 if (j.contains(
"inertialIntegrator"))
98 if (j.contains(
"preferAccelerationOverDeltaMeasurements"))
123 if (nodeData->insTime.empty())
125 LOG_ERROR(
"{}: Can't set new imuObs__t0 because the observation has no time tag (insTime)",
nameId());
129 std::shared_ptr<NAV::PosVelAtt> integratedPosVelAtt =
nullptr;
134 auto obs = std::static_pointer_cast<const ImuObsWDelta>(nodeData);
135 LOG_DATA(
"{}: recvImuObsWDelta at time [{}]",
nameId(), obs->insTime.toYMDHMS());
137 integratedPosVelAtt =
_inertialIntegrator.calcInertialSolutionDelta(obs->insTime, obs->dtime, obs->dvel, obs->dtheta, obs->imuPos,
nameId().c_str());
141 auto obs = std::static_pointer_cast<const ImuObs>(nodeData);
142 LOG_DATA(
"{}: recvImuObs at time [{}]",
nameId(), obs->insTime.toYMDHMS());
144 integratedPosVelAtt =
_inertialIntegrator.calcInertialSolution(obs->insTime, obs->p_acceleration, obs->p_angularRate, obs->imuPos,
nameId().c_str());
147 if (integratedPosVelAtt)
149 LOG_DATA(
"{}: e_position = {}",
nameId(), integratedPosVelAtt->e_position().transpose());
150 LOG_DATA(
"{}: e_velocity = {}",
nameId(), integratedPosVelAtt->e_velocity().transpose());
151 LOG_DATA(
"{}: rollPitchYaw = {}",
nameId(),
rad2deg(integratedPosVelAtt->rollPitchYaw()).transpose());
158 auto posVelAtt = std::static_pointer_cast<const PosVelAtt>(queue.
extract_front());
162 LOG_DATA(
"{}: recvPosVelAttInit at time [{}]",
nameId(), posVelAtt->insTime.toYMDHMS());
167 LOG_DATA(
"{}: e_position = {}",
nameId(), posVelAtt->e_position().transpose());
168 LOG_DATA(
"{}: e_velocity = {}",
nameId(), posVelAtt->e_velocity().transpose());
nlohmann::json json
json namespace
Text Help Marker (?) with Tooltip.
Data storage class for one VectorNavImu observation.
Parent Class for all IMU Observations.
Utility class for logging to console and file.
#define LOG_DEBUG
Debug information. Should not be called on functions which receive observations (spamming)
#define LOG_DATA
All output which occurs repeatedly every time observations are received.
#define LOG_ERROR
Error occurred, which stops part of the program to work, but not everything.
#define LOG_TRACE
Detailled info to trace the execution of the program. Should not be called on functions which receive...
Utility class which specifies available nodes.
Position, Velocity and Attitude Storage Class.
static constexpr size_t INPUT_PORT_INDEX_POS_VEL_ATT_INIT
Flow (PosVelAtt)
void deinitialize() override
Deinitialize the node.
void recvObservation(InputPin::NodeDataQueue &queue, size_t pinIdx)
Receive Function.
bool _preferAccelerationOverDeltaMeasurements
Prefer the raw acceleration measurements over the deltaVel & deltaTheta values.
static std::string category()
String representation of the Class Category.
static std::string typeStatic()
String representation of the Class Type.
void restore(const json &j) override
Restores the node from a json object.
std::string type() const override
String representation of the Class Type.
ImuIntegrator()
Default constructor.
void guiConfig() override
ImGui config window which is shown on double click.
bool initialize() override
Initialize the node.
~ImuIntegrator() override
Destructor.
static constexpr size_t OUTPUT_PORT_INDEX_INERTIAL_NAV_SOL
Flow (InertialNavSol)
void recvPosVelAttInit(InputPin::NodeDataQueue &queue, size_t pinIdx)
Receive Function for the PosVelAtt initial values.
json save() const override
Saves the node into a json object.
InertialIntegrator _inertialIntegrator
Inertial Integrator.
static constexpr size_t INPUT_PORT_INDEX_IMU_OBS
Flow (ImuObs)
static std::string type()
Returns the type of the data class.
static std::string type()
Returns the type of the data class.
ImVec2 _guiConfigDefaultWindowSize
Node(std::string name)
Constructor.
std::vector< InputPin > inputPins
List of input pins.
std::string nameId() const
Node name and id.
std::string name
Name of the Node.
void invokeCallbacks(size_t portIndex, const std::shared_ptr< const NodeData > &data)
Calls all registered callbacks on the specified output port.
bool _hasConfig
Flag if the config window should be shown.
static std::string type()
Returns the type of the data class.
auto extract_front()
Returns a copy of the first element in the container and removes it from the container.
OutputPin * CreateOutputPin(Node *node, const char *name, Pin::Type pinType, const std::vector< std::string > &dataIdentifier, OutputPin::PinData data=static_cast< void * >(nullptr), int idx=-1)
Create an Output Pin object.
InputPin * CreateInputPin(Node *node, const char *name, Pin::Type pinType, const std::vector< std::string > &dataIdentifier={}, InputPin::Callback callback=static_cast< InputPin::FlowFirableCallbackFunc >(nullptr), InputPin::FlowFirableCheckFunc firable=nullptr, int priority=0, int idx=-1)
Create an Input Pin object.
bool NodeDataTypeAnyIsChildOf(const std::vector< std::string > &childTypes, const std::vector< std::string > &parentTypes)
Checks if any of the provided child types is a child of any of the provided parent types.
void ApplyChanges()
Signals that there have been changes to the flow.
bool InertialIntegratorGui(const char *label, InertialIntegrator &integrator, bool &preferAccelerationOverDeltaMeasurements, float width)
Shows a GUI for advanced configuration of the InertialIntegrator.
constexpr auto rad2deg(const T &rad)
Convert Radians to Degree.