dynamics.so_rpy_rotor
crazyflow.dynamics.so_rpy_rotor
¶
Second-order fitted RPY dynamics with first-order thrust dynamics.
Extends so_rpy by adding a scalar thrust state \(F\) that captures motor spin-up and spin-down
with a first-order lag. Rotational dynamics remain a fitted second-order linear system driven by RPY
commands. The command interface is [roll_rad, pitch_rad, yaw_rad, thrust_N]. The rotor_vel
state is the current thrust in Newtons (not motor RPMs).
where \(\tau\) is the thrust time constant, \(\boldsymbol{\psi} = [\phi,\theta,\psi]^{\top}\) are the roll/pitch/yaw angles with rates \(\dot{\boldsymbol{\psi}}\), and \(R = {}^{\mathcal{I}}R_{\mathcal{B}}(\boldsymbol{\psi})\) is the rotation from body to world frame.
This is the native Euler-angle form. For how the simulation integrates this state in quaternion + angular velocity coordinates, see so_rpy.
Classes¶
Params
¶
Attributes¶
J
instance-attribute
¶
Inertia matrix of the drone.
J_inv
instance-attribute
¶
Inverse of the inertia matrix of the drone.
acc_coef
instance-attribute
¶
Acceleration coefficient of the drone.
cmd_f_coef
instance-attribute
¶
Collective thrust coefficient of the drone.
cmd_rpy_coef
instance-attribute
¶
Roll pitch yaw command coefficient of the drone.
gravity_vec
instance-attribute
¶
Gravity vector of the drone.
mass
instance-attribute
¶
Mass of the drone.
rpy_coef
instance-attribute
¶
Roll pitch yaw coefficient of the drone.
rpy_rates_coef
instance-attribute
¶
Roll pitch yaw rates coefficient of the drone.
thrust_time_coef
instance-attribute
¶
Rotor coefficient of the drone.
Methods:¶
create(n_worlds, n_drones, drone, device)
staticmethod
¶
Create a default set of parameters for the simulation.
Source code in crazyflow/dynamics/so_rpy_rotor/dynamics.py
Functions:¶
sim_dynamics(data)
¶
Compute the forces and torques from the so_rpy_rotor dynamics.
Source code in crazyflow/dynamics/so_rpy_rotor/dynamics.py
symbolic_dynamics(model_rotor_vel=True, model_dist_f=False, model_dist_t=False, *, mass, gravity_vec, J, J_inv, thrust_time_coef, acc_coef, cmd_f_coef, rpy_coef, rpy_rates_coef, cmd_rpy_coef)
¶
Return CasADi symbolic expressions for the so_rpy_rotor dynamics in quaternion form.
Internally delegates to symbolic_dynamics_euler and converts the Euler-angle state to quaternion + angular-velocity state so that the interface matches that of symbolic_dynamics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_rotor_vel
|
bool
|
If |
True
|
model_dist_f
|
bool
|
If |
False
|
model_dist_t
|
bool
|
If |
False
|
mass
|
float
|
Drone mass in kg. |
required |
gravity_vec
|
Array
|
Gravity vector, shape |
required |
J
|
Array
|
Inertia matrix, shape |
required |
J_inv
|
Array
|
Inverse inertia matrix, shape |
required |
thrust_time_coef
|
Array
|
First-order thrust lag time constant coefficient (1/s). |
required |
acc_coef
|
Array
|
Scalar acceleration offset coefficient. |
required |
cmd_f_coef
|
Array
|
Collective-thrust-to-acceleration coefficient. |
required |
rpy_coef
|
Array
|
RPY state feedback coefficient, shape |
required |
rpy_rates_coef
|
Array
|
RPY-rate feedback coefficient, shape |
required |
cmd_rpy_coef
|
Array
|
RPY command feedforward coefficient, shape |
required |
Returns:
| Type | Description |
|---|---|
MX
|
Tuple |
MX
|
|
MX
|
|
MX
|
|
tuple[MX, MX, MX, MX]
|
|
Source code in crazyflow/dynamics/so_rpy_rotor/dynamics.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
symbolic_dynamics_euler(model_rotor_vel=True, *, mass, gravity_vec, J, J_inv, thrust_time_coef, acc_coef, cmd_f_coef, rpy_coef, rpy_rates_coef, cmd_rpy_coef)
¶
Return CasADi symbolic expressions for the so_rpy_rotor dynamics in Euler-angle form.
This is the native representation of the so_rpy_rotor dynamics. The state uses
roll/pitch/yaw and their rates rather than quaternion + angular velocity, which avoids
trigonometric overhead inside CasADi-based solvers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_rotor_vel
|
bool
|
If |
True
|
mass
|
float
|
Drone mass in kg. |
required |
gravity_vec
|
Array
|
Gravity vector, shape |
required |
J
|
Array
|
Inertia matrix, shape |
required |
J_inv
|
Array
|
Inverse inertia matrix, shape |
required |
thrust_time_coef
|
Array
|
First-order thrust lag time constant coefficient (1/s). |
required |
acc_coef
|
Array
|
Scalar acceleration offset coefficient. |
required |
cmd_f_coef
|
Array
|
Collective-thrust-to-acceleration coefficient. |
required |
rpy_coef
|
Array
|
RPY state feedback coefficient, shape |
required |
rpy_rates_coef
|
Array
|
RPY-rate feedback coefficient, shape |
required |
cmd_rpy_coef
|
Array
|
RPY command feedforward coefficient, shape |
required |
Returns:
| Type | Description |
|---|---|
MX
|
Tuple |
MX
|
|
MX
|
|
MX
|
|
tuple[MX, MX, MX, MX]
|
|
Source code in crazyflow/dynamics/so_rpy_rotor/dynamics.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |