anthonygardner / plant

0 stars 0 forks source link

Add `State` data type #7

Open anthonygardner opened 11 months ago

anthonygardner commented 11 months ago

I want to use a common datatype for every actor in a simulation, similar to Vector3f but with more entries:

enum AltType { 
    HeightAboveGeoid,
    HeightAboveEllipsoid,
    MeanSeaLevel
};

enum ReferenceFrame { 
    EarthCenteredInertial,
    EarthCenteredEarthFixed,
    EastNorthUp,
    NorthEastDown,
    Body
};

typedef struct {
    float lat;
    float lon;
    float alt;
    AltType alt_type;
} LatLonAlt;

typedef struct {
    float x;
    float y;
    float z;
    ReferenceFrame rf;
} CartPos;

typedef struct {
    float vx;
    float vy;
    float vz;
    ReferenceFrame rf;
} CartVel;

typedef struct {
    float ax;
    float ay;
    float az;
    ReferenceFrame rf;
} CartAcc;

typedef struct {
    float roll;
    float pitch;
    float yaw;
} AttRpy;

typedef struct {
    float w;
    float x;
    float y;
    float z;
} AttQuat;

typedef struct {
    CartPos p;
    CartVel v;
    CartAcc a;
    LatLonAlt lla;
    AttRpy rpy;
    AttQuat q;
} State;