diff --git a/crazyflie_groundstation/src/ccrazyflie/CCrazyflie.cpp b/crazyflie_groundstation/src/ccrazyflie/CCrazyflie.cpp index 5486bc4dbdb7225c9ff5b1a42f25f64d671ffc1a..c03a37a5a300c1ffb35e5b9d3cbfd8ac12e26c55 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 0b6830a2cdd62a57a0cf27c9cfdb7648359c84e4..bc1dbc1d6d3748483dd1af5bccead90fc1607cc5 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 bddd7fe761174be08176d868823d065888140cb1..84d95f710196a452eeb25756fd69ae352ff6f72b 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]; diff --git a/groundStation/gui/MicroCART/mainwindow.cpp b/groundStation/gui/MicroCART/mainwindow.cpp index ce9bce105711f496c5f930726aee845c0aaef6e9..ff500b5289404633b52af7370c3717b1b94f74ed 100644 --- a/groundStation/gui/MicroCART/mainwindow.cpp +++ b/groundStation/gui/MicroCART/mainwindow.cpp @@ -198,7 +198,7 @@ MainWindow::MainWindow(QWidget *parent) : /* Start the things */ trackerTimer->start(100); - crazyflieTimer->start(100); + crazyflieTimer->start(300); //workerThread->start(); cwThread->start(); cfThread->start(); @@ -833,6 +833,7 @@ void MainWindow::on_applySetpointButton_clicked() emit(rateSetpointSignal(sp_roll, sp_pitch, sp_yaw, sp_thrust)); } + trigger_send_setpoint(); } @@ -851,6 +852,8 @@ void MainWindow::on_stopSetpointButton_clicked() //send as rate setpoint emit(rateSetpointSignal(sp_roll, sp_pitch, sp_yaw, sp_thrust)); } + + trigger_send_setpoint(); } void MainWindow::on_tActual_sliderMoved(int position) { @@ -978,6 +981,7 @@ void MainWindow::on_pb_configThrust_clicked() void MainWindow::on_rbManualSetpoint_toggled(bool checked) { if(checked) { + crazyflieTimer->start(300); //slower rate for manual setpoints emit(mixedSetpointSignal(0, 0, 0, 0)); emit(rateSetpointSignal(0, 0, 0, 0)); emit(angleSetpointSignal(0, 0, 0, 0)); @@ -1001,6 +1005,7 @@ void MainWindow::on_rbGamepadControl_toggled(bool checked) { if(checked){ + crazyflieTimer->start(100); //faster rate for gamepad ui->rollSetpointBox-> setEnabled(false); ui->pitchSetpointBox-> setEnabled(false); ui->yawSetpointBox-> setEnabled(false);