@@ -2200,6 +2200,36 @@ def test_urdf_mimic(show_viewer, tol):
22002200 assert_allclose (gs_qpos [- 1 ], gs_qpos [- 2 ], tol = tol )
22012201
22022202
2203+ @pytest .mark .required
2204+ @pytest .mark .parametrize ("backend" , [gs .cpu ])
2205+ def test_gravity (show_viewer ):
2206+ base_rpm = 14468.429183500699
2207+ scene = gs .Scene (
2208+ show_viewer = show_viewer ,
2209+ sim_options = gs .options .SimOptions (
2210+ dt = 0.01 ,
2211+ substeps = 1 ,
2212+ gravity = [(0.0 , 0.0 , - 9.8 ), (0.0 , 0.0 , - 10.00 )],
2213+ ),
2214+ )
2215+
2216+ drone = scene .add_entity (
2217+ gs .morphs .Drone (file = "urdf/drones/cf2x.urdf" , pos = (0 , 0 , 1.0 )),
2218+ )
2219+
2220+ scene .build (n_envs = 2 )
2221+
2222+ for _ in range (500 ):
2223+ drone .set_propellels_rpm ([[base_rpm , base_rpm , base_rpm , base_rpm ], [base_rpm , base_rpm , base_rpm , base_rpm ]])
2224+ scene .step ()
2225+
2226+ first_pos = drone .get_dofs_position ()[0 , 2 ]
2227+ second_pos = drone .get_dofs_position ()[1 , 2 ]
2228+ assert_allclose (
2229+ second_pos , first_pos - 2.5 , tol = scene .sim_options .dt
2230+ ) # Relax the tolerance due to time integration's error
2231+
2232+
22032233@pytest .mark .required
22042234@pytest .mark .parametrize ("backend" , [gs .cpu ])
22052235def test_drone_hover_same_with_and_without_substeps (show_viewer , tol ):
0 commit comments