function
Planning.Dubins.mod2pi
Wrap an angle to [0, 2*pi)
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | angle | Real | | |
| output | wrapped | Real | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function mod2pi "Wrap an angle to [0, 2*pi)"
input Real angle;
output Real wrapped;
protected
constant Real twoPi = 4.0 * asin(1.0);
algorithm
wrapped := atan2(sin(angle), cos(angle));
if wrapped < 0.0 then
wrapped := wrapped + twoPi;
end if;
end mod2pi;