How to customize response CRTPpackets?
Posted: Fri Oct 09, 2015 5:50 pm
Hi,
I want to calculate the motorratios on the client. Therefor I have to get the gyro data and euler-angles. Ideally I send the motorratios to the crazyflie and the response (I think there is one?) contains the data I'm interested in. But I'm not sure where I have to make the adjustments. So can you pls tell me if my understanding of the communication is right? Or tell me how to customize the response if I'm totally wrong...
crtpRxTask manages the received packets. "link->receivePacket" fetches a new packet. I don't really know what "if(queues[p.port]" checks!? But if it is successfull the packet gets pushed in the send-queue? So before this instruction I have to check if p.port equals 3 (= commands port) and if necessary update the packet with my data?
Thanks for any hints
crazyguy
I want to calculate the motorratios on the client. Therefor I have to get the gyro data and euler-angles. Ideally I send the motorratios to the crazyflie and the response (I think there is one?) contains the data I'm interested in. But I'm not sure where I have to make the adjustments. So can you pls tell me if my understanding of the communication is right? Or tell me how to customize the response if I'm totally wrong...

crtpRxTask manages the received packets. "link->receivePacket" fetches a new packet. I don't really know what "if(queues[p.port]" checks!? But if it is successfull the packet gets pushed in the send-queue? So before this instruction I have to check if p.port equals 3 (= commands port) and if necessary update the packet with my data?
Thanks for any hints

crazyguy
Code: Select all
void crtpRxTask(void *param)
{
CRTPPacket p;
static unsigned int droppedPacket=0;
while (TRUE)
{
if (!link->receivePacket(&p))
{
if(queues[p.port])
{
// TODO: If full, remove one packet and then send
xQueueSend(queues[p.port], &p, 0);
}
else
{
droppedPacket++;
}
if(callbacks[p.port])
callbacks[p.port](&p); //Dangerous?
}
}
}