|
|
|
@ -111,6 +111,7 @@ Vehicle::Vehicle(LinkInterface* link,
@@ -111,6 +111,7 @@ Vehicle::Vehicle(LinkInterface* link,
|
|
|
|
|
, _soloFirmware(false) |
|
|
|
|
, _toolbox(qgcApp()->toolbox()) |
|
|
|
|
, _settingsManager(_toolbox->settingsManager()) |
|
|
|
|
, _csvLogTimer(this) |
|
|
|
|
, _joystickMode(JoystickModeRC) |
|
|
|
|
, _joystickEnabled(false) |
|
|
|
|
, _uas(nullptr) |
|
|
|
@ -302,6 +303,7 @@ Vehicle::Vehicle(LinkInterface* link,
@@ -302,6 +303,7 @@ Vehicle::Vehicle(LinkInterface* link,
|
|
|
|
|
connect(&_adsbTimer, &QTimer::timeout, this, &Vehicle::_adsbTimerTimeout); |
|
|
|
|
_adsbTimer.setSingleShot(false); |
|
|
|
|
_adsbTimer.start(1000); |
|
|
|
|
_initializeCsv(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Disconnected Vehicle for offline editing
|
|
|
|
@ -323,6 +325,7 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType,
@@ -323,6 +325,7 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType,
|
|
|
|
|
, _soloFirmware(false) |
|
|
|
|
, _toolbox(qgcApp()->toolbox()) |
|
|
|
|
, _settingsManager(_toolbox->settingsManager()) |
|
|
|
|
, _csvLogTimer(this) |
|
|
|
|
, _joystickMode(JoystickModeRC) |
|
|
|
|
, _joystickEnabled(false) |
|
|
|
|
, _uas(nullptr) |
|
|
|
@ -4005,6 +4008,53 @@ void Vehicle::_pidTuningAdjustRates(bool setRatesForTuning)
@@ -4005,6 +4008,53 @@ void Vehicle::_pidTuningAdjustRates(bool setRatesForTuning)
|
|
|
|
|
_setpointFactGroup.setLiveUpdates(setRatesForTuning); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Vehicle::_initializeCsv() |
|
|
|
|
{ |
|
|
|
|
QString now = QDateTime::currentDateTime().toString("yyyy-MM-dd hh-mm-ss"); |
|
|
|
|
QString fileName = QString("%1 vehicle%2.csv").arg(now).arg(_id); |
|
|
|
|
QDir saveDir(_toolbox->settingsManager()->appSettings()->telemetrySavePath()); |
|
|
|
|
_csvLogFile.setFileName(saveDir.absoluteFilePath(fileName)); |
|
|
|
|
|
|
|
|
|
if (!_csvLogFile.open(QIODevice::Append)) { |
|
|
|
|
qCWarning(VehicleLog) << "unable to open file for csv logging, Stopping csv logging!"; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QTextStream stream(&_csvLogFile); |
|
|
|
|
QStringList allFactNames; |
|
|
|
|
allFactNames << factNames(); |
|
|
|
|
for (const QString& groupName: factGroupNames()) { |
|
|
|
|
for(const QString& factName: getFactGroup(groupName)->factNames()){ |
|
|
|
|
allFactNames << QString("%1.%2").arg(groupName, factName); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
qCDebug(VehicleLog) << "Facts logged to csv:" << allFactNames; |
|
|
|
|
stream << "Timestamp," << allFactNames.join(",") << "\n"; |
|
|
|
|
|
|
|
|
|
connect(&_csvLogTimer, &QTimer::timeout, this, &Vehicle::_writeCsvLine); |
|
|
|
|
_csvLogTimer.start(1000); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Vehicle::_writeCsvLine() |
|
|
|
|
{ |
|
|
|
|
QStringList allFactValues; |
|
|
|
|
QTextStream stream(&_csvLogFile); |
|
|
|
|
|
|
|
|
|
// Write timestamp to csv file
|
|
|
|
|
allFactValues << QDateTime::currentDateTime().toString(); |
|
|
|
|
// Write Vehicle's own facts
|
|
|
|
|
for (const QString& factName : factNames()) { |
|
|
|
|
allFactValues << getFact(factName)->cookedValueString(); |
|
|
|
|
} |
|
|
|
|
// write facts from Vehicle's FactGroups
|
|
|
|
|
for (const QString& groupName: factGroupNames()) { |
|
|
|
|
for (const QString& factName : getFactGroup(groupName)->factNames()) { |
|
|
|
|
allFactValues << getFactGroup(groupName)->getFact(factName)->cookedValueString(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
stream << allFactValues.join(",") << "\n"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if !defined(NO_ARDUPILOT_DIALECT) |
|
|
|
|
void Vehicle::flashBootloader(void) |
|
|
|
|