GEMstack.mathutils package

Math utilities common to onboard / offboard use.

Submodules

GEMstack.mathutils.collisions module

GEMstack.mathutils.control module

class GEMstack.mathutils.control.PID(kp: float, ki: float, kd: float, windup_limit: Optional[float] = None, difference_jump_threshold: float = 0.5)

Bases: object

Generic SISO PID controller.

Parameters
  • kp (float) – proportional gain

  • ki (float) – integral gain

  • kd (float) – derivative gain

  • windup_limit (optional, float) – limit on the integral term. Defaults to None, which means no limit.

  • difference_jump_threshold (optional, float) – threshold used to determine discontinuities between two consecutive errors. If the difference is greater than this threshold, the derivative term is set to 0. Defaults to 0.5.

advance(e: float, de: Optional[float] = None, t: Optional[float] = None, dt: Optional[float] = None, feedforward_term: float = 0) float
Parameters
  • e (float) – error

  • de (optional, float) – error derivative. If not provided, will be computed via finite differences.

  • t (optional, float) – time. Either dt or t must be provided for D or I term to have any effect.

  • dt (optional, float) – time step. Either dt or t must be provided for the D or I term to have any effect.

  • feedforward_term (optional, float) – feedforward term to add to the output. Defaults to 0.

reset()

Resets the controller to its initial state.

GEMstack.mathutils.differences module

GEMstack.mathutils.differences.gradient_forward_difference(f, x, h)

Approximation of the gradient of f(x) using forward differences with step size h

GEMstack.mathutils.differences.hessian2_forward_difference(f, x, y, h)

Approximation of the hessian of a 2-parameter function f(x,y) w.r.t. x and y using forward differences with step size h.

GEMstack.mathutils.differences.hessian_forward_difference(f, x, h)

Approximation of the hessian of f(x) using forward differences with step size h.

GEMstack.mathutils.differences.jacobian_forward_difference(f, x, h)

Approximation of the Jacobian of vector function f(x) using forward differences with step size h

GEMstack.mathutils.dubins module

GEMstack.mathutils.dynamics module

GEMstack.mathutils.signal module

GEMstack.mathutils.transforms module

GEMstack.mathutils.units module

GEMstack.mathutils.units.DEFAULT_ANGLE_RATE_UNIT = 'rad/s'

Default angle rate unit is radians per second

GEMstack.mathutils.units.DEFAULT_ANGLE_UNIT = 'rad'

Default angle unit is radians

GEMstack.mathutils.units.DEFAULT_DISTANCE_UNIT = 'm'

Default distance unit is meters

GEMstack.mathutils.units.DEFAULT_FORCE_UNIT = 'N'

Default force unit is Newtons

GEMstack.mathutils.units.DEFAULT_SPEED_UNIT = 'm/s'

Default speed unit is meters per second

GEMstack.mathutils.units.DEFAULT_TIME_UNIT = 's'

Default time unit is seconds

GEMstack.mathutils.units.DEFAULT_WEIGHT_UNIT = 'kg'

Default weight unit is kilograms

GEMstack.mathutils.units.DEG_TO_RAD = 0.0174533

Degrees to radians conversion factor

GEMstack.mathutils.units.FT_TO_M = 0.3047999902464003

Feet to meters conversion factor

GEMstack.mathutils.units.KG_TO_LBS = 2.20462

Kilograms to pounds conversion factor

GEMstack.mathutils.units.KPH_TO_MPS = 0.2777777777777778

Km per hour to meters per second conversion factor

GEMstack.mathutils.units.LBS_TO_KG = 0.45359290943563974

Pounds to kilograms conversion factor

GEMstack.mathutils.units.MPH_TO_MPS = 0.4470392589877243

Miles per hour to meters per second conversion factor

GEMstack.mathutils.units.MPS_TO_KPH = 3.6

Meters per second to km per hour conversion factor

GEMstack.mathutils.units.MPS_TO_MPH = 2.23694

Meters per second to miles per hour conversion factor

GEMstack.mathutils.units.M_TO_FT = 3.28084

Meters to feet conversion factor

GEMstack.mathutils.units.RAD_TO_DEG = 57.29575495751519

Radians to degrees conversion factor