How to set the simulation time dt through script of client?

Typically: "How do I... ", "How can I... " questions
Post Reply
Hacher
Posts: 40
Joined: 28 Nov 2024, 02:00

How to set the simulation time dt through script of client?

Post by Hacher »

The simulation velocity of dt can be changed in the 'simulation setup' dialog box, it's there any function like 'sim.startsimulation' that allow me to change the simulation velocity through script in the python client
coppelia
Site Admin
Posts: 10802
Joined: 14 Dec 2012, 00:25

Re: How to set the simulation time dt through script of client?

Post by coppelia »

Hello,

try with sim.setFloatProperty(sim.handle_scene, "timeStep", 0.01)
Just make sure simulation is not yet running.

Cheers
Hacher
Posts: 40
Joined: 28 Nov 2024, 02:00

Re: How to set the simulation time dt through script of client?

Post by Hacher »

Encounter an error when I try to use

Code: Select all

sim.setFloatProperty(sim.handle_scene, "timeStep", 0.01)
:
Exception: 347: in sim.setFloatProperty: unknown property.
coppelia
Site Admin
Posts: 10802
Joined: 14 Dec 2012, 00:25

Re: How to set the simulation time dt through script of client?

Post by coppelia »

What CoppeliaSim version are you running? What does it print when you type:

Code: Select all

sim.getProperties(sim.handle_scene)
Cheers
Hacher
Posts: 40
Joined: 28 Nov 2024, 02:00

Re: How to set the simulation time dt through script of client?

Post by Hacher »

The version I am using is 4.7.0, I encounter error:
AttributeError: type object 'sim' has no attribute 'getProperties'
coppelia
Site Admin
Posts: 10802
Joined: 14 Dec 2012, 00:25

Re: How to set the simulation time dt through script of client?

Post by coppelia »

If you want to change the timestep with versions prior to V4.9, use:

Code: Select all

sim.setFloatParam(sim.floatparam_simulation_time_step, 0.01)
Cheers
Post Reply