To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 482e180b authored by tiagos's avatar tiagos
Browse files

Cleaned up calibration process

parent 1a4113a8
......@@ -207,7 +207,7 @@ private:
void insert_or_update_entry_database(CrazyflieEntry entry);
void updateUWBSettings(bool enableChecked);
bool updateUWBSettings(bool enableChecked);
void updateAnchors(const Anchors* const a);
};
......
......@@ -996,26 +996,31 @@ void MainGUIWindow::on_load_from_DB_button_clicked()
}
}
void MainGUIWindow::updateUWBSettings(bool enableChecked)
bool MainGUIWindow::updateUWBSettings(bool enableChecked)
{
// Receive the updated information
Anchors a;
if(UWBServiceClient.call(a))
{
updateAnchors(&a);
if(!a.response.calSuccess)
return false;
updateAnchors(&a);
}
else
{
ui->checkBox_enable_UWB->setChecked(!enableChecked);
ROS_ERROR("[Teacher GUI] Could not update UWB Settings!");
return;
return false;
}
// Publish message that clients have to reload data from UWBManagerService
std_msgs::Int32 msg;
msg.data = 1;
UWBSettings_publisher.publish(msg);
return true;
}
void MainGUIWindow::updateAnchors(const Anchors* const a)
......@@ -1098,15 +1103,15 @@ void MainGUIWindow::on_calibrateAnchors_button_pressed()
msg.data = UWB_CALIBRATE_ANCHORS;
UWBServiceClientUpdate_publisher.publish(msg);
if(!updateUWBSettings(!ui->checkBox_enable_UWB->isChecked()))
{
ROS_ERROR("[Teacher GUI] UWB Anchor calibration failed!");
return;
}
ui->checkBox_localisation_done->setChecked(true);
ui->checkBox_enable_UWB->setEnabled(true);
ui->reloadAnchors_button->setEnabled(true);
ROS_WARN("Starting sleep");
//ros::Duration(10).sleep();
ROS_WARN("ending sleep");
//updateUWBSettings(!ui->checkBox_enable_UWB->isChecked());
}
void MainGUIWindow::on_comboBoxCFs_currentTextChanged(const QString &arg1)
......
......@@ -17,7 +17,7 @@ void Serial::init()
int Serial::startConnection(const char* port)
{
printf("Attempting to connect to Serial port %s...\n", port);
//printf("Attempting to connect to Serial port %s...\n", port);
_port = "";
_isConnected = false;
......@@ -48,8 +48,8 @@ int Serial::startConnection(const char* port)
_ready = true;
_isConnected = true;
printf("%sConnected\n", K_WARNING);
printf("%s", K_NORMAL);
//printf("%sConnected\n", K_WARNING);
//printf("%s", K_NORMAL);
return 1;
}
......@@ -83,7 +83,7 @@ bool Serial::writeSerial(const char* buffer)
if(!_isConnected)
return 0;
printf("Sending packet (%s)\n", buffer);
//printf("Sending packet (%s)\n", buffer);
for (unsigned int i = 0; i < strlen(buffer); i++)
{
write(tty_fd, &buffer[i], 1);
......
......@@ -23,7 +23,6 @@
#include "UWBManagerService.h"
//#include "SerialUnix.h"
#include "DataListener.h"
#define UWB_UPDATE_DISABLE 0
......@@ -113,6 +112,7 @@ void d_fall_pps::updateCallback(const std_msgs::Int32 &message)
break;
case UWB_CALIBRATE_ANCHORS:
calibrateAnchors();
readYaml();
break;
case UWB_UPDATE_ENABLE:
enableUWB = true;
......@@ -130,7 +130,7 @@ void d_fall_pps::calibrateAnchors()
{
ROS_WARN("[UWBManagerService] Calibrating Anchors...");
calSuccess = calSuccess || selfLoc.startAnchorLocalistaion();
calSuccess = selfLoc.startAnchorLocalistaion();
if(calSuccess)
ROS_WARN("[UWBManagerService] Calibration successfull!");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment