50 return "UartPacketConverter";
65 if (
auto outputType =
static_cast<int>(
_outputType);
66 ImGui::Combo(fmt::format(
"Output Type##{}",
size_t(
id)).c_str(), &outputType,
"UbloxObs\0EmlidObs\0WiFiObs\0\0"))
69 std::string outputTypeString;
73 outputTypeString =
"UbloxObs";
76 outputTypeString =
"EmlidObs";
79 outputTypeString =
"WiFiObs";
102 if (
auto* connectedPin = link.getConnectedPin())
104 outputPins.front().recreateLink(*connectedPin);
112 if (ImGui::Checkbox(fmt::format(
"Show SyncIn Pin##{}",
size_t(
id)).c_str(), &
_syncInPin))
149 if (j.contains(
"outputType"))
196 auto uartPacket = std::static_pointer_cast<const UartPacket>(queue.
extract_front());
198 std::shared_ptr<NodeData> convertedData =
nullptr;
201 auto obs = std::make_shared<UbloxObs>();
202 auto packet = uartPacket->raw;
208 auto obs = std::make_shared<WiFiObs>();
209 auto packet = uartPacket->raw;
219 timeSyncMaster && !timeSyncMaster->v->ppsTime.empty())
246 obs->insTime = timeSyncMaster->v->ppsTime + std::chrono::microseconds(obs->timeOutputs.timeSyncIn)
247 + std::chrono::seconds(syncCntDiff);
261 auto obs = std::make_shared<EmlidObs>();
262 auto packet = uartPacket->raw;
267 if (
auto currentTime = util::time::GetCurrentInsTime();
268 !currentTime.empty())
270 convertedData->insTime = currentTime;
Helper Functions to work with Emlid Sensors.
Helper Functions to work with Espressif Sensors.
nlohmann::json json
json namespace
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_WARN
Error occurred, but a fallback option exists and program continues to work normally.
#define LOG_TRACE
Detailled info to trace the execution of the program. Should not be called on functions which receive...
Keeps track of the current real/simulation time.
UART Packet storage class.
Helper Functions to work with Ublox Sensors.
Espressif Observation Class.
static std::string type()
Returns the type of the data class.
ImVec2 _guiConfigDefaultWindowSize
std::vector< OutputPin > outputPins
List of output pins.
Node(std::string name)
Constructor.
std::optional< InputPin::IncomingLink::ValueWrapper< T > > getInputValue(size_t portIndex) const
Get Input Value connected on the pin. Only const data types.
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.
auto extract_front()
Returns a copy of the first element in the container and removes it from the container.
static std::string category()
String representation of the Class Category.
json save() const override
Saves the node into a json object.
bool _syncInPin
Show the SyncIn Pin.
void restore(const json &j) override
Restores the node from a json object.
UartPacketConverter()
Default constructor.
OutputType _outputType
The selected output type in the GUI.
int64_t _syncOutCntCorr
Corrected SyncOut counter in case of a reset (initiator)
bool initialize() override
Initialize the node.
static constexpr size_t OUTPUT_PORT_INDEX_CONVERTED
Flow.
int64_t _lastSyncOutCnt
Last received syncOutCnt.
void guiConfig() override
ImGui config window which is shown on double click.
static std::string typeStatic()
String representation of the Class Type.
~UartPacketConverter() override
Destructor.
@ OutputType_UbloxObs
Extract UbloxObs data.
@ OutputType_EmlidObs
Extract EmlidObs data.
@ OutputType_WiFiObs
Extract WiFiObs data.
static constexpr size_t INPUT_PORT_INDEX_SYNC_IN
Flow (SyncIn)
std::string type() const override
String representation of the Class Type.
void receiveObs(InputPin::NodeDataQueue &queue, size_t pinIdx)
Converts the UartPacket to the selected message type.
int64_t _lastSyncInCnt
Last received syncInCnt.
int64_t _syncInCntCorr
Corrected SyncIn counter in case of a reset (target)
static std::string type()
Returns the type of the data class.
static std::string type()
Returns the type of the data class.
static std::string type()
Returns the type of the data class.
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.
bool DeleteInputPin(InputPin &pin)
Deletes the input pin. Invalidates the pin reference given.
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.
void ApplyChanges()
Signals that there have been changes to the flow.
void decryptEmlidObs(const std::shared_ptr< NAV::EmlidObs > &obs, uart::protocol::Packet &packet)
Decrypts the provided Emlid observation.
bool decryptWiFiObs(const std::shared_ptr< NAV::WiFiObs > &obs, uart::protocol::Packet &packet, const std::string &nameId)
Decrypts the provided Espressif observation.
bool decryptUbloxObs(const std::shared_ptr< NAV::UbloxObs > &obs, uart::protocol::Packet &packet, const std::string &nameId)
Decrypts the provided Ublox observation.