Hi,
Gazebo by default tries to run as fast as possible, this means when simulating a more complex world such as one containing a PR2, you will be using nearly 2 full cores consistently.  One way to limit cpu usage is by throttling the time step advancement rate, specifying an updateRate tag in the world file's physics  block, i.e.:

  <physics:ode>
    ...
    <updateRate>100</updateRate>
  </physics:ode>

In this example, if the stepTime is 1ms, then your simulation will run as fast as 0.1X real-time, alleviating machine load issues.

Alternatively, if you have an additional machine to run simulation on, you can treat it as a pr2 and talk to it through ros as you would an actual robot.

Lastly, we've realized that the time publisher might be taking up quite a bit of cpu time, so I opened a ticket here:

https://code.ros.org/trac/ros-pkg/ticket/4196

hope this helps,
John



On Mon, Jun 21, 2010 at 4:58 AM, hjieboy85 <hjieboy85@hotmail.com> wrote:

Dear all,

I have a question about CPU usage of Gazebo to ask, my problem is like this:

when I use this command:
 roslaunch gazebo empty_world.launch,
and then I use top command to see the usage of cpu. It gave the following
information. From that information, we can see the the usage of CPU is 74%.
It is so high!! Can you imagine that: if you just have a normal PC, when you
run Gazebo simulation, suddenly your PC will become so slow. I want to ask
how to make the Gazebo take less CPU usage in simulation?

Thank you very much in advance!

top - 13:40:55 up  1:32,  5 users,  load average: 0.26, 0.11, 0.04
Tasks: 183 total,   3 running, 180 sleeping,   0 stopped,   0 zombie
Cpu(s): 20.4%us, 13.4%sy,  0.0%ni, 64.7%id,  0.0%wa,  0.2%hi,  1.3%si,
0.0%st
Mem:   2061400k total,  1049648k used,  1011752k free,   124236k buffers
Swap:  6040400k total,        0k used,  6040400k free,   502760k cached

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3396 cob       20   0  208m  88m  63m S   74  4.4   1:02.76 gazebo
 3393 cob       20   0 35960 4652 4036 S   32  0.2   0:25.51 rosout
 1846 cob       20   0  403m 168m  31m S   14  8.4   9:41.72 firefox
 1242 root      20   0  558m  35m 9876 S   12  1.8   1:45.68 Xorg
 1772 cob       20   0 83676  42m  14m R   10  2.1   0:37.47 compiz.real
 1981 cob       20   0 38668  13m 9500 S    0  0.7   0:01.30 gnome-terminal
 3462 cob       20   0  2472 1200  880 R    0  0.1   0:00.10 top
   1 root      20   0  2532 1532 1140 S    0  0.1   0:00.98 init
   2 root      15  -5     0    0    0 S    0  0.0   0:00.00 kthreadd
   3 root      RT  -5     0    0    0 S    0  0.0   0:00.00 migration/0
   4 root      15  -5     0    0    0 S    0  0.0   0:00.00 ksoftirqd/0
   5 root      RT  -5     0    0    0 S    0  0.0   0:00.00 watchdog/0
   6 root      RT  -5     0    0    0 S    0  0.0   0:00.00 migration/1
   7 root      15  -5     0    0    0 S    0  0.0   0:00.05 ksoftirqd/1
   8 root      RT  -5     0    0    0 S    0  0.0   0:00.00 watchdog/1
   9 root      RT  -5     0    0    0 S    0  0.0   0:00.00 migration/2
  10 root      15  -5     0    0    0 S    0  0.0   0:00.02 ksoftirqd/2


--
View this message in context: http://ros-users.122217.n3.nabble.com/cpu-usage-of-Gazebo-tp911241p911241.html
Sent from the ROS-Users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
ros-users mailing list
ros-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ros-users
_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users