Inconsisten movement speed of the viewport
Hello all,
we are designing experiments in Vizard that include both automated movement as well as manual movement (joystick, keyboard) of the viewport through an environment. Here, we have come across an interesting problem: Whenever we have manual movement, the movement speed is inconsistent. This means it is a) dependent on the loaded environment and b) dependent on the desired speed that is set. a) More complex scenarios produce higher deviations in movement speed (but only for manual movement! The automated movement works flawlessly) b) Higher speeds produce higher deviations (at 10m/s it is about 0.5m/s slower, at 30m/s about 1.5m/s slower) We are realising the joystick and/or keyboard movement with the following code: Code:
if math.fabs(jy) > joyDeadzone and -zoneX < jx < zoneX: # translation All the best and thank you! |
Does the framerate vary in your different applications?
|
Hello Jeff,
thanks for your reply! No, the framerate is fixed at 60fps, and it stays there at all times (already checked it with the gpu info box overlay). |
Can you post a complete example with navigation and how you calculate the error?
|
I did some more research today and I found out the cause, which is quite interesting:
When I use one of the envorinments provided by Vizard (i.e. ground_grass.osgb), everyworks fine and the movement speed is correct, both automatically and manual. Also, the viz.collision setting has no impact on the speed. Whe I use one of our own environment (also just a simple ground plane with a tube around it to create an arena) and I have viz.collision turned OFF, everything is working fine. However, if I turn viz.collision ON in our environment, the movement speed while moving with the keyboard or the joystick if off by about 0.5m/s for a speed of 10m/s. When I move automatically in this setting, everything works fine. Jeff, I have send you a private message with a minimum example. In the first phase, the viewport will move automatically for 100m. Then, the viewport is reset and you can move forward for 100m with the key '3'. The position and time is logged in a separate .txt file. In the first lines, you can switch the collsion on and off as well as change the environment from a standard one to the one that is provided with the .rar file. Thanks for your help! |
Are there any framerate drops when collision is enabled? Even an occasional drop may affect your calculations. I took a look at your example. I would suggest that you simplify that to the minimum code possible, perhaps just have forward movement in manual mode. I'm not immediately able to see from the log file what the speed or error is. Unless you don't want to publicly post your model, it's best to post everything here so other users can help as well.
|
Hello Jeff,
thanks for your reply and the time you invest in helping me. As far as I can tell, there are no framerate drops during the scene. I am using the info-panel to assess framerate and it looks constant. Also, the problem is persistent in every run and only if I am moving via keyboard or joystick. If there is a problem with dropping framerates, shouldn't it be also while moving automatically? Also, we tested it on 3 quite capable machines - all showed the error. I have stripped down the code a little and uploaded it here: https://www.dropbox.com/s/d3b4rpfw9u...minExample.rar Also, I will post my code here. But without the example scene, it won't reproduce the error. Please enable the collision, run the trial with my arena supplied in the .rar. Afterwards, you should see that it takes exactly 10 seconds to move 100m automatically. If I do it manually with the keyboard, it takes me 10.453 seconds. Here are the relevant lines from my log-file: Automatic movement: 13:57:31:410,0:00:10.015,[0.000,1.800,99.913],[-0.000] 13:57:31:425,0:00:10.030,[0.000,1.800,100.000],[-0.000] ---> 10.015 seconds for 100m Keyboard movement: 13:57:43:890,0:00:10.468,[0.000,1.820,99.997],[-0.000] 13:57:43:905,0:00:10.483,[0.000,1.820,100.156],[-0.000] ---> 10.47 seconds for 100m If I disable collision OR run the program with a standard scene (e.g. ground_grass.osgb), the time need will both times be 10seconds. Finally the code: Code:
# ---------------------------------------------------------- |
I am still trying to figure out what the cause of the reduced movement speed in our experiments is.
Jeff, what exactly is the 'Update' time of the renderer? This is the only value that varies during the test runs and also seems to be dependent on the collision: In the test model of the minimum example I provided, I get update times up to 2 when I enable collision and the movement is slower than it is supposed to be. It stays at 0.1 if I disable collision and the movement speed is correct. In a standard vizard model (like the one in the minimum example), it is well below 0.3, regardless of collision on or off and the movement speed is correct. |
If you're updating the viewpoint every frame, try:
Code:
viz.getFrameElapsed() * SPEED Code:
viz.elapsed() * SPEED |
Hello Jeff,
thank you very much! That solved the problem. The movement speed of the viewport is now consistent throughout all of our environments. What do you think was the problem? Is there a variation in frame draw times that depends on the current environment? If I am using viz.elapsed(), than I would not take this deviation into account, right? |
All times are GMT -7. The time now is 06:01 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC