ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

fabha's profile - activity

2018-11-18 14:41:40 -0500 received badge  Famous Question (source)
2017-02-23 15:08:41 -0500 received badge  Notable Question (source)
2016-06-17 05:34:21 -0500 received badge  Popular Question (source)
2016-04-26 11:23:35 -0500 received badge  Supporter (source)
2016-04-26 11:23:23 -0500 commented answer rqt not updating text

thank you very much! I'm using a LineEdit element with a signal slot mechanism to update and it works fine. However I guess the problem was that I only tested the foldersize with recording rosout. This was super dumb. Shame on me.

2016-04-26 11:22:16 -0500 received badge  Scholar (source)
2016-04-13 12:02:42 -0500 asked a question rqt not updating text

Hello, we wrote our own rqt plugin which extends the rosbag functionality to our needs. We are using an *.ui design in rqt to give the user the ability to easily interact with the rosbag functionality. One of the elements in the design is a (title) text showing the current folder size, giving the user the visual feedback how big the recording is and that it is still ongoing (size is growing over time).

For that we want to regularly check the size of the folder in a separate thread and update the text in rqt (GUI) accordingly. Our approach works very well, but only if we are calling the ROS_INFO, ROS_ERROR, ... functionality in every cycle of the thread worker. However we would like to get rid of the console output of course.

What we tried already, instead of the ROS outputs:

  • using std:: outputs (printf, cout, ...) -> no updating size in rqt
  • calling parent_->update() after setTitle() -> no updating size in rqt
  • calling parent_->repaint() after setTitle() -> rqt crashes
  • adding ros::Duration() or usleep() in each cycle -> no updating size in rqt

We are really unsure how to debug this problem, since its working fine only if we are calling the ROS output functions in each cycle of the thread worker.

Our implementation is like this:

Starting the thread:

title_update_thread_ = std::thread(&RosbagDirectory::updateTitleWorker, this);

Thread worker:

 void RosbagDirectory::updateTitleWorker(void)
{
  ros::Rate r(10);
  while(state_==RecordingState::RECORDING)
  {
    if (status_display_ != nullptr)
    {
        status_display_->updateTitle();
        ROS_INFO("title updated");        // <<<<< IF REMOVED, SIZE IN RQT DESIGN IS NOT UPDATING   
    }
    r.sleep();
  }
}

Updating the title:

void PluginStatusDisplay::updateTitle(void)
{
  // get file size
  size_t size=0;
  for(boost::filesystem::recursive_directory_iterator it(path_); it!=boost::filesystem::recursive_directory_iterator(); ++it)
  {
      if(!is_directory(*it))
          size+=boost::filesystem::file_size(*it);
  }

   std::string foldersize = " Folder Size: " + std::to_string((int)size);

  // update title
  const std::string title = foldersize;
  parent_->setTitle(QString::fromStdString(title));
}

It would be awesome if you could give us a hint where to search for the problem and how we could debug this bug.

Kindest Regards

Fabian Hanke