How do I stop my agent moving really fast during inference?

My agent seems to move extremely fast during inference. I think may have something to do with the frames per second during inference - 60-90fps. I train at around 7-11fps and the movement seems slower than it should be. Am I making a generic Unity scripting error or is this tied to the ML agent toolkit?

The code that moves my agent is:

AgentRigidbody.MovePosition(transform.position + movementDirection * Time.fixedDeltaTime * Speed);

The simulation runs x20 during training. You can change it from Player Settings> Time > TimeScale Maybe this is the case

1 Like

This is occurring during inference, which is why Iā€™m confused. I thought inference was supposed to run at normal time. Where do I find Player Settings?

Edit > Project Settings. If its the case maybe you should decrease the ā€œSpeedā€ constant coeff in your MovePosition() function

Are you using the same control code during both training and inference? Any changes after training will give strange results.

Also you may be experiencing a ā€˜studder-stepā€™ problem where your training fps is so low it makes the agent look slower than it really is in the physics step. Try running your training at normal speed using either the project settings as @Hsgngr advised or using the --time-scale=1 if you do training from a standalone (the default timescale for training is 20)

1 Like

Iā€™m using the same control code for training and inference. I imagine I am experience studder-step, but I didnā€™t anticipate such a large variation. Iā€™ll try running the project in normal speed next time Iā€™m running inference

1 Like

This worked. Thanks! Timescale was set at 20 during inference for some reason

1 Like