Simulating Drone Lift Off

Typically: "How do I... ", "How can I... " questions
Post Reply
Rezz11
Posts: 2
Joined: 02 Jan 2024, 06:12

Simulating Drone Lift Off

Post 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])

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

Re: Simulating Drone Lift Off

Post 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})

Post Reply