quta

A python package for solving thrust allocation problems in the plane. The implementation is plenty fast enough to be used in real-time applications.

Utilizes quadratic programming with linearized constraints and disjunctive methodology together with (optional) slack variables for fast and robust allocation.

Module containing the core allocation solver functionality

exception quta.allocator.AllocationError

Bases: Exception

AllocationError class

class quta.allocator.Allocator

Bases: abc.ABC

Abstract base class for allocation problem

formulations.

add_thruster(thruster)

Add a thruster to the allocation problem.

allocate(global_thrust, relax=True)

Allocate global thrust vector to available thrusters

assemble_constraints(global_thrust, relax, combination)

Assemble linear constraints into matrix form

property n_problem

Number of unknown variables to be allocated in the original (non-relaxed) problem.

property n_relaxed_problem

Number of unknown variables to be allocated in the relaxed problem.

property n_thrusters

Number of thrusters assigned to this allocation problem.

abstract problem_formulation(relax)
Problem formulation, to be overrided

by child class.

set_slack_coefficients(coefs=(1000, 1000, 1000))
Set slack coefficients [Fx, Fy, Mz] used in the

problem formulation for penalty calculation.

class quta.allocator.MinimizePowerAllocator

Bases: quta.allocator.Allocator

Class for allocating thrust while minimizing total power consumption

problem_formulation(relax)

Problem formulation in matrix form

Module containing functionality for creating linearized constraints for some simple geometries

All linearized constrains returned to be compatible with quadprog format: C.T x >= b

class quta.constraints.CircleConstraint(radius, edges=16)

Bases: quta.constraints.Constraint2D

Constraint describing a circle

class quta.constraints.Constraint

Bases: abc.ABC

Abstract base class for a set

of linear, convex constraints

property constraints

Constraints in matrix and vector form

class quta.constraints.Constraint1D(po0, po1)

Bases: quta.constraints.Constraint

Abstract base class for a set of

linear, convex constraints forming a 1D equality line with ‘end caps’.

class quta.constraints.Constraint2D

Bases: quta.constraints.Constraint

Abstract base class for a set of

linear, convex constraints forming a 2D boundary surface.

exception quta.constraints.ConstraintError

Bases: Exception

ConstraintError class

exception quta.constraints.ConvexError

Bases: quta.constraints.ConstraintError

ConvexError class

exception quta.constraints.PaddingError

Bases: quta.constraints.ConstraintError

PaddingError class

class quta.constraints.SectorConstraint(radius, start, end, edges=10)

Bases: quta.constraints.Constraint2D

Constraint describing a circle sector

quta.constraints.concatenate_constraints(original_set, additional_set)
Method for concatenating sets of linear constraints.

original_set and additional_set are both tuples of for (C, b, n_eq). Output is a concatenated tuple of same form.

All equality constraints are always kept on top.

quta.constraints.pad_constraints(C, pad_with_before, total_size, pad_value=0)
Method for padding a 2D constraint matrix in order to match

the total number of variables in the problem formulation.

Thruster module containing classes for different type of thrusters

class quta.thruster.AzimuthThruster(pos, max_force, n_discret)

Bases: quta.thruster.Thruster

Convenience class for setting up a typical

Azimuthing thruster.

It is assumed that an Azimuthing thruster can

produce the same amount of force in any direction [0,2*pi]. The only bound existing is then the maximum force that can be delivered (max_force).

class quta.thruster.LongitudinalThruster(pos, max_force)

Bases: quta.thruster.Thruster

Class holding properties of a longitudinal

thruster. Force direction is along to the vessel longitudinal axis.

Utilizes a line constraint with arbitrary

direction, length and offset along line.

class quta.thruster.Thruster(pos)

Bases: object

Class holding properties of a Thruster

add_constraint(constraint)

Add a constraint to this thruster

property disjunctions

Returns number of disjunct constraints

property pos_x

x-position of thruster

property pos_y

y-position of thruster

static_constraints()

Returns static constaints

class quta.thruster.TransverseThruster(pos, max_force)

Bases: quta.thruster.Thruster

Class holding properties of a transverse

thruster. Force direction is transverse to the vessel longitudinal axis.

Utilizes a line constraint with arbitrary

direction, length and offset along line.