Ask Your Question
0

gazebo and timer.py(rate.sleep)

asked 2018-03-11 20:20:17 -0500

CodingPeon gravatar image

updated 2018-03-11 20:53:56 -0500

Hi

I'm running yappi to profile the performance of my node written in python.

The node has:

  • 3 timers for controller loops. (2 at 500Hz and 1 at 100Hz)
  • 2 publisher (60Hz for /gazebo/set_model_state and 100Hz)
  • 2 subscriber

When Gazebo is not running, the profiler shows 35.15% time is spent on Rate.sleep()

When Gazebo is running, the profiler shows 46.92% time is spent on Rate.sleep(). In particular, 16.06% is spent on _Condition.wait from threading.py, which doesn't not show up in previous scenario. Nothing change even when I comment out any code related to publishing /gazebo/set_model_state.

I also notice when Gazebo is running, my node that usually takes up ~50% CPU now runs at ~100%. Also the controller loops don't seem to be running on time.

Question is why my node impacted by Gazebo? I should also mention that because I want to run yappi, I'm not using rosrun to launch the node.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-03-12 03:13:21 -0500

gvdhoorn gravatar image

updated 2018-03-12 03:13:38 -0500

A word of warning (so not an answer): using Python here on a general purpose OS with no deterministic scheduling is never going to have all of your loops run correctly (ie: on schedule). Python could have the least influence on that, but it's not going to help.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-03-11 20:20:17 -0500

Seen: 100 times

Last updated: Mar 11 '18