CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

LieGroups.Util.angle_wrap

Wrap angle to [-pi, pi]

Public declarations

Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.

RoleNameTypeDimensions / attributes / defaultDescription
inputthetaReal
outputwrappedReal

Modelica declarations and implementation

Show parameters, interfaces and source

Parameters, inputs, outputs, defaults and equations from the source file.

function angle_wrap "Wrap angle to [-pi, pi]"
  input Real theta;
  output Real wrapped;
protected
  constant Real pi = 3.1415926535897932384626433832795;
algorithm
  wrapped := theta - 2*pi * floor((theta + pi) / (2*pi));
end angle_wrap;