pathfinder-for-autonomous-navigation / psim

Six DOF flight simulator and related GNC implementations.
MIT License
4 stars 6 forks source link

Create MEX Functions for the Pointing Controller #160

Closed kylekrol closed 3 years ago

kylekrol commented 4 years ago

Create a MEX wrapper for the attitude pointing controller.

The current pointing controller interface is defined in include/gnc/attitude_controller.hpp and is given below:

struct PointingControllerState {
  /** Defaults everything's value to NaN. */
  PointingControllerState();
};

struct PointingControllerData {
  lin::Vector3f primary_desired;
  lin::Vector3f primary_current;
  lin::Vector3f secondary_desired;
  lin::Vector3f secondary_current;
  lin::Vector3f w_wheels;
  lin::Vector3f w_sat;
  lin::Vector3f b;
  /** Defaults everything's value to NaN. */
  PointingControllerData();
};

struct PointingActuation {
  lin::Vector3f mtr_body_cmd;
  lin::Vector3f rwa_body_cmd;
  /** Defaults everything's value to NaN. */
  PointingActuation();
};

void mex_control_pointing(control_pointing(PointingControllerState &state,
    PointingControllerData const &data, PointingActuation &actuation, float Kp,
    float Kd, lin::Matrix3x3f const &J);

We'll need this to be wrapped in a MATLAB function with the following interface:

function pointer = make_mex_pointer()
pointer = struct()
pointer.control = @control;
end

function [mtr_body_cmd, rwa_body_cmd] = control(...
    primary_desired, primary_current,...
    secondary_desired, secondary_current,...
    w_wheels, w_body, b_body, Kp, Kd, J) ... end
kylekrol commented 3 years ago

Closing in favor of C++ psim.