utils.rotation
Rotation utilities for handling quaternion and Euler angle derivative conversions.
ang_vel2quat_dot(quat, ang_vel)
¶
Calculates the quaternion derivative based on an angular velocity.
Source code in drone_models/utils/rotation.py
ang_vel2rpy_rates(quat, ang_vel)
¶
Convert angular velocity to rpy rates with batch support.
Source code in drone_models/utils/rotation.py
ang_vel_deriv2rpy_rates_deriv(quat, ang_vel, ang_vel_deriv)
¶
Convert rpy rates derivatives to angular velocity derivatives.
Source code in drone_models/utils/rotation.py
create_cs_ang_vel2rpy_rates()
¶
Build a compiled CasADi function that converts angular velocity to RPY rates.
Returns:
| Type | Description |
|---|---|
Function
|
A |
Function
|
|
Function
|
that evaluates the kinematic mapping |
Function
|
|
Function
|
angular velocity. |
Source code in drone_models/utils/rotation.py
create_cs_ang_vel_deriv2rpy_rates_deriv()
¶
Build a compiled CasADi function that converts angular acceleration to RPY-rate derivatives.
Returns:
| Type | Description |
|---|---|
Function
|
A |
Function
|
|
Function
|
implementing |
Source code in drone_models/utils/rotation.py
create_cs_quat2matrix()
¶
Generates a casadi numeric function from the cs_quat2matrix function.
Source code in drone_models/utils/rotation.py
create_cs_rpy2matrix()
¶
Generates a casadi numeric function from the cs_rpy2matrix function.
Source code in drone_models/utils/rotation.py
create_cs_rpy_rates2ang_vel()
¶
Build a compiled CasADi function that converts RPY rates to angular velocity.
Returns:
| Type | Description |
|---|---|
Function
|
A |
Function
|
|
Function
|
that evaluates the inverse kinematic mapping |
Function
|
|
Source code in drone_models/utils/rotation.py
create_cs_rpy_rates_deriv2ang_vel_deriv()
¶
Build a compiled CasADi function that converts RPY-rate derivatives to angular acceleration.
Returns:
| Type | Description |
|---|---|
Function
|
A |
Function
|
|
Function
|
implementing |
Source code in drone_models/utils/rotation.py
cs_quat2euler(quat, seq='xyz', degrees=False)
¶
Convert a CasADi symbolic quaternion to Euler angles.
Symbolic equivalent of scipy.spatial.transform.Rotation.from_quat(q).as_euler(seq),
implemented in CasADi MX so it can be differentiated and compiled by
CasADi-based solvers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quat
|
MX
|
CasADi |
required |
seq
|
str
|
Three-character axis sequence string. Lowercase letters (e.g.
|
'xyz'
|
degrees
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
MX
|
CasADi |
MX
|
the requested sequence and unit. |
Source code in drone_models/utils/rotation.py
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 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
cs_quat2matrix(quat)
¶
Creates a symbolic rotation matrix based on a symbolic quaternion.
From https://github.com/cmower/spatial-casadi/blob/master/spatial_casadi/spatial.py
Source code in drone_models/utils/rotation.py
cs_rpy2matrix(rpy, degrees=False)
¶
Creates a symbolic rotation matrix from roll, pitch, yaw (XYZ convention).
Should be equivalent to scipy.spatial.transform.Rotation.from_euler('xyz', rpy).as_matrix().
Source code in drone_models/utils/rotation.py
rpy_rates2ang_vel(quat, rpy_rates)
¶
Convert rpy rates to angular velocity with batch support.
Source code in drone_models/utils/rotation.py
rpy_rates_deriv2ang_vel_deriv(quat, rpy_rates, rpy_rates_deriv)
¶
Convert rpy rates derivatives to angular velocity derivatives.