mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-30 08:24:11 +01:00
Enable guidance on simulation and add wind model
This commit is contained in:
parent
fdfaac6559
commit
df6bc4deff
@ -380,6 +380,11 @@ static void simulateModelQuadcopter()
|
||||
AttitudeActualSet(&attitudeActual);
|
||||
}
|
||||
|
||||
static float wind[3] = {0,0,0};
|
||||
wind[0] = wind[0] * 0.95 + rand_gauss();
|
||||
wind[1] = wind[1] * 0.95 + rand_gauss();
|
||||
wind[2] = wind[2] * 0.95 + rand_gauss();
|
||||
|
||||
Quaternion2R(q,Rbe);
|
||||
// Make thrust negative as down is positive
|
||||
ned_accel[0] = -thrust * Rbe[2][0];
|
||||
@ -388,9 +393,9 @@ static void simulateModelQuadcopter()
|
||||
ned_accel[2] = -thrust * Rbe[2][2] + 9.81;
|
||||
|
||||
// Apply acceleration based on velocity
|
||||
ned_accel[0] -= K_FRICTION * vel[0];
|
||||
ned_accel[1] -= K_FRICTION * vel[1];
|
||||
ned_accel[2] -= K_FRICTION * vel[2];
|
||||
ned_accel[0] -= K_FRICTION * (vel[0] - wind[0]);
|
||||
ned_accel[1] -= K_FRICTION * (vel[1] - wind[0]);
|
||||
ned_accel[2] -= K_FRICTION * (vel[2] - wind[0]);
|
||||
|
||||
// Predict the velocity forward in time
|
||||
vel[0] = vel[0] + ned_accel[0] * dT;
|
||||
|
@ -55,6 +55,7 @@ USE_THUMB_MODE = YES
|
||||
# List of modules to include
|
||||
MODULES = Telemetry
|
||||
MODULES += Actuator ManualControl Stabilization
|
||||
MODULES += AltitudeHold Guidance
|
||||
MODULES += Attitude/revolution
|
||||
#MODULES += SimulatedAttitude
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user