From ecf988d564441203a28c119bb91130a347a9a237 Mon Sep 17 00:00:00 2001 From: crglick <crglick@iastate.edu> Date: Sun, 27 Mar 2022 20:11:46 +0200 Subject: [PATCH] crazyflie groundstation, slowed down comm and increased num of pending responses allowed --- crazyflie_groundstation/src/ccrazyflie/CCrazyflie.cpp | 10 +--------- .../src/ccrazyradio/CCrazyRadio_loopFuncs.cpp | 2 +- crazyflie_groundstation/src/userInput.cpp | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/crazyflie_groundstation/src/ccrazyflie/CCrazyflie.cpp b/crazyflie_groundstation/src/ccrazyflie/CCrazyflie.cpp index 5486bc4db..c03a37a5a 100644 --- a/crazyflie_groundstation/src/ccrazyflie/CCrazyflie.cpp +++ b/crazyflie_groundstation/src/ccrazyflie/CCrazyflie.cpp @@ -32,8 +32,6 @@ #include <pthread.h> #include "CCrazyflie.h" #include "CCrazyRadio.h" - -int everyX = 0; CCrazyflie::CCrazyflie(CCrazyRadio *crRadio, int nRadioChannel, XferRate dataRate, int quadNum, double startTime) { m_quadNum = quadNum; @@ -351,13 +349,7 @@ bool CCrazyflie::cycle() { this->m_sendPosition = false; } else { // Send a dummy packet for keepalive otherwise - //TODO this is a hacky fix to limit amount of data sent, should use a timer instead - if(everyX >= 100){ - m_crRadio->sendDummyPacket(m_nRadioChannel, this); - everyX = 0; - }else{ - everyX++; - } + m_crRadio->sendDummyPacket(m_nRadioChannel, this); } diff --git a/crazyflie_groundstation/src/ccrazyradio/CCrazyRadio_loopFuncs.cpp b/crazyflie_groundstation/src/ccrazyradio/CCrazyRadio_loopFuncs.cpp index 0b6830a2c..bc1dbc1d6 100644 --- a/crazyflie_groundstation/src/ccrazyradio/CCrazyRadio_loopFuncs.cpp +++ b/crazyflie_groundstation/src/ccrazyradio/CCrazyRadio_loopFuncs.cpp @@ -23,7 +23,7 @@ void CCrazyRadio::mainLoop() { (*it)->writeLogData(); } - usleep(200); + usleep(1000); // Check if the thread has been told to terminate if (this->m_exitThread) { diff --git a/crazyflie_groundstation/src/userInput.cpp b/crazyflie_groundstation/src/userInput.cpp index bddd7fe76..84d95f710 100644 --- a/crazyflie_groundstation/src/userInput.cpp +++ b/crazyflie_groundstation/src/userInput.cpp @@ -43,7 +43,7 @@ int max_fd = 0; #define MAX_CLIENTS 32 #define CLIENT_BUFFER_SIZE 64 -#define CLIENT_MAX_PENDING_RESPONSES 15 +#define CLIENT_MAX_PENDING_RESPONSES 64 static struct command* client_buffers[MAX_CLIENTS][CLIENT_BUFFER_SIZE]; static int client_fds[MAX_CLIENTS]; static int client_pending_responses[MAX_CLIENTS][CLIENT_MAX_PENDING_RESPONSES]; -- GitLab