Seems to be a working with the barometer in the lab.
It looks like it could hold the altitude. Testing outside is needed to verify and tune.
This commit is contained in:
parent
f49548d141
commit
38486e2bd3
@ -20,6 +20,7 @@
|
|||||||
#include "drivers/failsafe_toggles.h"
|
#include "drivers/failsafe_toggles.h"
|
||||||
#include "drivers/motormix.h"
|
#include "drivers/motormix.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include "drivers/barometer.h"
|
||||||
|
|
||||||
|
|
||||||
#define PTERM_SCALE 0.032029f /*P-term used as a scale value to the PID controller*/
|
#define PTERM_SCALE 0.032029f /*P-term used as a scale value to the PID controller*/
|
||||||
@ -112,7 +113,7 @@ void getCurrentValues(float sensorValues[3], uint8_t ID_profile)
|
|||||||
break;
|
break;
|
||||||
case PID_ID_BAROMETER:
|
case PID_ID_BAROMETER:
|
||||||
|
|
||||||
sensorValues[0] = barometer_GetCurrentAveragedtAltitude();
|
sensorValues[0] = barometer_GetCurrentAveragedtAltitude()*20;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
@ -173,7 +174,7 @@ void getPointRate(float *desiredCommand, uint8_t ID_profile)
|
|||||||
|
|
||||||
//desiredCommand[THROTTLE] = convertData(RADIO_RANGE, BAROMETER_RANGE, 0, rc_input.Throttle*throttleRate);
|
//desiredCommand[THROTTLE] = convertData(RADIO_RANGE, BAROMETER_RANGE, 0, rc_input.Throttle*throttleRate);
|
||||||
|
|
||||||
desiredCommand[THROTTLE] = 1.9;
|
desiredCommand[THROTTLE] = 1*20;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -496,7 +497,7 @@ void pidUAVInit(pidProfile_t *pidProfile, uint8_t ID)
|
|||||||
|
|
||||||
PidProfile[ID].pidEnabled = false;
|
PidProfile[ID].pidEnabled = false;
|
||||||
PidProfile[ID].dterm_lpf = 90;
|
PidProfile[ID].dterm_lpf = 90;
|
||||||
PidProfile[ID].pid_out_limit = 1000;
|
PidProfile[ID].pid_out_limit = 2000;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -527,7 +528,7 @@ void pidInit()
|
|||||||
|
|
||||||
void pidEproom(void)
|
void pidEproom(void)
|
||||||
{
|
{
|
||||||
PidProfile[PID_ID_BAROMETER].PIDweight[ROLL] = 200;
|
PidProfile[PID_ID_BAROMETER].PIDweight[ROLL] = 254;
|
||||||
|
|
||||||
PidProfile[PID_ID_ACCELEROMETER].PIDweight[YAW] = 100;
|
PidProfile[PID_ID_ACCELEROMETER].PIDweight[YAW] = 100;
|
||||||
|
|
||||||
|
@ -512,7 +512,8 @@ float barometer_GetCurrentAveragedtAltitude()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return the average of the stored values */
|
/* Return the average of the stored values */
|
||||||
return toReturn/averageAltitudeCount;
|
toReturn = toReturn/averageAltitudeCount;
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +103,12 @@ void mix()
|
|||||||
int16_t RPY_Mix[MOTOR_COUNT]; // Roll Pitch and Yaw variables array
|
int16_t RPY_Mix[MOTOR_COUNT]; // Roll Pitch and Yaw variables array
|
||||||
int16_t RPY_Mix_Min = 0; // Stores the minimum desired command for any motor
|
int16_t RPY_Mix_Min = 0; // Stores the minimum desired command for any motor
|
||||||
int16_t RPY_Mix_Max = 0; // Maximum desired command for any motor
|
int16_t RPY_Mix_Max = 0; // Maximum desired command for any motor
|
||||||
int16_t throttle = PidProfile[PID_ID_BAROMETER].PID_Out[THROTTLE]; // Import throttle value from remote
|
int16_t throttle = PidProfile[PID_ID_BAROMETER].PID_Out[THROTTLE];
|
||||||
|
|
||||||
|
if (PidProfile[PID_ID_BAROMETER].pidEnabled && flags_IsSet_ID(systemFlags_flightmode_barometer_id))
|
||||||
|
{
|
||||||
|
throttle += 1482;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Mixer Full Scale enabled */
|
/* Mixer Full Scale enabled */
|
||||||
|
Reference in New Issue
Block a user