We are implementing a LQR controller in Gomboc and we are having issues transferring between a version in matlab, working with a simplified model with the ABCD matrices, and the full model in Gomboc. Is it possible to access Gomboc dynamic equations to adapt the state matrices in matlab accordingly and so find the correct gain matrix?
You can actually access the ABCD matrices for any equilibrium points using the ‘linearise’ function in the Gomboc console. This function computes a continuous, time-invariant state space representation of the model linearised about the current state.
The state space model has following form:
dxdt = A*x + B*u
y = C*x + D*u
The model should be at equilibrium (ie. the state derivatives must be zero)
Options can be specified in the options object. The options are automatically initialised to sensible defaults. Available options are:
– model : The block container of the model. All names are relative to this container (default: “Boat”)
– pert : Perturbation epsilon that is used for linearisation (default 1e-6)
– xNames : Names of the system states (must be names of Gomboc integrator states, ie. Gomboc states with derivatives)
– uNames : Names of the system inputs (must be names of Gomboc states)
– yNames : Names of the system outputs (can be any block output name)
– printFormat : Defines how result is printed to console (undefined (don’t print), JSON, Matlab)
For more details about the implementation, the function implementation is available in “Runtime/Utils/Linearise.js”.
In order to output the returned objects, please use query(linearise()) in the console.