108 if (j.contains(
"ip"))
110 j.at(
"ip").get_to(
_ip);
112 if (j.contains(
"port"))
114 j.at(
"port").get_to(
_port);
122 std::string ipString{};
123 for (
size_t i = 0; i < 4; i++)
125 ipString.append(std::to_string(
_ip.at(i)));
126 i < 3 ? ipString.append(
".") : ipString.append(
"");
145 std::vector<char> data2send{};
174 auto pos = std::static_pointer_cast<const Pos>(data);
179 auto posVel = std::static_pointer_cast<const PosVel>(data);
185 auto posVelAtt = std::static_pointer_cast<const PosVelAtt>(data);
195 auto gnssObs = std::static_pointer_cast<const GnssObs>(data);
201 LOG_ERROR(
"{}: gnssObs msg is bigger than the maximum size of a single UDP package: {} bytes.",
nameId(), sizeTotal);
204 data2send.resize(sizeTotal);
218 auto gpsTow =
static_cast<double>(insTime.
toGPSweekTow().tow);
nlohmann::json json
json namespace
GNSS Observation messages.
Utility class for logging to console and file.
#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 std::string type()
Returns the type of the data class.
The class is responsible for all time-related tasks.
constexpr InsTime_GPSweekTow toGPSweekTow(TimeSystem timesys=GPST) const
Converts this time object into a different format.
ImVec2 _guiConfigDefaultWindowSize
Node(std::string name)
Constructor.
std::string nameId() const
Node name and id.
std::string name
Name of the Node.
bool _hasConfig
Flag if the config window should be shown.
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.
auto extract_front()
Returns a copy of the first element in the container and removes it from the container.
boost::asio::ip::udp::resolver::results_type _endpoints
Boost udp endpoint.
UdpUtil::MessageType _msgType
Message Type: 0 = posVelAtt, 1 = gnssObs.
bool initialize() override
Initialize the node.
UdpSend()
Default constructor.
static constexpr std::array< int, 2 > IP_LIMITS
Range an IPv4 address can be in [0, 2^8-1].
boost::asio::ip::udp::resolver _resolver
Boost udp resolver.
bool resetNode() override
Resets the node. Moves the read cursor to the start.
void deinitialize() override
Deinitialize the node.
static std::string category()
String representation of the Class Category.
std::string type() const override
String representation of the Class Type.
boost::asio::io_context _io_context
Asynchronous receive fct.
void receiveData(InputPin::NodeDataQueue &queue, size_t pinIdx)
Callback when receiving data on a port.
void restore(const json &j) override
Restores the node from a json object.
void guiConfig() override
ImGui config window which is shown on double click.
void setMsgTypeAndTime(std::vector< char > &data2send, const InsTime &insTime)
Set the Msg Type And Time object.
static std::string typeStatic()
String representation of the Class Type.
int _port
UDP port number.
boost::asio::ip::udp::socket _socket
Boost udp socket.
std::array< int, 4 > _ip
IPv4 address.
json save() const override
Saves the node into a json object.
~UdpSend() override
Destructor.
static float windowFontRatio()
Ratio to multiply for GUI window elements.
bool InputIntL(const char *label, int *v, int v_min, int v_max, int step, int step_fast, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for 'int'.
bool InputInt4L(const char *label, int v[4], int v_min, int v_max, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for an array of 'int[4]'.
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.
static constexpr size_t POS
Offset of the position.
static constexpr size_t GPSCYCLE
Offset of the GPS cycle.
static constexpr size_t GPSTOW
Offset of the GPS tow.
static constexpr size_t SIZE
Offset of the GNSS data size.
static constexpr size_t QUAT
Offset of the quaternion.
static constexpr size_t GNSSDATA
Offset of the GNSS data.
static constexpr size_t VEL
Offset of the velocity.
static constexpr size_t GPSWEEK
Offset of the GPS week.
static constexpr size_t TOTAL_POSVELATT
Size of a total 'PosVelAtt' message.
static constexpr size_t GPSCYCLE
Size of a GPS cycle.
static constexpr size_t SIZE
Size of the size of a GNSS observation.
static constexpr size_t QUAT
Size of a Quaternion element.
static constexpr size_t SINGLE_OBSERVATION_DATA
Size of a single GNSS observation.
static constexpr size_t MSGTYPE
Size of the message type.
static constexpr size_t POS
Size of a Pos (LLA)
static constexpr size_t GPSTOW
Size of a GPS TOW.
static constexpr size_t GPSWEEK
Size of a GPS week.
static constexpr size_t TOTAL_POSVEL
Size of a total 'PosVel' message.
static constexpr size_t VEL
Size of a Vel (NED)
static constexpr size_t TOTAL_POS
Size of a total 'Pos' message.
static constexpr unsigned int MAXIMUM_BYTES
Network data stream maximum buffer size in [bytes] (Maximum payload size of a UDP package)
static constexpr std::array< int, 2 > PORT_LIMITS
Range a port can be in [0, 2^16-1].
@ PosVel
Extract PosVel data.
@ GnssObs
Extract GnssObs data.
@ PosVelAtt
Extract PosVelAtt data.
void ApplyChanges()
Signals that there have been changes to the flow.
const std::vector< std::string > supportedDataIdentifier
List of supported data identifiers.
int32_t gpsCycle
Contains GPS cycle in GPS standard time [GPST].
int32_t gpsWeek
Contains GPS week in GPS standard time [GPST].
Asynchronous data link - sender node.