model
Vehicles.Cubs2.Test.Scenarios.AltitudeHold
Base classes
Vehicles.Cubs2.ClosedLoopVehicle
Follow base classes for inherited declarations; this page lists explicit declarations only.
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| parameter | targetAltitude_m | Real | = 3.0 | |
| parameter | straightRoute | Components.RouteParameters | = Components.RouteParameters(
cruiseSpeed = 4.0,
waypointSwitchingDistance = 3.0,
waypoints = [
0.0, 0.0, 3.0;
30.0, 0.0, 3.0;
60.0, 0.0, 3.0;
90.0, 0.0, 3.0;
120.0, 0.0, 3.0;
150.0, 0.0, 3.0;
180.0, 0.0, 3.0]) | |
| output | altitudeError_m | Real | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
model AltitudeHold
parameter Real targetAltitude_m = 3.0;
parameter Components.RouteParameters straightRoute = Components.RouteParameters(
cruiseSpeed = 4.0,
waypointSwitchingDistance = 3.0,
waypoints = [
0.0, 0.0, 3.0;
30.0, 0.0, 3.0;
60.0, 0.0, 3.0;
90.0, 0.0, 3.0;
120.0, 0.0, 3.0;
150.0, 0.0, 3.0;
180.0, 0.0, 3.0]);
extends Vehicles.Cubs2.ClosedLoopVehicle(
route = straightRoute,
initialPosition_m = {0.0, 0.0, targetAltitude_m},
initialVelocityBody_m_s = {4.0, 0.0, 0.0},
engaged = true,
armed = true,
stickOverrideActive = false,
stickOverride = zeros(4));
output Real altitudeError_m;
equation
altitudeError_m = targetAltitude_m - position_m[3];
end AltitudeHold;