Page 1 of 1

How to change the gravity during the simulation

Posted: 23 Oct 2019, 10:26
by narutom
hello,
I am using Matlab to control the robot in V-rep.
But setting the gravity to -9.8m/s^2 at the initial stage will cause the mechanical structure to collapse.
So, I want a gradual change in gravity during the simulation.
Is there any API that can read and change the gravity during the simulation. Or I just need to change the gravity by hand?

thanks

Re: How to change the gravity during the simulation

Posted: 23 Oct 2019, 13:48
by fferri
Hello,

you can change the gravity in the general dynamics properties.

You can also change gravity programmatically via sim.setArrayParameter(sim.arrayparam_gravity,{gx,gy,gz}).

Alternatively, you can apply forces/torques to objects via sim.addForce and sim.addForceAndTorque.