1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Remove old test class that uses outdated objects (AttitudeRaw)

This commit is contained in:
James Cotton 2011-12-13 20:24:57 -06:00
parent 9143a716cf
commit bdc7f762d6
3 changed files with 0 additions and 103 deletions

View File

@ -29,11 +29,6 @@
#define PLOTDATA_H
#include "uavobject.h"
#include "baroaltitude.h"
#include "positionactual.h"
#include "attituderaw.h"
#include "manualcontrolcommand.h"
#include "qwt/src/qwt.h"
#include "qwt/src/qwt_plot.h"

View File

@ -54,15 +54,10 @@
using namespace Core;
TestDataGen* ScopeGadgetWidget::testDataGen;
// ******************************************************************
ScopeGadgetWidget::ScopeGadgetWidget(QWidget *parent) : QwtPlot(parent)
{
//if(testDataGen == 0)
// testDataGen = new TestDataGen();
setMouseTracking(true);
// canvas()->setMouseTracking(true);
@ -532,68 +527,6 @@ void ScopeGadgetWidget::clearCurvePlots()
}
TestDataGen::TestDataGen()
{
// Get required UAVObjects
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager* objManager = pm->getObject<UAVObjectManager>();
baroAltitude = BaroAltitude::GetInstance(objManager);
gps = PositionActual::GetInstance(objManager);
attRaw = AttitudeRaw::GetInstance(objManager);
manCtrlCmd = ManualControlCommand::GetInstance(objManager);
//Setup timer
periodMs = 20;
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(genTestData()));
timer->start(periodMs);
debugCounter = 0;
testTime = 0;
}
void TestDataGen::genTestData()
{
// Update BaroAltitude object
BaroAltitude::DataFields baroAltitudeData;
baroAltitudeData.Altitude = 500 * sin(1 * testTime) + 200 * cos(4 * testTime) + 800;
baroAltitudeData.Temperature = 30 * sin(0.5 * testTime);
baroAltitudeData.Pressure = baroAltitudeData.Altitude * 0.01 + baroAltitudeData.Temperature;
baroAltitude->setData(baroAltitudeData);
// Update Attitude Raw data
AttitudeRaw::DataFields attData;
// attData.accels[0] = 4 * sin(2 * testTime) + 1 * cos(6 * testTime) + 4;
// attData.accels[1] = 3 * sin(2.3 * testTime) + 1.5 * cos(3.3 * testTime) + 2;
// attData.accels[2] = 4 * sin(5.3 * testTime) + 1.5 * cos(1.3 * testTime) + 1;
attData.accels[0] = 1;
attData.accels[1] = 4;
attData.accels[2] = 9;
attRaw->setData(attData);
ManualControlCommand::DataFields manCtlData;
manCtlData.Channel[0] = 400 * cos(2 * testTime) + 100 * sin(6 * testTime) + 400;
manCtlData.Channel[1] = 350 * cos(2.3 * testTime) + 150 * sin(3.3 * testTime) + 200;
manCtlData.Channel[2] = 450 * cos(5.3 * testTime) + 150 * sin(1.3 * testTime) + 150;
manCtrlCmd->setData(manCtlData);
testTime += (periodMs / 1000.0);
// debugCounter++;
// if (debugCounter % (100/periodMs) == 0 )
// qDebug() << "Test Time = " << testTime;
}
TestDataGen::~TestDataGen()
{
if (timer)
timer->stop();
delete timer;
}
/*
int csvLoggingEnable;
int csvLoggingHeaderSaved;

View File

@ -62,35 +62,6 @@ private:
// double baseTime;
};
/*!
\brief This class is used to inject UAVTalk messages for testing.
*/
class TestDataGen : QObject
{
Q_OBJECT
public:
TestDataGen();
~TestDataGen();
private:
BaroAltitude* baroAltitude;
PositionActual* gps;
AttitudeRaw* attRaw;
ManualControlCommand* manCtrlCmd;
QTimer *timer;
double testTime;
int periodMs;
int debugCounter;
private slots:
void genTestData();
};
class ScopeGadgetWidget : public QwtPlot
{
Q_OBJECT
@ -148,8 +119,6 @@ private:
QList<QString> m_connectedUAVObjects;
QMap<QString, PlotData*> m_curvesData;
static TestDataGen* testDataGen;
QTimer *replotTimer;
bool m_csvLoggingStarted;