@@ -263,7 +263,7 @@ class SoRpyRotorDragData:
263263 """Force constant of the drone."""
264264 KM : Array # (N, M, 1)
265265 """Torque constant of the drone."""
266- rotor_coef : Array # (N, M, 1)
266+ thrust_time_coef : Array # (N, M, 1)
267267 """Rotor coefficient of the drone."""
268268 acc_coef : Array # (N, M, 1)
269269 """Acceleration coefficient of the drone."""
@@ -277,8 +277,8 @@ class SoRpyRotorDragData:
277277 """Roll pitch yaw command coefficient of the drone."""
278278 drag_linear_coef : Array # (N, M, 1)
279279 """Linear drag coefficient of the drone."""
280- drag_abs_linear_coef : Array # (N, M, 1)
281- """Absolute linear drag coefficient of the drone."""
280+ drag_square_coef : Array # (N, M, 1)
281+ """Square drag coefficient of the drone."""
282282
283283 def create (
284284 n_worlds : int , n_drones : int , drone_model : str , device : Device
@@ -293,27 +293,27 @@ def create(
293293 J_inv = jnp .linalg .inv (J ),
294294 KF = jnp .asarray (p .KF , device = device ),
295295 KM = jnp .asarray (p .KM , device = device ),
296- rotor_coef = jnp .asarray (p .rotor_coef , device = device ),
296+ thrust_time_coef = jnp .asarray (p .thrust_time_coef , device = device ),
297297 acc_coef = jnp .asarray (p .acc_coef , device = device ),
298298 cmd_f_coef = jnp .asarray (p .cmd_f_coef , device = device ),
299299 rpy_coef = jnp .asarray (p .rpy_coef , device = device ),
300300 rpy_rates_coef = jnp .asarray (p .rpy_rates_coef , device = device ),
301301 cmd_rpy_coef = jnp .asarray (p .cmd_rpy_coef , device = device ),
302302 drag_linear_coef = jnp .asarray (p .drag_linear_coef , device = device ),
303- drag_abs_linear_coef = jnp .asarray (p .drag_abs_linear_coef , device = device ),
303+ drag_square_coef = jnp .asarray (p .drag_square_coef , device = device ),
304304 )
305305
306306
307307def so_rpy_rotor_drag_physics (data : SimData ) -> SimData :
308308 """Compute the forces and torques from the so_rpy_rotor_drag physics model."""
309309 params : SoRpyRotorDragData = data .params
310- vel , _ , acc , ang_acc , _ = so_rpy_rotor_drag_dynamics (
310+ vel , _ , acc , ang_acc , rotor_acc = so_rpy_rotor_drag_dynamics (
311311 pos = data .states .pos ,
312312 quat = data .states .quat ,
313313 vel = data .states .vel ,
314314 ang_vel = data .states .ang_vel ,
315315 cmd = data .controls .attitude .cmd ,
316- rotor_vel = None , # TODO: Add rotor_vel once the parameters are available
316+ rotor_vel = data . states . rotor_vel ,
317317 dist_f = data .states .force ,
318318 dist_t = data .states .torque ,
319319 mass = params .mass ,
@@ -322,17 +322,16 @@ def so_rpy_rotor_drag_physics(data: SimData) -> SimData:
322322 J_inv = params .J_inv ,
323323 KF = params .KF ,
324324 KM = params .KM ,
325- rotor_coef = params .rotor_coef ,
325+ thrust_time_coef = params .thrust_time_coef ,
326326 acc_coef = params .acc_coef ,
327327 cmd_f_coef = params .cmd_f_coef ,
328328 rpy_coef = params .rpy_coef ,
329329 rpy_rates_coef = params .rpy_rates_coef ,
330330 cmd_rpy_coef = params .cmd_rpy_coef ,
331331 drag_linear_coef = params .drag_linear_coef ,
332- drag_abs_linear_coef = params .drag_abs_linear_coef ,
332+ drag_square_coef = params .drag_square_coef ,
333333 )
334- # TODO: Add rotor_vel to the states_deriv
335334 states_deriv = data .states_deriv .replace (
336- vel = vel , ang_vel = data .states .ang_vel , acc = acc , ang_acc = ang_acc
335+ vel = vel , ang_vel = data .states .ang_vel , acc = acc , ang_acc = ang_acc , rotor_acc = rotor_acc
337336 )
338337 return data .replace (states_deriv = states_deriv )
0 commit comments