I saw the test example and added a new test.
After uploading the code, there was no response in the result window.
I simply wanted to make sure that the rtos worked internally.
We raised the rots priority from 1 to 4 in the example, but the results were the same.
Did anyone succeed in this example?
task not working
Re: task not working
You need to be more specific in your forum question. Which example task are you referring to? Provide links to it as well.
Something that I can already see, is that there are no delays in your while loop. Add delays with vTaskDelay().
Also, if you want to test out freertos, you can also experiment with the applayer. We are providing examples in the crazyflie firmware repo as well.
Something that I can already see, is that there are no delays in your while loop. Add delays with vTaskDelay().
Also, if you want to test out freertos, you can also experiment with the applayer. We are providing examples in the crazyflie firmware repo as well.
Re: task not working
Hi! I'm so sorry but I accidentally removed your last post (I wanted to remove the one with the 'i' only). It's very difficult to restore it... was your situation solved? Maybe best if it is another issue to start another thread.
Very sorry about this again.
Very sorry about this again.
Re: task not working
Fortunately, I solved the first problem, but I thought it was not a perfect solution, so I asked again.
The new problem is that rtos affects the task of the existing stabilizer.
After adding a new task, the console results show the following:
I think it's because of the delay inside new task.
I used but the internal delay time was reduced and the console output cycle became longer.
Q : How long is it not affecting the existing tasks when creating a new task?
The new problem is that rtos affects the task of the existing stabilizer.
After adding a new task, the console results show the following:
Code: Select all
ESTKALMAN: State out of bounds, resetting
I used
Code: Select all
vTaskDelay(M2T(160);
Q : How long is it not affecting the existing tasks when creating a new task?
-
- Bitcraze
- Posts: 630
- Joined: Tue Jun 30, 2015 7:47 am
Re: task not working
I assume you are referring to this example https://www.bitcraze.io/documentation/r ... ystemtask/
It is unfortunately hard to provide any help without your code.
A delay in a task is actually a good thing, it means that you hand the CPU back to the system and let other tasks execute. You can read more about FreeRTOS tasks here https://www.freertos.org/taskandcr.html
Simply means that the position (state) estimator has drifted off to some improbable position and is reset. This happens if there is no good positioning information, for instance if you have a lighthouse deck mounted but no base stations running. It is probably not related to your new task.ESTKALMAN: State out of bounds, resetting
In most cases your task should run at level 1 (of course depending on what you want to achieve), on higher priorities there is a risk you disrupt sensor readings and other time critical functionality. A task on level 1 should get around half of the CPU if you are using the lighthouse system so you should get plenty of execution time.We raised the rots priority from 1 to 4 in the example, but the results were the same.
It is unfortunately hard to provide any help without your code.
A delay in a task is actually a good thing, it means that you hand the CPU back to the system and let other tasks execute. You can read more about FreeRTOS tasks here https://www.freertos.org/taskandcr.html
Re: task not working
Code: Select all
#include "config.h"
#include "debug.h"
#include "FreeRTOS.h"
#include "queue.h"
#include "static_mem.h"
#include "task.h"
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include "radiolink.h"
#include "configblock.h"
#include "log.h"
#include "stabilizer_types.h"
static xQueueHandle inputQueue;
STATIC_MEM_QUEUE_ALLOC(inputQueue, 1, sizeof(int));
static void P2PTask(void*);
static void P2PTaskEnqueueInput(int value);
STATIC_MEM_TASK_ALLOC(P2PTask, P2P_TASK_STACKSIZE);
static bool isInit = false;
static P2PPacket Master_state;
void P2PTaskInit() {
inputQueue = STATIC_MEM_QUEUE_CREATE(inputQueue);
STATIC_MEM_TASK_CREATE(P2PTask, P2PTask, P2P_TASK_NAME, NULL, P2P_TASK_PRI);
isInit = true;
}
bool P2PTaskTest() {
return isInit;
}
void master_com()
{
Master_state.port=0x00;
Master_state.data[0] = 1;
Master_state.data[1] = 2;
Master_state.data[2] = 3;
Master_state.size=3;
radiolinkSendP2PPacketBroadcast(&Master_state);
}
static void P2PTask(void* parameters) {
DEBUG_PRINT("\nExample task main function is running!\n\n");
/* Master_state.port=0x00;
Master_state.data[0] = 1;
Master_state.data[1] = 2;
Master_state.data[2] = 3;
Master_state.size=3;*/
while (true) {
uint16_t input;
P2PTaskEnqueueInput(input);
if (pdTRUE == xQueueReceive(inputQueue, &input, portMAX_DELAY)) {
master_com();
}
}
}
void P2PTaskEnqueueInput(int value) {
xQueueOverwrite(inputQueue, &value);
}
No additional delay was used, and the portMax_Delay of xQueueReceive inside the 'while' phrase is the only delay function.
As a result of P2P communication using this, two drones were able to communicate properly.
I would like to use vTaskDelayUntil to ensure P2P performance while performing additional operations inside this file.
I want to compute data while ensuring the stability of communication because I am aiming for multi-communication of multiple drones and also for flight control through data exchange.
Of course, I don't think the computation process takes a lot of time, but I want to make sure about this, so I leave a question.
Knowing this result will be very helpful not only for my experiment but also for creating other tasks.
Assuming that there is no additional computation, the code above works perfectly and normally.