model
Vehicles.Cubs2.Test.Scenarios.TakeoffOpenLoop
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| output | time_s | Real | | |
| output | position_m | Real | [3] | |
| output | euler_rad | Real | [3] | |
| output | airspeed_m_s | Real | | |
| output | stickCommand | Real | [4] | |
| output | actuatorCommand | Real | [4] |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
model TakeoffOpenLoop
Vehicles.Cubs2.Plant plant;
Vehicles.Cubs2.OnboardStabilizerSurrogate onboardStabilizer;
output Real time_s;
output Real position_m[3];
output Real euler_rad[3];
output Real airspeed_m_s;
output Real stickCommand[4];
output Real actuatorCommand[4];
equation
if time < 0.8 then
stickCommand = {0.0, 0.0, 0.0, 1.0};
else
stickCommand = {0.0, 0.55, 0.0, 1.0};
end if;
onboardStabilizer.armed = 1.0;
onboardStabilizer.pilotCommand = stickCommand;
onboardStabilizer.gyro = plant.gyro;
onboardStabilizer.up_body = plant.up_body;
onboardStabilizer.airspeed = plant.airspeed;
actuatorCommand = onboardStabilizer.surfaceCommand;
{plant.ail, plant.elev, plant.rud, plant.thr} = actuatorCommand;
time_s = time;
position_m = plant.position;
euler_rad = Vehicles.Interfaces.eulerFromQuaternion(plant.quat);
airspeed_m_s = plant.airspeed;
end TakeoffOpenLoop;