@@ -56,10 +56,11 @@ def array_compare_assert(x: Array, y: Array, value: bool = True, name: str | Non
5656def test_sim_init (physics : Physics , device : str , control : Control , n_worlds : int ):
5757 n_drones = 1
5858
59- if physics != Physics .first_principles and control == Control .force_torque :
60- with pytest .raises (ConfigError ):
61- Sim (n_worlds = n_worlds , physics = physics , device = device , control = control )
62- return
59+ if physics != Physics .first_principles :
60+ if control in (Control .force_torque , Control .rotor_vel ):
61+ with pytest .raises (ConfigError ):
62+ Sim (n_worlds = n_worlds , physics = physics , device = device , control = control )
63+ return
6364
6465 sim = Sim (n_worlds = n_worlds , physics = physics , device = device , control = control )
6566 assert sim .n_worlds == n_worlds
@@ -89,10 +90,11 @@ def test_sim_init(physics: Physics, device: str, control: Control, n_worlds: int
8990 assert sim .data .controls .attitude is None
9091
9192 # Test force torque buffer shapes
92- ft_ctrl = sim .data .controls .force_torque
93- assert isinstance (ft_ctrl , ControlData )
94- array_meta_assert (ft_ctrl .cmd , (n_worlds , n_drones , 4 ), device )
95- array_meta_assert (ft_ctrl .staged_cmd , (n_worlds , n_drones , 4 ), device )
93+ if control in (Control .state , Control .attitude , Control .force_torque ):
94+ ft_ctrl = sim .data .controls .force_torque
95+ assert isinstance (ft_ctrl , ControlData )
96+ array_meta_assert (ft_ctrl .cmd , (n_worlds , n_drones , 4 ), device )
97+ array_meta_assert (ft_ctrl .staged_cmd , (n_worlds , n_drones , 4 ), device )
9698
9799
98100@pytest .mark .unit
@@ -183,8 +185,9 @@ def test_reset_masked(device: str, physics: Physics):
183185@pytest .mark .parametrize ("physics" , Physics )
184186@pytest .mark .parametrize ("control" , Control )
185187def test_sim_step (n_worlds : int , n_drones : int , physics : Physics , control : Control , device : str ):
186- if physics != Physics .first_principles and control == Control .force_torque :
187- pytest .skip ("Force-torque control is not supported with non-first-principles physics" )
188+ if physics != Physics .first_principles :
189+ if control in (Control .force_torque , Control .rotor_vel ):
190+ pytest .skip (f"{ control } is not supported with non-first-principles physics" )
188191
189192 sim = Sim (n_worlds = n_worlds , n_drones = n_drones , physics = physics , device = device , control = control )
190193 sim .step (2 )
0 commit comments