Profile image

Mecha Flight Control System Test V2

108k hpgbproductions  4.6 years ago
Auto Credit Based on hpgbproductions's flight control unit test

FCS Ver2 (requires SP1.9.205)

[Update] Notice2004021303+8: The Propulsion Unit Rotator has been updated. You will need to copy and paste the new code into your game.

[Update] Notice2004042054+8: The Propulsion Main Engine has been updated. You will need to modify its attributes. Suggested values: InputController/max: 0.01->0.05; Engine/powerMultiplier: 100->10.

[Update] Notice2004042054+8: The cockpit may not be exactly centered along the Z axis. Ensure that the cockpit's position along the Z axis is the same as the exterior red fuselage block (0). This will fix unwanted pitching if the Propulsion Main Engine and any Vertical Speed Controller(s) are engaged at the same time.

Experiment: To achieve an arcade mecha-style flight model
Test Body: Dead Meme
Results: Success with drawbacks

Pros:
- Speed control
- Yaw rate control
- Vertical speed control

Cons:
- Issues with start-stop action
- Not perfect heading hold (old version suffers this too)

Works with PID controller functions, but they don't seem too reliable, and I don't fully understand them either.

CONTROLS

Pitch - Strafe Forward/Backward
Roll - Strafe Sideways
Yaw - Rotate Horizontally
VTOL - Set Vertical Speed
AG8 - Master Switch

COMPONENTS

Propulsion Unit Rotator
atan(Pitch/Roll)/90 + ((Roll<0) ? 2 : 0) + ((Roll>=0 & Pitch<0) ? 4 : 0) -1 (old)
Rotates the horizontal propulsion engine and automatic airbrake around the vertical axis. It takes the ratio of Pitch to Roll as rectangular coordinates and finds the Theta component of the corresponding polar coordinate.
However, this system has a delay, causes inaccuracies in flight, and induces a moderate amount of horizontal torque despite being massless. I was unable to make it work with PID() so the pilot must manually adjust for existing velocities when turning. +Video
Roll=0 ? (Pitch>=0 ? 0 : 2) : ((atan(Pitch/Roll)/90) + ((Roll<0) ? 2 : 0) + ((Roll>=0 & Pitch<0) ? 4 : 0) -1) (updated)
This version resolves the NaN issue but I still could not get it to work with PID(). You will need to copy and paste this into the rotator to use it.
If you want to use PID(), here's a process variable, getting close, but still does not work with PID():
(-AngleOfSlip/90<-1) ? (-AngleOfSlip/90 +4) : (-AngleOfSlip/90)

Propulsion Main Engine
clamp01(PID(sqrt(pow(Pitch,2)+pow(Roll,2)), GS/60, 100, 1, 1))
Maintains a set speed by varying engine throttle, taking the values of Pitch and Roll as rectangular coordinates, and converting them to find the magnitude of the corresponding polar coordinate. A method using Rate(Altitude) to ignore the vertical component of the speed could be used, but it does not seem to work, and causes additional complexity. Plus, the airspeed remains constant using this method anyway, which might be more realistic.
Decreasing max and increasing powerMultiplier attributes increases engine responsiveness.

Automatic Airbrake
sqrt(pow(Pitch,2)+pow(Roll,2))<0.05 ? 1 : 0
Automatically slows down the aircraft when the combined strafe input is too small.

Gyroscope Yaw Controller
clamp(PID(Yaw, YawRate/200, 1, 0.05, 0.03), -1, 1)
Maintains a set yaw rate. Not too useful for holding the craft at a specific heading; part of the original plan was to use smooth() to store a heading value, but the method was unreliable.

Vertical Speed Controller
clamp01(PID(VTOL, rate(Altitude)/70, 1000, 1, 1)) (upward)
clamp01(PID(-VTOL, -rate(Altitude)/70, 1000, 1, 1)) (downward)
Maintains a set vertical speed. However, even if VTOL is zero, the craft still descends slowly. Increasing the proportional gain of the PID() reduces this, perhaps it could be increased more. I was unable to include a ground proximity safety feature.

Issues with Funky Trees:
- When working with setpoints and process variables that can produce NaN, PID() does not work, or often breaks. However, this is a normal occurence.
- Ternary operation functions are slow at switching modes.

Suggestions for Devs:
- Add the literal numeric value "NaN" that can be compared against using boolean operators..

General Characteristics

  • Predecessor flight control unit test
  • Created On Android
  • Wingspan 8.6ft (2.6m)
  • Length 6.4ft (2.0m)
  • Height 6.0ft (1.8m)
  • Empty Weight N/A
  • Loaded Weight 110lbs (50kg)

Performance

  • Power/Weight Ratio 91.743
  • Wing Loading 81.9lbs/ft2 (400.0kg/m2)
  • Wing Area 1.3ft2 (0.1m2)
  • Drag Points 8

Parts

  • Number of Parts 48
  • Control Surfaces 0
  • Performance Cost 138