1

I am writing a new ros node in webots-ros and sometimes I get this warning: QObject::startTimer: Timers cannot have negative intervals. And the webots simulation freezes.

Any ideas on what can be the problem?

hkhodr
  • 23
  • 3
  • 1
    This is probably comming from within the Webots simulator itself. There are only a few uses of QTimer in Webots, the most probable problematic one is this one: https://github.com/cyberbotics/webots/blob/c778cab3fe186a44aa64b9281851764af6f10b80/src/webots/engine/WbSimulationWorld.cpp#L183 In which mode are you running Webots (real-time, fast, spte-by-step)? Make also sure that you are never calling the step function/service with a negative argument. Would it be possible for you to share the code of your node? – David Mansolino Feb 06 '20 at 07:12

1 Answers1

1

From the description you gave it sounds like you are passing the QT QTimer object a negative value for the interval.

Can you log the interval value before you start the timer and/or provide us with a code sample to help you further debug this issue?

Edit: It looks like webots-ros is a framework that uses QT QTimer internally. Try looking at this thread to see if it solves your issue: https://www.qtcentre.org/threads/61601-QObject-startTimer-QTimer-cannot-have-a-negative-interval

Mike Mulhearn
  • 166
  • 1
  • 8
  • I am not using QTimer to be able to debug. I am just using the standard ROS controller in webots (https://www.cyberbotics.com/doc/guide/using-ros). – hkhodr Feb 05 '20 at 18:51
  • @hkhodr I saw that and made an edit earlier. webots must be passing a negative value to the QTimer. Can you give us a code sample that will show us context around the issue you are having? What data are you passing to webots? – Mike Mulhearn Feb 05 '20 at 19:58
  • 3
    I just fixed the potentially negative value passed to `QTimer::start` [here](https://github.com/cyberbotics/webots/pull/1333). This patch now guarantees that the value passed to QTimer is always positive. The patch should be available in the next nightly build of Webots, so that you can test tomorrow. Let us know if that fixes the problem. – Olivier Michel Feb 06 '20 at 08:11