How to change the gravity during the simulation

Typically: "How do I... ", "How can I... " questions
Post Reply
narutom
Posts: 5
Joined: 07 Jan 2019, 04:24

How to change the gravity during the simulation

Post 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

fferri
Posts: 1217
Joined: 09 Sep 2013, 19:28

Re: How to change the gravity during the simulation

Post 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.

Post Reply