netsse.tools.kinematics#
Functions to manipulate the body kinematics of, e.g., marine vessels.
Copyright (C) 2023-2026 Technical University of Denmark, R.E.G. Mounet
This code is part of the NetSSE software.
NetSSE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
NetSSE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
To credit the author, users are encouraged to use below reference:
Mounet, R. E. G., & Nielsen, U. D. NetSSE: An open-source Python package
for network-based sea state estimation from ships, buoys, and other
observation platforms (version 2.2). Technical University of Denmark,
GitLab. February 2026. https://doi.org/10.11583/DTU.26379811.
Last updated on 20-02-2026 by R.E.G. Mounet
Functions#
|
Computes the Euler angle rotation matrix \(R\) using the zyx convention, |
|
Computes the Euler angle transformation matrix \(T\) for attitude using the zyx convention, as per Fossen (2011). |
|
Calculates the acceleration \(a_P\) of a point P in a rigid body. |
|
Computes the Euler angle transformation matrix \(J\) in full using the zyx |
Module Contents#
- netsse.tools.kinematics.Rzyx(phi, theta, psi)[source]#
Computes the Euler angle rotation matrix \(R\) using the zyx convention, as per Fossen (2011).
Note
This function can be used to transform velocity vectors from a body-fixed frame to the North-East-Down (NED) reference frame, using specified Euler angles.
- Parameters:
phi (Scalar, or numpy array of size (N,) or (N,M)) – Roll angle [rad].
theta (Scalar, or numpy array of size (N,) or (N,M)) – Pitch angle [rad].
psi (Scalar, or numpy array of size (N,) or (N,M)) – Yaw angle [rad].
- Returns:
R – Euler angle rotation matrix \(R\).
- Return type:
Numpy array of size (shape(phi),3,3)
See also
References
Fossen, T. I. (2011). Handbook of Marine Craft Hydrodynamics and Motion Control. John Wiley and Sons.
Example
>>> R = Rzyx(phi, theta, psi)
- netsse.tools.kinematics.Tzyx(phi, theta)[source]#
Computes the Euler angle transformation matrix \(T\) for attitude using the zyx convention, as per Fossen (2011).
Note
This function can be used to transform velocity vectors from a body-fixed frame to the North-East-Down (NED) reference frame, using specified Euler angles.
- Parameters:
phi (Scalar, or numpy array of size (N,) or (N,M)) – Roll angle [rad].
theta (Scalar, or numpy array of size (N,) or (N,M)) – Pitch angle [rad].
- Raises:
ValueError – The \(T\) matrix has a singularity for \(\theta = \pm 90^\circ\).
- Returns:
T – Euler angle transformation matrix \(T\) for attitude.
- Return type:
Numpy array of size (shape(phi),3,3)
References
Fossen, T. I. (2011). Handbook of Marine Craft Hydrodynamics and Motion Control. John Wiley and Sons.
Example
>>> T = Tzyx(phi, theta)
- netsse.tools.kinematics.accel_rigid_body(a_O, r_P, omega, omega_dot, axis=0)[source]#
Calculates the acceleration \(a_P\) of a point P in a rigid body.
The acceleration, \(a_O\) of a point O in the rigid body, as well as the body’s angular velocity, \(\omega\), and acceleration, \(\dot{\omega}\), are assumed to be known.
- Parameters:
a_O (Numpy array of vector of size (_,3,_)) – Linear acceleration vector of the reference point O [m/s²].
r_P (Numpy vector of size (3,)) – Position vector of point P relative to the reference point O [m].
omega (Numpy array of vector of size (_,3,_)) – Angular velocity vector [rad/s].
omega_dot (Numpy array of vector of size (_,3,_)) – Angular acceleration vector [rad/s²].
axis (int, optional) – Axis along which to compute the cross products. Default is 0.
- Returns:
a_P – Linear acceleration vector of the target point P [m/s²].
- Return type:
Numpy array of size (_,3,_)
Example
>>> a_P = accel_rigid_body(a_O, r_P, omega, omega_dot)
- netsse.tools.kinematics.eulerang(phi, theta, psi, unit='rad')[source]#
Computes the Euler angle transformation matrix \(J\) in full using the zyx convention, as per Fossen (2011):
\[J = \left[ \begin{array}{cc} J_1 & 0 \newline 0 & J_2 \end{array} \right],\]where \(J_1 = R_{zyx}\) and \(J_2 = T_{zyx}\).
Note
This function can be used to transform velocity vectors from a body-fixed frame to the North-East-Down (NED) reference frame, using specified Euler angles.
- Parameters:
phi (Scalar, or numpy array of size (N,) or (N,M)) – Roll angle.
theta (Scalar, or numpy array of size (N,) or (N,M)) – Pitch angle.
psi (Scalar, or numpy array of size (N,) or (N,M)) – Yaw angle.
unit ({'rad','deg'}, optional) – Unit of the input angles
phi,theta, andpsi.
- Returns:
J (Numpy array of size (shape(phi),6,6)) – Euler angle transformation matrix.
J1 (Numpy array of size (shape(phi),3,3)) – \(J_1 = R_{zyx}\), the Euler angle rotation matrix.
J2 (Numpy array of size (shape(phi),3,3)) – \(J_2 = T_{zyx}\), the Euler angle transformation matrix for attitude.
References
Fossen, T. I. (2011). Handbook of Marine Craft Hydrodynamics and Motion Control. John Wiley and Sons.
Example
>>> [J, Rzyx, Tzyx] = eulerang(phi, theta, psi)