Skip to content

Commit 1e57a26

Browse files
committed
Replace KF & KM by thrust curves
1 parent 5e97f42 commit 1e57a26

1 file changed

Lines changed: 9 additions & 25 deletions

File tree

crazyflow/sim/physics.py

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class FirstPrinciplesData:
4141
"""Inertia matrix of the drone."""
4242
J_inv: Array # (N, M, 3, 3)
4343
"""Inverse of the inertia matrix of the drone."""
44-
KF: Array # (N, M, 1)
44+
rpm2thrust: Array # (N, M, 1)
4545
"""Force constant of the drone."""
46-
KM: Array # (N, M, 1)
46+
rpm2torque: Array # (N, M, 1)
4747
"""Torque constant of the drone."""
4848
L: Array # (N, M, 1)
4949
"""Arm length of the drone."""
@@ -64,8 +64,8 @@ def create(
6464
gravity_vec=jnp.asarray(p["gravity_vec"], device=device),
6565
J=J,
6666
J_inv=jnp.linalg.inv(J),
67-
KF=jnp.asarray(p["KF"], device=device),
68-
KM=jnp.asarray(p["KM"], device=device),
67+
rpm2thrust=jnp.asarray(p["rpm2thrust"], device=device),
68+
rpm2torque=jnp.asarray(p["rpm2torque"], device=device),
6969
L=jnp.asarray(p["L"], device=device),
7070
mixing_matrix=jnp.asarray(p["mixing_matrix"], device=device),
7171
thrust_tau=jnp.asarray(p["thrust_tau"], device=device),
@@ -88,8 +88,8 @@ def first_principles_physics(data: SimData) -> SimData:
8888
gravity_vec=params.gravity_vec,
8989
J=params.J,
9090
J_inv=params.J_inv,
91-
KF=params.KF,
92-
KM=params.KM,
91+
rpm2thrust=params.rpm2thrust,
92+
rpm2torque=params.rpm2torque,
9393
L=params.L,
9494
mixing_matrix=params.mixing_matrix,
9595
thrust_tau=params.thrust_tau,
@@ -176,11 +176,7 @@ class SoRpyRotorData:
176176
"""Inertia matrix of the drone."""
177177
J_inv: Array # (N, M, 3, 3)
178178
"""Inverse of the inertia matrix of the drone."""
179-
KF: Array # (N, M, 1)
180-
"""Force constant of the drone."""
181-
KM: Array # (N, M, 1)
182-
"""Torque constant of the drone."""
183-
rotor_coef: Array # (N, M, 1)
179+
thrust_time_coef: Array # (N, M, 1)
184180
"""Rotor coefficient of the drone."""
185181
acc_coef: Array # (N, M, 1)
186182
"""Acceleration coefficient of the drone."""
@@ -203,9 +199,7 @@ def create(n_worlds: int, n_drones: int, drone_model: str, device: Device) -> So
203199
gravity_vec=jnp.asarray(p["gravity_vec"], device=device),
204200
J=J,
205201
J_inv=jnp.linalg.inv(J),
206-
KF=jnp.asarray(p["KF"], device=device),
207-
KM=jnp.asarray(p["KM"], device=device),
208-
rotor_coef=jnp.asarray(p["rotor_coef"], device=device),
202+
thrust_time_coef=jnp.asarray(p["thrust_time_coef"], device=device),
209203
acc_coef=jnp.asarray(p["acc_coef"], device=device),
210204
cmd_f_coef=jnp.asarray(p["cmd_f_coef"], device=device),
211205
rpy_coef=jnp.asarray(p["rpy_coef"], device=device),
@@ -230,9 +224,7 @@ def so_rpy_rotor_physics(data: SimData) -> SimData:
230224
gravity_vec=params.gravity_vec,
231225
J=params.J,
232226
J_inv=params.J_inv,
233-
KF=params.KF,
234-
KM=params.KM,
235-
rotor_coef=params.rotor_coef,
227+
thrust_time_coef=params.thrust_time_coef,
236228
acc_coef=params.acc_coef,
237229
cmd_f_coef=params.cmd_f_coef,
238230
rpy_coef=params.rpy_coef,
@@ -256,10 +248,6 @@ class SoRpyRotorDragData:
256248
"""Inertia matrix of the drone."""
257249
J_inv: Array # (N, M, 3, 3)
258250
"""Inverse of the inertia matrix of the drone."""
259-
KF: Array # (N, M, 1)
260-
"""Force constant of the drone."""
261-
KM: Array # (N, M, 1)
262-
"""Torque constant of the drone."""
263251
thrust_time_coef: Array # (N, M, 1)
264252
"""Rotor coefficient of the drone."""
265253
acc_coef: Array # (N, M, 1)
@@ -289,8 +277,6 @@ def create(
289277
gravity_vec=jnp.asarray(p["gravity_vec"], device=device),
290278
J=J,
291279
J_inv=jnp.linalg.inv(J),
292-
KF=jnp.asarray(p["KF"], device=device),
293-
KM=jnp.asarray(p["KM"], device=device),
294280
thrust_time_coef=jnp.asarray(p["thrust_time_coef"], device=device),
295281
acc_coef=jnp.asarray(p["acc_coef"], device=device),
296282
cmd_f_coef=jnp.asarray(p["cmd_f_coef"], device=device),
@@ -318,8 +304,6 @@ def so_rpy_rotor_drag_physics(data: SimData) -> SimData:
318304
gravity_vec=params.gravity_vec,
319305
J=params.J,
320306
J_inv=params.J_inv,
321-
KF=params.KF,
322-
KM=params.KM,
323307
thrust_time_coef=params.thrust_time_coef,
324308
acc_coef=params.acc_coef,
325309
cmd_f_coef=params.cmd_f_coef,

0 commit comments

Comments
 (0)