mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-11 19:24:10 +01:00
Bring back the original module files and remove comments from FreeRTOS
debugging
This commit is contained in:
parent
82a2987b2c
commit
6df9691609
@ -209,15 +209,6 @@ static void AttitudeTask(void *parameters)
|
|||||||
first_run = true;
|
first_run = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int i;
|
|
||||||
static uint32_t last_time;
|
|
||||||
i++;
|
|
||||||
if (i % 5000 == 0) {
|
|
||||||
float dT = PIOS_DELAY_DiffuS(last_time) / 10.0e6;
|
|
||||||
fprintf(stderr, "Attitude relative timing: %f\n", dT);
|
|
||||||
last_time = PIOS_DELAY_GetRaw();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This function blocks on data queue
|
// This function blocks on data queue
|
||||||
switch (revoSettings.FusionAlgorithm ) {
|
switch (revoSettings.FusionAlgorithm ) {
|
||||||
case REVOSETTINGS_FUSIONALGORITHM_COMPLIMENTARY:
|
case REVOSETTINGS_FUSIONALGORITHM_COMPLIMENTARY:
|
||||||
|
@ -138,8 +138,6 @@ MODULE_INITCALL(StabilizationInitialize, StabilizationStart)
|
|||||||
/**
|
/**
|
||||||
* Module task
|
* Module task
|
||||||
*/
|
*/
|
||||||
int stabilization_step;
|
|
||||||
int stabilization_count;
|
|
||||||
static void stabilizationTask(void* parameters)
|
static void stabilizationTask(void* parameters)
|
||||||
{
|
{
|
||||||
UAVObjEvent ev;
|
UAVObjEvent ev;
|
||||||
@ -160,19 +158,6 @@ static void stabilizationTask(void* parameters)
|
|||||||
while(1) {
|
while(1) {
|
||||||
PIOS_WDG_UpdateFlag(PIOS_WDG_STABILIZATION);
|
PIOS_WDG_UpdateFlag(PIOS_WDG_STABILIZATION);
|
||||||
|
|
||||||
stabilization_step = 0;
|
|
||||||
stabilization_count ++;
|
|
||||||
static int i;
|
|
||||||
static uint32_t last_time;
|
|
||||||
i++;
|
|
||||||
if (i % 5000 == 0) {
|
|
||||||
float dT = PIOS_DELAY_DiffuS(last_time) / 10.0e6;
|
|
||||||
fprintf(stderr, "Stabilization relative timing: %f\n", dT);
|
|
||||||
last_time = PIOS_DELAY_GetRaw();
|
|
||||||
}
|
|
||||||
|
|
||||||
stabilization_step = 1;
|
|
||||||
|
|
||||||
// Wait until the AttitudeRaw object is updated, if a timeout then go to failsafe
|
// Wait until the AttitudeRaw object is updated, if a timeout then go to failsafe
|
||||||
if ( xQueueReceive(queue, &ev, FAILSAFE_TIMEOUT_MS / portTICK_RATE_MS) != pdTRUE )
|
if ( xQueueReceive(queue, &ev, FAILSAFE_TIMEOUT_MS / portTICK_RATE_MS) != pdTRUE )
|
||||||
{
|
{
|
||||||
@ -180,8 +165,6 @@ static void stabilizationTask(void* parameters)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
stabilization_step = 2;
|
|
||||||
|
|
||||||
dT = PIOS_DELAY_DiffuS(timeval) * 1.0e-6f;
|
dT = PIOS_DELAY_DiffuS(timeval) * 1.0e-6f;
|
||||||
timeval = PIOS_DELAY_GetRaw();
|
timeval = PIOS_DELAY_GetRaw();
|
||||||
|
|
||||||
@ -190,8 +173,6 @@ static void stabilizationTask(void* parameters)
|
|||||||
AttitudeActualGet(&attitudeActual);
|
AttitudeActualGet(&attitudeActual);
|
||||||
GyrosGet(&gyrosData);
|
GyrosGet(&gyrosData);
|
||||||
|
|
||||||
stabilization_step = 3;
|
|
||||||
|
|
||||||
#if defined(DIAGNOSTICS)
|
#if defined(DIAGNOSTICS)
|
||||||
RateDesiredGet(&rateDesired);
|
RateDesiredGet(&rateDesired);
|
||||||
#endif
|
#endif
|
||||||
@ -203,8 +184,6 @@ static void stabilizationTask(void* parameters)
|
|||||||
float q_error[4];
|
float q_error[4];
|
||||||
float local_error[3];
|
float local_error[3];
|
||||||
|
|
||||||
stabilization_step = 4;
|
|
||||||
|
|
||||||
// Essentially zero errors for anything in rate or none
|
// Essentially zero errors for anything in rate or none
|
||||||
if(stabDesired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_ROLL] == STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE)
|
if(stabDesired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_ROLL] == STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE)
|
||||||
rpy_desired[0] = stabDesired.Roll;
|
rpy_desired[0] = stabDesired.Roll;
|
||||||
@ -227,8 +206,6 @@ static void stabilizationTask(void* parameters)
|
|||||||
quat_inverse(q_error);
|
quat_inverse(q_error);
|
||||||
Quaternion2RPY(q_error, local_error);
|
Quaternion2RPY(q_error, local_error);
|
||||||
|
|
||||||
stabilization_step = 5;
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Simpler algorithm for CC, less memory
|
// Simpler algorithm for CC, less memory
|
||||||
float local_error[3] = {stabDesired.Roll - attitudeActual.Roll,
|
float local_error[3] = {stabDesired.Roll - attitudeActual.Roll,
|
||||||
@ -246,8 +223,6 @@ static void stabilizationTask(void* parameters)
|
|||||||
float *actuatorDesiredAxis = &actuatorDesired.Roll;
|
float *actuatorDesiredAxis = &actuatorDesired.Roll;
|
||||||
float *rateDesiredAxis = &rateDesired.Roll;
|
float *rateDesiredAxis = &rateDesired.Roll;
|
||||||
|
|
||||||
stabilization_step = 6;
|
|
||||||
|
|
||||||
//Calculate desired rate
|
//Calculate desired rate
|
||||||
for(uint8_t i=0; i< MAX_AXES; i++)
|
for(uint8_t i=0; i< MAX_AXES; i++)
|
||||||
{
|
{
|
||||||
@ -314,8 +289,6 @@ static void stabilizationTask(void* parameters)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stabilization_step = 7;
|
|
||||||
|
|
||||||
uint8_t shouldUpdate = 1;
|
uint8_t shouldUpdate = 1;
|
||||||
#if defined(DIAGNOSTICS)
|
#if defined(DIAGNOSTICS)
|
||||||
RateDesiredSet(&rateDesired);
|
RateDesiredSet(&rateDesired);
|
||||||
@ -362,8 +335,6 @@ static void stabilizationTask(void* parameters)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stabilization_step = 8;
|
|
||||||
|
|
||||||
// Save dT
|
// Save dT
|
||||||
actuatorDesired.UpdateTime = dT * 1000;
|
actuatorDesired.UpdateTime = dT * 1000;
|
||||||
|
|
||||||
@ -378,8 +349,6 @@ static void stabilizationTask(void* parameters)
|
|||||||
ActuatorDesiredSet(&actuatorDesired);
|
ActuatorDesiredSet(&actuatorDesired);
|
||||||
}
|
}
|
||||||
|
|
||||||
stabilization_step = 9;
|
|
||||||
|
|
||||||
if(flightStatus.Armed != FLIGHTSTATUS_ARMED_ARMED ||
|
if(flightStatus.Armed != FLIGHTSTATUS_ARMED_ARMED ||
|
||||||
(lowThrottleZeroIntegral && stabDesired.Throttle < 0) ||
|
(lowThrottleZeroIntegral && stabDesired.Throttle < 0) ||
|
||||||
!shouldUpdate)
|
!shouldUpdate)
|
||||||
@ -387,7 +356,6 @@ static void stabilizationTask(void* parameters)
|
|||||||
ZeroPids();
|
ZeroPids();
|
||||||
}
|
}
|
||||||
|
|
||||||
stabilization_step = 10;
|
|
||||||
|
|
||||||
// Clear alarms
|
// Clear alarms
|
||||||
AlarmsClear(SYSTEMALARMS_ALARM_STABILIZATION);
|
AlarmsClear(SYSTEMALARMS_ALARM_STABILIZATION);
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
#include "taskmonitor.h"
|
#include "taskmonitor.h"
|
||||||
|
|
||||||
// Private constants
|
// Private constants
|
||||||
#define SYSTEM_UPDATE_PERIOD_MS 5000
|
#define SYSTEM_UPDATE_PERIOD_MS 1000
|
||||||
#define LED_BLINK_RATE_HZ 5
|
#define LED_BLINK_RATE_HZ 5
|
||||||
|
|
||||||
#ifndef IDLE_COUNTS_PER_SEC_AT_NO_LOAD
|
#ifndef IDLE_COUNTS_PER_SEC_AT_NO_LOAD
|
||||||
@ -197,7 +197,7 @@ static void systemTask(void *parameters)
|
|||||||
if(flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED) {
|
if(flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED) {
|
||||||
vTaskDelayUntil(&lastSysTime, SYSTEM_UPDATE_PERIOD_MS / portTICK_RATE_MS / (LED_BLINK_RATE_HZ * 2) );
|
vTaskDelayUntil(&lastSysTime, SYSTEM_UPDATE_PERIOD_MS / portTICK_RATE_MS / (LED_BLINK_RATE_HZ * 2) );
|
||||||
} else {
|
} else {
|
||||||
vTaskDelayUntil(&lastSysTime, 50); //SYSTEM_UPDATE_PERIOD_MS / portTICK_RATE_MS);
|
vTaskDelayUntil(&lastSysTime, SYSTEM_UPDATE_PERIOD_MS / portTICK_RATE_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,6 @@ static void telemetryTxTask(void *parameters)
|
|||||||
while (1) {
|
while (1) {
|
||||||
// Wait for queue message
|
// Wait for queue message
|
||||||
if (xQueueReceive(queue, &ev, portMAX_DELAY) == pdTRUE) {
|
if (xQueueReceive(queue, &ev, portMAX_DELAY) == pdTRUE) {
|
||||||
//fprintf(stderr,".");
|
|
||||||
// Process event
|
// Process event
|
||||||
processObjEvent(&ev);
|
processObjEvent(&ev);
|
||||||
}
|
}
|
||||||
@ -293,8 +292,6 @@ static void telemetryTxPriTask(void *parameters)
|
|||||||
while (1) {
|
while (1) {
|
||||||
// Wait for queue message
|
// Wait for queue message
|
||||||
if (xQueueReceive(priorityQueue, &ev, portMAX_DELAY) == pdTRUE) {
|
if (xQueueReceive(priorityQueue, &ev, portMAX_DELAY) == pdTRUE) {
|
||||||
//fprintf(stderr,"*");
|
|
||||||
|
|
||||||
// Process event
|
// Process event
|
||||||
processObjEvent(&ev);
|
processObjEvent(&ev);
|
||||||
}
|
}
|
||||||
@ -311,7 +308,6 @@ static void telemetryRxTask(void *parameters)
|
|||||||
|
|
||||||
// Task loop
|
// Task loop
|
||||||
while (1) {
|
while (1) {
|
||||||
//fprintf(stderr,"-");
|
|
||||||
#if defined(PIOS_INCLUDE_USB)
|
#if defined(PIOS_INCLUDE_USB)
|
||||||
// Determine input port (USB takes priority over telemetry port)
|
// Determine input port (USB takes priority over telemetry port)
|
||||||
if (PIOS_USB_CheckAvailable(0) && PIOS_COM_TELEM_USB) {
|
if (PIOS_USB_CheckAvailable(0) && PIOS_COM_TELEM_USB) {
|
||||||
|
@ -288,7 +288,6 @@ static void eventTask()
|
|||||||
{
|
{
|
||||||
// Calculate delay time
|
// Calculate delay time
|
||||||
delayMs = timeToNextUpdateMs-(xTaskGetTickCount()*portTICK_RATE_MS);
|
delayMs = timeToNextUpdateMs-(xTaskGetTickCount()*portTICK_RATE_MS);
|
||||||
//fprintf(stderr,"eventDispatcher %d\n", delayMs);
|
|
||||||
if (delayMs < 0)
|
if (delayMs < 0)
|
||||||
{
|
{
|
||||||
delayMs = 0;
|
delayMs = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user