Page 1 of 1

Simulating Drone Lift Off

Posted: 21 Feb 2024, 03:19
by Rezz11
Hello,

I'm trying to make a drone that I have modelled lift off the ground to a certain altitude. I understand that it can be done by using sim.addForceandTorque. However, it either is stuck to the ground or it is flying off to the sky very fast while flipping off and going all over the place. Can someone explain how simulating lift off works and maybe give a python example if possible? This is my code:

sim.addForceAndTorque(self.drone, [0,0,1], [0,0,0])

Re: Simulating Drone Lift Off

Posted: 21 Feb 2024, 11:28
by fferri
That approach works fine for me.

Once the gravity force has been balanced, it is sufficient a very tiny force to have an object lift off, considering you are applying that force constantly (i.e. on every step, in e.g. sysCall_actuation)

Code: Select all

local self = sim.getObject '.'
local m = sim.getShapeMass(self)
local g = sim.getArrayParam(sim.arrayparam_gravity)
sim.addForceAndTorque(self, {m * -g[1], m * -g[2], m * -g[3] + 0.000001}, {0, 0, 0})