landingPIDController

LandingController is a PID oriented controller, it contains methods that will guide your rocket during the powered landing maneuver. During the final descent landingController will perform course corrections to mitigate error. Because it’s PID oriented, when properly tuned it can get extremely accurate.

Table of contents:

Contructing

parameters type default Description
ldata landingDataModel - landingDataModel constructed with desired landing position
hslam hoverSlamModel - hoverSlamModel object
Kp float - proportional response
Ki* float 0 integral response
Kd* float 0 derivative response
minOut* float -10 minimal PID output(basically aoa difference)
maxOut* float 10 maximal PID output(aoa difference)

* optional parameters

Public methods

public methods return type Description
getSteering() Direction returns steering direction
getThrottle() Float returns throttle precentage
completed() Boolean is the ship landed or splashed?
passControl(bool) None passes control

getSteering()

No parameters

Returns steering direction.


getThrottle()

No parameters

Returns throttle percentage. Uses hoverSlamModel to calculate throttle.


completed()

No parameters

By default returns true if the ship is splashed or landed.


passControl(bool)

Parameters:

  • isUnlocking::Boolean -> should throttle and steering be unlocked?

Takes control over both steering and throttle until completed() returns true.


Code examples


local hoverslam is hoverSlamModel(15). // 15 is height of the rocket
local landing is landingPIDController(hoverslam, 12000, 0, 500, -5, 5).

// Passing control
landing["passControl"]().
local hoverslam is hoverSlamModel(15). // 15 is height of the rocket
local landing is landingPIDController(hoverslam, 10000).

// Passing control
lock steering to landing["getSteering"]().
lock throttle to landing["getThrottle"]().

wait until landing["completed"]().