Home | Tutorials | Wiki | Issues
Ask Your Question
0

Simulation running slow, quarter real time

asked 2012-10-31 21:06:45 -0500

nkoenig gravatar image

Gazebo with an empty world runs at 0.25x real time.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2012-10-31 21:14:12 -0500

nkoenig gravatar image

Other symptoms include:

  • Not all the cores on the computer are working. Testable with: cat/proc/cpuinfo
  • The following code has 4 ms intervals

    #include <sys/time.h>
    #include <time.h>
    #include <stdio.h>
    
    main()
    {
      struct timeval tv;
      struct timeval tv_old;
      gettimeofday(&tv, NULL);
      tv_old = tv;
      while(1)
      {
        gettimeofday(&tv, NULL);
        if (tv_old.tv_usec != tv.tv_usec)
        {
          printf("%ld %ld\n", tv.tv_sec, tv.tv_usec);
          tv_old = tv;
    
          // sleep 1 nano second
          struct timespec nsleep;
          nsleep.tv_sec = 0;
          nsleep.tv_nsec = 1;
          nanosleep(&nsleep, NULL);
        }
      }
    }
    

##Solution - Edit /etc/default/grub and remove acpi=off - sudo update-grub - restart

edit flag offensive delete link more
0

answered 2012-10-31 21:38:32 -0500

hsu gravatar image

also documented in issue #178, and patch to bypass clock when kernel resolution is too large is implemented in pull request #72.

edit flag offensive delete link more

Comments

Could this issue (or something closely related) cause the time that gazebo sees move faster than timeit.default_timer (or gettimeofday)?

SL Remy gravatar imageSL Remy ( 2012-11-04 20:29:31 -0500 )edit

Not sure, can you provide some more context on the time inconsistency you're seeing? Thanks.

hsu gravatar imagehsu ( 2012-11-05 01:41:04 -0500 )edit

Will post a new question once I can document it properly.

SL Remy gravatar imageSL Remy ( 2012-11-12 08:58:58 -0500 )edit
0

answered 2012-11-06 03:46:02 -0500

Neostek gravatar image

I have the same problem too. The real problem is that it is not constant, i.e. it varies over time (the real time factor). Is there a way to set it as 1.0?

edit flag offensive delete link more

Comments

Just for clarification, this thread is just about a linux system configuration problem that causes the linux kernel to behave improperly when nanosleeping. The default behavior of Gazebo > 1.2 is to throttle to 1.0 realtime. Gazebo may still run slower than real time.

nkoenig gravatar imagenkoenig ( 2012-11-06 12:46:20 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2012-10-31 21:06:45 -0500

Seen: 489 times

Last updated: Nov 06 '12