#include "ui_accrealtimedialog.h"
#include <math.h>
+/**
+ * Default constructor for AccRealTimeDialog class.
+ *
+ */
AccRealTimeDialog::AccRealTimeDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AccRealTimeDialog)
resultDialog = NULL;
}
+/**
+ * Default destructor for AccRealTimeDialog class.
+ * Deletes all dynamic objects and sets them to NULL.
+ */
AccRealTimeDialog::~AccRealTimeDialog()
{
delete ui;
delete resultDialog;
}
+/**
+ *
+ */
void AccRealTimeDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
break;
}
}
+
/**
- *This function is called to read (and process) data from the accelerometer
+ * This function is called to read (and process) data from the accelerometer
*/
void AccRealTimeDialog::readAccelerometerData()
{
accelerometer->getAcceleration(x, y, z);
- // keep the following line as close to the SetKinematicsProperties method as possible
+ // keep the following line as close to the SetKinematicsProperties method as possible
currentTime = elapsedTime.elapsed();
- //accelerometer->smoothData(x, y, z);
-
- //Calculate average for Z
+ // Calculate average for Z
movingAverageZ->Enqueue(z);
z = movingAverageZ->Average();
- //Calculate average for Y
+ // Calculate average for Y
movingAverageY->Enqueue(y);
y = movingAverageY->Average();
if(calZ < 0)
calZ = -calZ;
- //Take acceleration from more affecting axel
+ // Take acceleration from more affecting axel
if(calZ < calY)
{
z = z*(1+calZ/2);
//screen up: y = 0, z = -1
//screen front: y = -1, z = 0
-// QString str = QString("acc x: " + QString::number(x) + "\n" +
-// "acc y: " + QString::number(y) + "\n" +
-// "acc z: " + QString::number(z) + "\n");
+ //QString str = QString("acc x: " + QString::number(x) + "\n" +
+ // "acc y: " + QString::number(y) + "\n" +
+ // "acc z: " + QString::number(z) + "\n");
//currentAcceleration = z;//sqrt(x*x + y*y + z*z);
//qDebug("y: %f, calibZ: %f, calibY: %f\n",y,accelerometer->getCalibrationZ(),accelerometer->getCalibrationY());
stopMeasureSpeed = 0;
}
+/**
+ *
+ */
void AccRealTimeDialog::Calibrate()
{
accelerometer->calibrate();
}
+/**
+ * This slot function called when ever abort button clicked.
+ */
void AccRealTimeDialog::on_buttonAbort_clicked()
{
accelerometerTimer->stop();
this->close();
}
+/**
+ *
+ */
void AccRealTimeDialog::startAccelerationMeasure()
{
double temp = stopMeasureSpeed;
accelerometerTimer->start(40);
}
+/**
+ *
+ * @param double speed
+ */
void AccRealTimeDialog::SetStopMeasureSpeed(double speed)
{
stopMeasureSpeed = speed;
/**
*This slot function emit accelerationstart sendresult.
*
- **/
+ * @param double result
+ */
void AccRealTimeDialog::sendResult(double result)
{
emit sendresult(result);