Browse Source

Working on real log replay in simulation link

QGC4.4
pixhawk 15 years ago
parent
commit
96522cf706
  1. 2
      src/comm/MAVLinkProtocol.h
  2. 20
      src/comm/MAVLinkSimulationLink.cc
  3. 1
      src/comm/MAVLinkSimulationLink.h

2
src/comm/MAVLinkProtocol.h

@ -69,7 +69,7 @@ public: @@ -69,7 +69,7 @@ public:
/** @brief Get logging state */
bool loggingEnabled(void);
/** @brief Get the name of the packet log file */
QString getLogfileName();
static QString getLogfileName();
public slots:
/** @brief Receive bytes from a communication interface */

20
src/comm/MAVLinkSimulationLink.cc

@ -38,6 +38,7 @@ This file is part of the PIXHAWK project @@ -38,6 +38,7 @@ This file is part of the PIXHAWK project
#include <QDebug>
#include "MG.h"
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkSimulationLink.h"
// MAVLINK includes
#include <mavlink.h>
@ -92,6 +93,10 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile @@ -92,6 +93,10 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile
maxTimeNoise = 0;
this->id = getNextLinkId();
LinkManager::instance()->add(this);
// Open packet log
mavlinkLogFile = new QFile(MAVLinkProtocol::getLogfileName());
mavlinkLogFile->open(QIODevice::ReadOnly);
}
MAVLinkSimulationLink::~MAVLinkSimulationLink()
@ -121,6 +126,21 @@ void MAVLinkSimulationLink::run() @@ -121,6 +126,21 @@ void MAVLinkSimulationLink::run()
if (_isConnected)
{
mainloop();
// FIXME Hacky code to read from packet log file
// readyBufferMutex.lock();
// for (int i = 0; i < streampointer; i++)
// {
// readyBuffer.enqueue(*(stream + i));
// }
// readyBufferMutex.unlock();
emit bytesReady(this);
}
last = MG::TIME::getGroundTimeNow();

1
src/comm/MAVLinkSimulationLink.h

@ -98,6 +98,7 @@ protected: @@ -98,6 +98,7 @@ protected:
QTimer* timer;
/** File which contains the input data (simulated robot messages) **/
QFile* simulationFile;
QFile* mavlinkLogFile;
QString simulationHeader;
/** File where the commands sent by the groundstation are stored **/
QFile* receiveFile;

Loading…
Cancel
Save