1
0
mirror of https://gitlab.com/lander-team/lander-cpp.git synced 2025-06-16 15:17:23 +00:00

changed up vehicle dynamics in accordance with simulink changes

This commit is contained in:
bpmcgeeney 2021-09-20 11:35:11 -07:00
parent 768bcb7964
commit 382566a8da
3 changed files with 15 additions and 9 deletions

View File

@ -313,12 +313,18 @@ void vehicleDynamics(Vehicle &State, Vehicle &PrevState, int t) {
State.rolldot = integral(State.rollddot, PrevState.rolldot, State.stepSize); State.rolldot = integral(State.rollddot, PrevState.rolldot, State.stepSize);
// ax ay az // ax ay az
State.ax = (State.Fx / State.mass) + State.ax =
(State.pitchdot * State.vz - State.rolldot * State.vy); (State.Fx /
State.ay = (State.Fy / State.mass) + State.mass); // +
(State.rolldot * State.vx - State.vz * State.yawdot); //(State.pitchdot * State.vz - State.rolldot * State.vy);
State.az = (State.Fz / State.mass) + State.ay =
(State.vy * State.yawdot - State.pitchdot * State.vx); (State.Fy /
State.mass); // +
//(State.rolldot * State.vx - State.vz * State.yawdot);
State.az =
(State.Fz /
State.mass); // +
//(State.vy * State.yawdot - State.pitchdot * State.vx);
// vx vy vz in Body frame // vx vy vz in Body frame
State.vx = integral(State.ax, PrevState.vx, State.stepSize); State.vx = integral(State.ax, PrevState.vx, State.stepSize);

View File

@ -16,5 +16,5 @@ Vehicle Radius,0.05,m
Moment Arm,0.15,m Moment Arm,0.15,m
Sim Step Size,1,ms Sim Step Size,1,ms
Kp,-0.1,x Kp,-0.1,x
Ki,0.1, x Ki,0, x
Kd,-0.5, x Kd,0, x

1 vx 0 m/s
16 Moment Arm 0.15 m
17 Sim Step Size 1 ms
18 Kp -0.1 x
19 Ki 0.1 0 x
20 Kd -0.5 0 x

View File

@ -64,7 +64,7 @@ int main() {
// PID Gains // PID Gains
State.Kp = varValueVec[17]; State.Kp = varValueVec[17];
State.Ki = varValueVec[18]; State.Ki = varValueVec[18];
State.Kd = -1; State.Kd = varValueVec[19];
std::cout << State.Kd << "\n"; std::cout << State.Kd << "\n";