function
Planning.Bezier.cubicControlPoints
Construct a degree-three curve from endpoint value and rate
The four endpoint constraints uniquely determine a cubic curve. This package uses it for yaw because flatness reconstruction requires yaw through its second derivative.
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | startDerivative | Real | [:, 2] | Value and rate at t=0 |
| input | endDerivative | Real | [size(startDerivative, 1), 2] | Value and rate at t=duration |
| input | duration | Real | (unit = "s") | Curve duration |
| output | controlPoint | Real | [size(startDerivative, 1), 4] | Degree-three Bezier control points |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function cubicControlPoints
"Construct a degree-three curve from endpoint value and rate"
input Real startDerivative[:, 2] "Value and rate at t=0";
input Real endDerivative[size(startDerivative, 1), 2]
"Value and rate at t=duration";
input Real duration(unit = "s") "Curve duration";
output Real controlPoint[size(startDerivative, 1), 4]
"Degree-three Bezier control points";
algorithm
assert(duration > 0.0, "Bezier duration must be positive");
controlPoint[:, 1] := startDerivative[:, 1];
controlPoint[:, 2] := controlPoint[:, 1]
+ duration * startDerivative[:, 2] / 3.0;
controlPoint[:, 4] := endDerivative[:, 1];
controlPoint[:, 3] := controlPoint[:, 4]
- duration * endDerivative[:, 2] / 3.0;
annotation(Documentation(info="<html>
<p>The four endpoint constraints uniquely determine a cubic curve.
This package uses it for yaw because flatness reconstruction requires
yaw through its second derivative.</p>
</html>"));
end cubicControlPoints;