controls  3.0.0
Public Member Functions | Public Attributes | List of all members
SystemDynamicsBase Class Reference

Base class encoding the 6DOF hydrodynamic model of a marine vehicle. More...

#include <SystemDynamicsBase.h>

Inheritance diagram for SystemDynamicsBase:
AsvSystemDynamics AuvSystemDynamics

Public Member Functions

 SystemDynamicsBase (const bool is_3dof)
 Constructs the dynamics base and sets the DOF flag. More...
 
virtual ~SystemDynamicsBase ()=default
 Virtual destructor. More...
 
const Matrix6dget_m () const
 Returns the total mass matrix M = Mrb + Ma. More...
 
const Matrix6dget_mrb () const
 Returns the rigid-body mass matrix Mrb. More...
 
const Matrix6dget_ma_matrix () const
 Returns the added-mass matrix Ma. More...
 
const Matrix6dget_dl_matrix () const
 Returns the linear damping matrix Dl. More...
 
const Matrix6dget_dnl_matrix () const
 Returns the quadratic damping matrix Dnl. More...
 
const Vector3d & get_rgb_vec () const
 Returns the centre of gravity in the body frame. More...
 
const Vector3d & get_rbb_vec () const
 Returns the centre of buoyancy in the body frame. More...
 
const Vector3d & get_fgn () const
 Returns the gravitational force vector in the world frame. More...
 
const Vector3d & get_fbn () const
 Returns the buoyancy force vector in the world frame. More...
 
double get_mass_value () const
 Returns the vehicle mass in kg. More...
 
double get_weight () const
 Returns the vehicle weight in N. More...
 
double get_buoyancy_value () const
 Returns the net buoyancy force in N. More...
 
Matrix6d get_d (const Vector6d &velocity) const
 Evaluates the total damping matrix D(v) = Dl + Dnl*diag(|v|) More...
 
Matrix6d get_crb (const Vector6d &velocity) const
 Evaluates the rigid-body Coriolis matrix Crb(v) More...
 
Matrix6d get_ca (const Vector6d &velocity) const
 Evaluates the added-mass Coriolis matrix Ca(v) More...
 
Matrix6d get_c (const Vector6d &velocity) const
 Evaluates the total Coriolis matrix C(v) = Crb(v) + Ca(v) More...
 
Vector6d get_g (const Quaterniond &q) const
 Evaluates the 6DOF gravitational and buoyancy restoring vector G(q) More...
 
Vector6d get_g (const Vector3d &rpy) const
 Evaluates the 6DOF gravitational and buoyancy restoring vector G(rpy) More...
 
virtual Vector6d get_inverse_dynamics (const Vector6d &velocity, const Vector6d &acceleration, const Quaterniond &orientation) const
 Computes the inertial + Coriolis + damping force M*a + C(v)*v + D(v)*v. More...
 
void set_mass (double m)
 Sets vehicle mass and recomputes weight, buoyancy, and the rigid-body mass matrix. More...
 
void set_buoyancy (double factor)
 Sets the buoyancy force as a scale factor relative to vehicle weight. More...
 
void set_i (const std::array< double, 6 > &I)
 Sets the rigid-body inertia tensor. More...
 
void set_ma (const std::array< double, 6 > &m)
 Sets the diagonal added-mass coefficients. More...
 
void set_dl (const std::array< double, 6 > &d)
 Sets the diagonal linear damping coefficients. More...
 
void set_dnl (const std::array< double, 6 > &d)
 Sets the diagonal quadratic (nonlinear) damping coefficients. More...
 
void set_rbb (const std::array< double, 3 > &rbb)
 Sets the centre-of-buoyancy position in the body frame. More...
 
void set_rgb (const std::array< double, 3 > &rgb)
 Sets the centre-of-gravity position in the body frame. More...
 

Public Attributes

const bool is_system_3dof_
 True if the vehicle is constrained to the XY-Yaw plane (3DOF surface vehicle) More...
 

Detailed Description

Base class encoding the 6DOF hydrodynamic model of a marine vehicle.

Stores mass, inertia, damping, and buoyancy parameters and provides methods to evaluate the Coriolis matrix C(v), damping matrix D(v), restoring vector G(q), and the inertial + Coriolis + damping expression M*a + C(v)*v + D(v)*v. G(q) is computed separately and applied by BuoyancyController. Subclasses may override get_inverse_dynamics() to zero out irrelevant DOFs.

Invariant: M_ = Mrb_ + Ma_ must hold after every mutation. All setters that modify Mrb_ or Ma_ call update_mass() to re-establish this.

Constructor & Destructor Documentation

◆ SystemDynamicsBase()

SystemDynamicsBase::SystemDynamicsBase ( const bool  is_3dof)
explicit

Constructs the dynamics base and sets the DOF flag.

Parameters
is_3dof[in] True for a surface vehicle constrained to XY-Yaw

◆ ~SystemDynamicsBase()

virtual SystemDynamicsBase::~SystemDynamicsBase ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ get_buoyancy_value()

double SystemDynamicsBase::get_buoyancy_value ( ) const
inline

Returns the net buoyancy force in N.

◆ get_c()

Matrix6d SystemDynamicsBase::get_c ( const Vector6d velocity) const

Evaluates the total Coriolis matrix C(v) = Crb(v) + Ca(v)

Parameters
velocity[in] 6DOF body-frame velocity
Returns
6x6 total Coriolis matrix

◆ get_ca()

Matrix6d SystemDynamicsBase::get_ca ( const Vector6d velocity) const

Evaluates the added-mass Coriolis matrix Ca(v)

Parameters
velocity[in] 6DOF body-frame velocity
Returns
6x6 added-mass Coriolis matrix

◆ get_crb()

Matrix6d SystemDynamicsBase::get_crb ( const Vector6d velocity) const

Evaluates the rigid-body Coriolis matrix Crb(v)

Parameters
velocity[in] 6DOF body-frame velocity
Returns
6x6 rigid-body Coriolis matrix

◆ get_d()

Matrix6d SystemDynamicsBase::get_d ( const Vector6d velocity) const

Evaluates the total damping matrix D(v) = Dl + Dnl*diag(|v|)

Parameters
velocity[in] 6DOF body-frame velocity
Returns
6x6 velocity-dependent damping matrix

◆ get_dl_matrix()

const Matrix6d& SystemDynamicsBase::get_dl_matrix ( ) const
inline

Returns the linear damping matrix Dl.

◆ get_dnl_matrix()

const Matrix6d& SystemDynamicsBase::get_dnl_matrix ( ) const
inline

Returns the quadratic damping matrix Dnl.

◆ get_fbn()

const Vector3d& SystemDynamicsBase::get_fbn ( ) const
inline

Returns the buoyancy force vector in the world frame.

◆ get_fgn()

const Vector3d& SystemDynamicsBase::get_fgn ( ) const
inline

Returns the gravitational force vector in the world frame.

◆ get_g() [1/2]

Vector6d SystemDynamicsBase::get_g ( const Quaterniond &  q) const

Evaluates the 6DOF gravitational and buoyancy restoring vector G(q)

Parameters
q[in] Vehicle orientation as a unit quaternion
Returns
6-element restoring force/torque vector in N and Nm

◆ get_g() [2/2]

Vector6d SystemDynamicsBase::get_g ( const Vector3d &  rpy) const

Evaluates the 6DOF gravitational and buoyancy restoring vector G(rpy)

Parameters
rpy[in] Vehicle orientation as roll-pitch-yaw in radians
Returns
6-element restoring force/torque vector in N and Nm

◆ get_inverse_dynamics()

Vector6d SystemDynamicsBase::get_inverse_dynamics ( const Vector6d velocity,
const Vector6d acceleration,
const Quaterniond &  orientation 
) const
virtual

Computes the inertial + Coriolis + damping force M*a + C(v)*v + D(v)*v.

Does NOT include the gravitational/buoyancy restoring term G(q); that is handled separately by BuoyancyController. Subclasses may override this to zero out DOFs that are not actuated (e.g. Z, Roll, Pitch for a 3DOF vehicle).

Parameters
velocity[in] 6DOF body-frame velocity
acceleration[in] 6DOF body-frame acceleration
orientation[in] Vehicle orientation as a unit quaternion (unused in base implementation)
Returns
6-element force/torque vector in N and Nm

Reimplemented in AsvSystemDynamics.

◆ get_m()

const Matrix6d& SystemDynamicsBase::get_m ( ) const
inline

Returns the total mass matrix M = Mrb + Ma.

◆ get_ma_matrix()

const Matrix6d& SystemDynamicsBase::get_ma_matrix ( ) const
inline

Returns the added-mass matrix Ma.

◆ get_mass_value()

double SystemDynamicsBase::get_mass_value ( ) const
inline

Returns the vehicle mass in kg.

◆ get_mrb()

const Matrix6d& SystemDynamicsBase::get_mrb ( ) const
inline

Returns the rigid-body mass matrix Mrb.

◆ get_rbb_vec()

const Vector3d& SystemDynamicsBase::get_rbb_vec ( ) const
inline

Returns the centre of buoyancy in the body frame.

◆ get_rgb_vec()

const Vector3d& SystemDynamicsBase::get_rgb_vec ( ) const
inline

Returns the centre of gravity in the body frame.

◆ get_weight()

double SystemDynamicsBase::get_weight ( ) const
inline

Returns the vehicle weight in N.

◆ set_buoyancy()

void SystemDynamicsBase::set_buoyancy ( double  factor)

Sets the buoyancy force as a scale factor relative to vehicle weight.

Parameters
factor[in] Buoyancy scale factor (1.0 = neutrally buoyant)

◆ set_dl()

void SystemDynamicsBase::set_dl ( const std::array< double, 6 > &  d)

Sets the diagonal linear damping coefficients.

Parameters
d[in] Array of 6 diagonal linear damping values [Dl_x, ..., Dl_r]

◆ set_dnl()

void SystemDynamicsBase::set_dnl ( const std::array< double, 6 > &  d)

Sets the diagonal quadratic (nonlinear) damping coefficients.

Parameters
d[in] Array of 6 diagonal quadratic damping values [Dnl_x, ..., Dnl_r]

◆ set_i()

void SystemDynamicsBase::set_i ( const std::array< double, 6 > &  I)

Sets the rigid-body inertia tensor.

Parameters
I[in] Array of 6 inertia components [Ixx, Iyy, Izz, Ixy, Ixz, Iyz]

◆ set_ma()

void SystemDynamicsBase::set_ma ( const std::array< double, 6 > &  m)

Sets the diagonal added-mass coefficients.

Parameters
m[in] Array of 6 diagonal added-mass values [Ma_x, Ma_y, Ma_z, Ma_p, Ma_q, Ma_r]

◆ set_mass()

void SystemDynamicsBase::set_mass ( double  m)

Sets vehicle mass and recomputes weight, buoyancy, and the rigid-body mass matrix.

The existing buoyancy-to-weight ratio is preserved when mass changes.

Parameters
m[in] Vehicle mass in kg

◆ set_rbb()

void SystemDynamicsBase::set_rbb ( const std::array< double, 3 > &  rbb)

Sets the centre-of-buoyancy position in the body frame.

Parameters
rbb[in] Array of 3 coordinates [x, y, z] in metres

◆ set_rgb()

void SystemDynamicsBase::set_rgb ( const std::array< double, 3 > &  rgb)

Sets the centre-of-gravity position in the body frame.

Parameters
rgb[in] Array of 3 coordinates [x, y, z] in metres

Member Data Documentation

◆ is_system_3dof_

const bool SystemDynamicsBase::is_system_3dof_

True if the vehicle is constrained to the XY-Yaw plane (3DOF surface vehicle)


The documentation for this class was generated from the following files: