Control
The MCSimPython.control package contains a set of DP and Maneuvering controllers.
Basic Controllers
The module contains simple PD and PID controllers.
PD Controller
- class MCSimPython.control.basic.PD(kp: list, kd: list)
Proportional-Derivative controller.
- get_tau(eta, eta_d, nu, nu_d)
Calculate control loads.
- Parameters:
eta (array_like) – Vessel pose in surge, sway and yaw.
eta_d (array_like) – Desired vessel pose in surge, sway and yaw (NED-frame).
nu (array_like) – Vessel velocity in surge, sway, and yaw (body-frame).
nu_d (array_like) – Desired vessel velocity in surge, sway and yaw (body-frame).
- Returns:
tau – Controller load in surge, sway, and yaw (body-frame).
- Return type:
array_like
- set_kd(kd: list)
Set the derivative gain coefficients.
- set_kp(kp: list)
Set the proportional gain coefficients.
PID Controller
- class MCSimPython.control.basic.PID(kp: list, kd: list, ki: list, dt: float = 0.01)
Proportional-Derivative control with integral action.
- get_tau(eta, eta_d, nu, nu_d)
Calculate control loads.
- Parameters:
eta (array_like) – Vessel pose in surge, sway and yaw.
eta_d (array_like) – Desired vessel pose in surge, sway and yaw (NED-frame).
nu (array_like) – Vessel velocity in surge, sway, and yaw (body-frame).
nu_d (array_like) – Desired vessel velocity in surge, sway and yaw (body-frame).
- Returns:
tau – Controller load in surge, sway, and yaw (body-frame).
- Return type:
array_like
Backstepping Controllers
In the MCSimPython.control.backstepping module there are controllers based on backstepping
theory. Currently, only a backstepping controller for maneuvering purposes has been implemented.
- class MCSimPython.control.backstepping.BacksteppingController(M, D, K1, K2)
Backsteppipng controller for maneuvering.
The controller should be used together with a path parameterization guidance/reference model.
See also
MCSimPython.guidance.path_parm.WayPointPathParamWay-points path parameterization.
- control_law(z1, z2, alpha, alpha_dot, nu)
Complete control law.
- error_pos(eta, eta_d)
Deviation from desired pose in body-frame.
- error_vel(nu, alpha)
Deviation from virtual control law.
- lyapunov_grad_s(z1, eta, eta_d_s)
Lyapunov function gradient.
- u(eta, nu, eta_d, eta_d_s, eta_d_s2, mu, u_s, u_s_dot, ddt_u_s)
Control command.
- unit_gradient_update_law(u_s, mu, eta_d_s, lyapunov_gradient)
Unit-tangent gradient update law for path parameter (s).
- virtual_control_dot(z1, z2, alpha, eta, eta_d, eta_d_s, eta_d_s2, u_s, u_s_dot, nu, s_dot, ddt_u_s)
Time derivative of virtual control law (alpha_dot).
- virtual_control_law(z1, eta, eta_d_s, u_s)
Virtual control law (alpha).