Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

[Bug]: Inconsistent drone behavior when changing `substeps`

Open pavelacamposp opened this issue 8 months ago • 1 comments

Bug Description

Using the same propeller RPM values to hover a drone (gs.morphs.Drone) results in different behavior depending on the substeps value.

The total force required to stabilize the drone should be the same since the drone's weight is constant (0.26487 N). However, changing the substeps value appears to alter the total force required for hovering.

  • Base RPM ≈ 14468 → 0.2646 N (from RigidSolver._kernel_set_drone_rpm()):

    • substeps = 1: Drone hovers.

      https://github.com/user-attachments/assets/999c9202-28f8-4be6-b509-a1349573d531

    • substeps ≥ 2: Drone falls.

      https://github.com/user-attachments/assets/cea6178d-a729-4443-90ac-5a937dd86456

  • Base RPM = 20440 → 0.528092 N (expected to always ascend):

    • substeps = 1: Drone ascends.

      https://github.com/user-attachments/assets/63d4f5b4-2796-4cab-8445-de79c762cb8d

    • substeps = 2: Drone hovers.

      https://github.com/user-attachments/assets/a502ccb7-ada4-40e5-8282-218057159fce

    • substeps ≥ 3: Drone falls.

      https://github.com/user-attachments/assets/eac3cbf0-1d6d-4935-b86a-46278014ecb3

Is this the expected behavior? Shouldn't the effect of a constant applied thrust be independent of the substeps value?

If I’m misunderstanding how substeps interact with the simulation, I’d really appreciate any clarification.

Steps to Reproduce

  1. Run the script with substeps = 1 → Drone hovers.
  2. Increase substeps to 2 or higher → Drone falls.
  3. Increase RPM (base_rpm = 20440):
    • substeps = 1: Drone ascends.
    • substeps = 2: Drone hovers.
    • substeps ≥ 3: Drone falls.
import genesis as gs

base_rpm = 14468.429183500699  # Expected hover RPM
# base_rpm = 20440  # Expected ascend RPM

def main():
    gs.init(backend=gs.gpu)

    ##### scene #####
    scene = gs.Scene(show_viewer=True, sim_options=gs.options.SimOptions(dt=0.01, substeps=1))
    # scene = gs.Scene(show_viewer=True, sim_options=gs.options.SimOptions(dt=0.01, substeps=2))

    ##### entities #####
    plane = scene.add_entity(morph=gs.morphs.Plane())

    drone = scene.add_entity(morph=gs.morphs.Drone(file="urdf/drones/cf2x.urdf", pos=(0, 0, 1.0)))

    ##### build #####
    scene.build()

    ##### simulate #####
    for _ in range(100):
        drone.set_propellels_rpm([base_rpm, base_rpm, base_rpm, base_rpm])
        scene.step()

if __name__ == "__main__":
    main()

Expected Behavior

The effect of a constant applied thrust should be independent of the substeps value. Since the total thrust and weight remain the same, the drone should always hover.

Screenshots/Videos

No response

Relevant log output


Environment

  • OS: Ubuntu 24.04
  • GPU/CPU: RTX 3060
  • GPU-driver version: 535.183.01
  • CUDA / CUDA-toolkit version: 12.2

Release version or Commit ID

98b29b4a4e56bdaa55ca1d8a359c5935eb24f26c

Additional Context

No response

pavelacamposp avatar Mar 04 '25 10:03 pavelacamposp