Added logging for altitude and compass

This commit is contained in:
Tuomas Järvinen
2024-11-27 17:43:11 +01:00
parent de63892725
commit be36fc5c50
2 changed files with 20 additions and 3 deletions
+12 -3
View File
@@ -105,11 +105,13 @@ bool AzDroneController::stateGetTelemetryModule(void)
return false;
}
// Subscripe to position updates. Updated comes from different MAVSDK thread. Send position
// as signal to this class (Qt::QueuedConnection) so that it's handled in the main thread.
// Subscripe to position and heading updates. Updated comes from different MAVSDK thread. Send position
// or heading as signal to this class (Qt::QueuedConnection) so that it's handled in the main thread.
qRegisterMetaType<Telemetry::Position>("Telemetry::Position");
connect(this, &AzDroneController::newPosition, this, &AzDroneController::newPositionSlot, Qt::QueuedConnection);
connect(this, &AzDroneController::newHeading, this, &AzDroneController::newHeadingSlot, Qt::QueuedConnection);
mTelemetry->subscribe_position([this](Telemetry::Position position) { emit newPosition(position); });
mTelemetry->subscribe_heading([this](Telemetry::Heading heading) { emit newHeading(heading.heading_deg); });
return true;
}
@@ -244,7 +246,8 @@ void AzDroneController::droneStateMachineSlot(void)
void AzDroneController::newPositionSlot(Telemetry::Position position)
{
cout << "[CONTROLLER] GPS position " << position.latitude_deg << ", " << position.longitude_deg << endl;
cout << "[CONTROLLER] GPS position: " << position.latitude_deg << ", " << position.longitude_deg
<< " Altitudes: " << position.absolute_altitude_m << ", " << position.relative_altitude_m << endl;
// Save first position. It will be used later to set altitude for missions.
// TODO!! Probably we want to use rangefinder or at least barometer with altitude from the map later.
@@ -262,6 +265,12 @@ void AzDroneController::newPositionSlot(Telemetry::Position position)
}
void AzDroneController::newHeadingSlot(double heading)
{
cout << "[CONTROLLER] Heading: " << heading << endl;
}
void AzDroneController::missionIndexChangedSlot(int currentIndex, int totalIndexes)
{
cout << "[CONTROLLER] missionIndexChanged() " << currentIndex << "/" << totalIndexes << endl;