1
0
mirror of https://gitlab.com/lander-team/lander-cpp.git synced 2025-07-24 23:21:29 +00:00

fixed, gonna make some more changes to make sure we're utilizing our whole burn

This commit is contained in:
bpmcgeeney
2021-11-08 14:43:52 -07:00
parent fe1a5b9bc0
commit 87fb8f8621
4 changed files with 70 additions and 71 deletions

View File

@@ -28,47 +28,47 @@ struct Vehicle {
double I11, I22, I33;
double I11dot, I22dot, I33dot;
int maxServo;
int maxServoRate;
double maxServo;
double maxServoRate;
double xServoDegs, yServoDegs;
double xServoDegsDot, yServoDegsDot;
double Kp, Ki, Kd;
double yError, yPrevError;
double pError, pPrevError;
double i_yError, i_pError = 0;
double i_yError, i_pError = 0.0;
double d_yError, d_pError;
double simTime;
int stepSize;
double stepSize;
int time = 0;
double time = 0.0;
};
void init_Vehicle(Vehicle &State) {
// PID Gains
State.Kp = -6.8699;
State.Ki = 0;
State.Ki = 0.0;
State.Kd = -0.775;
// Initial Velocity
State.vx = 0; // [m/s]
State.vy = 0; // [m/s]
State.vz = 0; // [m/s]
State.vx = 0.0; // [m/s]
State.vy = 0.0; // [m/s]
State.vz = 0.0; // [m/s]
// Initial YPR
State.yaw = 45 * M_PI / 180; // [rad]
State.pitch = 45 * M_PI / 180; // [rad]
State.roll = 0 * M_PI / 180; // [rad]
State.yaw = 45.0 * M_PI / 180.0; // [rad]
State.pitch = 45.0 * M_PI / 180.0; // [rad]
State.roll = 0.0 * M_PI / 180.0; // [rad]
// Initial YPRdot
State.yawdot = 1 * M_PI / 180; // [rad/s]
State.pitchdot = -1 * M_PI / 180; // [rad/s]
State.rolldot = 0 * M_PI / 180; // [rad/s]
State.yawdot = 1.0 * M_PI / 180.0; // [rad/s]
State.pitchdot = -1.0 * M_PI / 180.0; // [rad/s]
State.rolldot = 0.0 * M_PI / 180.0; // [rad/s]
// Servo Limitation
State.maxServo = 7; // [degs]
State.maxServoRate = 360; // [degs/sec]
State.maxServo = 7.0; // [degs]
State.maxServoRate = 360.0; // [degs/sec]
// Vehicle Properties
State.massInitial = 1.2; // [kg]
@@ -77,7 +77,7 @@ void init_Vehicle(Vehicle &State) {
State.momentArm = 0.145; // [m]
// Sim Step Size
State.stepSize = 1; // [ms]
State.stepSize = 1.0; // [ms]
// Other Properties
State.massPropellant = 0.06; // [kg]