Results 1 to 2 of 2

Thread: Robot's Tracker Application

  1. #1
    Join Date
    Apr 2017
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Robot's Tracker Application

    Hey guys, I am currently studing for master in electronics and computer engineering, and I'm currently developing an application, for "software engineering" course.

    Application: The purposed application has an tcp server able to handle several connections with the robots.
    I choosed to work with database/ no files, so i'm using a sqlite db to save information about the robots and their full history, models of robots, tasks, etc...
    The robots send us several data like odometry, tasks information, and so on...

    I create a thread for every new robot's connection to handle the messages and update the informations of the robots on the database. Now lets start talk about my problems:

    The application got to show information about the robots in realtime, and I was thinking about using QSqlQueryModel, set the right query and the show it on a QTableView but then I got to some problems/ solutions to think about:


    Problem number 1: There are informations to show on the QTableView that are not on the database: I have the current consumption on the database and the actual charge on the database in capacity, but I want to show also on my table the remaining battery time, how can I add that column with the right behaviour (math implemented) in my TableView.


    Problem number 2: I will be receiving messages each second for each robot, so, updating the db and the the gui(loading the query) may not be the best solution when I have a big number of robots connected? Is it better to update the table, and only update the db each minute or something like this? If I use this method I cant work with the table with the QSqlQueryModel to update the tables, so what is the approach that you recommend me to use?

    Thanks
    SancheZ

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Robot's Tracker Application

    Problem number 1: There are informations to show on the QTableView that are not on the database: I have the current consumption on the database and the actual charge on the database in capacity, but I want to show also on my table the remaining battery time, how can I add that column with the right behaviour (math implemented) in my TableView.
    One solution is to derive a custom model from QSqlQueryModel and re-implement the columnCount() and data() methods. The first method should return the number of actual columns plus the number of computed columns. In the second method, if the column referenced in the QModelIndex parameter is less than the query column count, then you simply call QSqlQueryModel::data() with the same arguments as you were passed. If the column number refers to a computed column -and- the role is Qt::DisplayRole, then you compute your value, format it into a QString, and return that. For other roles, you return QVariant().

    Problem number 2: I will be receiving messages each second for each robot, so, updating the db and the the gui(loading the query) may not be the best solution when I have a big number of robots connected? Is it better to update the table, and only update the db each minute or something like this? If I use this method I cant work with the table with the QSqlQueryModel to update the tables, so what is the approach that you recommend me to use?
    No suggestion here. It depends on the size of the database, how much of it is displayed, and how frequently the database and screen are updated.

    You could consider a temporary database that accumulates the real-time data as it comes in, then periodically transfers that to the "real" database; this would make your UI a little jerky maybe, but then it wouldn't slow to a crawl with constant updates. Or you could derive a custom QTableView that has connections to the query model's modelReset() and other signals that denote a change in the data. The slots that handle these signals could start / restart a QTimer and/or keep count of the number of calls. When the timer times out or the maximum number of calls is reached, then the view is allowed to update. Reset the counter and wait again.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Is Qt suitable for controlling a UAV robot with a SBC?
    By alexpaul in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 25th October 2016, 04:36
  2. finding robot posture
    By sunitha7 in forum General Programming
    Replies: 1
    Last Post: 11th November 2015, 19:32
  3. XYZ tracker for QwtPlotSpectrogram
    By epsilon in forum Qwt
    Replies: 2
    Last Post: 5th September 2012, 04:53
  4. howto get value at Tracker Point
    By pospiech in forum Qwt
    Replies: 1
    Last Post: 9th February 2009, 10:53
  5. R6 Bill Tracker
    By croland in forum Qt-based Software
    Replies: 0
    Last Post: 16th October 2007, 20:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.