Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Dealing with UDP streamed data - saving
QtWS25 Last Chance

Dealing with UDP streamed data - saving

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 2 Posters 749 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RobbieP
    wrote on last edited by
    #1

    I'm receiving data streamed in over UDP and I'd like to collate it, display it, and most importantly, save it. I was looking at the localstorage example, but it uses QML...is there a way to do a sqlite localstorage type data recording using regular QMainWindow style QT Apps? I'm still learning QT and there's so many options...I'm trying to decide the quickest turnaround option. I'd even be happy with buffering it to memory and periodically writing to a csv or json file...Any thoughts?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Qt's SQL module supports SQLite out of the box so you can use for your widget application (QtQuick as well but you have to create some interface in C++).

      What kind of data are you receiving ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        RobbieP
        wrote on last edited by
        #3

        Thanks! It's very simple really...multiple (up to 200) records in a single packet that contain a name and a value...the value is always a double. Think flight simulator position data streamed at about 30-60hz. Can you recommend a good example for something like that?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          I don't really have any reference application at hand. How are you going to save the data ? One row per record or one row per block of received data ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • R Offline
            R Offline
            RobbieP
            wrote on last edited by
            #5

            one row per block of data probably...so if it were csv an example would be:
            timestamp,elapsed,airspeed,120.345,altitude,6700.304,pitch,15.13,roll,1.223,yaw,0.121

            the data comes in like this:

            #define SP_PACKET_SIZE 200
            #define NAME_SIZE 64
                struct SP_PacketStruct
                {
                    int Size;                               ///< Number of items in the data packet
                    char Name[SP_PACKET_SIZE][NAME_SIZE];   ///< Data labels
                    double Value[SP_PACKET_SIZE];           ///< Data packet values
                };
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Then I would benchmark the insertion speed and maybe offload the storage to a secondary thread.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              R 1 Reply Last reply
              0
              • SGaistS SGaist

                Then I would benchmark the insertion speed and maybe offload the storage to a secondary thread.

                R Offline
                R Offline
                RobbieP
                wrote on last edited by
                #7

                @SGaist That makes sense. What I'm curious about is the storage method though...I've been looking for the best option...is SqlIte what you would recommend? When you say benchmark, are you referring to buffering? I'll be in control of the send rate...it varies for each project. The highest rate we've ever dealt with is 125hz.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  No, to benchmark is to measure performance.

                  Depending on the volume of data you expect to get a full database system like PostgreSQL might be better.

                  Note that a NoSQL database might also be of interest.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    RobbieP
                    wrote on last edited by
                    #9

                    I have experience with mysql...do you think sqlite would be a bad choice?

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      RobbieP
                      wrote on last edited by
                      #10

                      I ask because I'm not really sure I even need a database...most of our previous data has all been just dumped to csv files that our statisticians can then import into matlab for analysis.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Hence the benchmarking :-)

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • R Offline
                          R Offline
                          RobbieP
                          wrote on last edited by
                          #12

                          Gotcha...I'm honestly leaning more towards just buffering to memory with periodic text file writing...

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            If the amount of data is reasonable and the file writing speed is as well, that is a valid option. Don't forget the final dump when you close the application otherwise you might lose data.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • R Offline
                              R Offline
                              RobbieP
                              wrote on last edited by
                              #14

                              yup. Before I start diving into this then, do you know of any good examples of buffered text file writing? Thanks for the discussion!

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                Using QTextStream with QFile would be a good start.
                                Start simple, check speed and if not enough, rework that part.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved