1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

Merge remote branch 'baseorigin/kenz/math_scope' into basenext

This commit is contained in:
Corvus Corax 2012-05-24 23:50:47 +02:00
commit 63faf92c9a
19 changed files with 359 additions and 128 deletions

View File

@ -90,7 +90,7 @@ ConfigCameraStabilizationWidget::ConfigCameraStabilizationWidget(QWidget *parent
connect(m_camerastabilization->camerastabilizationSaveSD, SIGNAL(clicked()), this, SLOT(saveSettings())); connect(m_camerastabilization->camerastabilizationSaveSD, SIGNAL(clicked()), this, SLOT(saveSettings()));
connect(m_camerastabilization->camerastabilizationHelp, SIGNAL(clicked()), this, SLOT(openHelp())); connect(m_camerastabilization->camerastabilizationHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
disbleMouseWheelEvents(); disableMouseWheelEvents();
} }
ConfigCameraStabilizationWidget::~ConfigCameraStabilizationWidget() ConfigCameraStabilizationWidget::~ConfigCameraStabilizationWidget()

View File

@ -53,7 +53,7 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
connect(this,SIGNAL(widgetContentsChanged(QWidget*)),this,SLOT(processLinkedWidgets(QWidget*))); connect(this,SIGNAL(widgetContentsChanged(QWidget*)),this,SLOT(processLinkedWidgets(QWidget*)));
disbleMouseWheelEvents(); disableMouseWheelEvents();
} }

View File

@ -68,7 +68,7 @@ ConfigTxPIDWidget::ConfigTxPIDWidget(QWidget *parent) : ConfigTaskWidget(parent)
populateWidgets(); populateWidgets();
refreshWidgetsValues(); refreshWidgetsValues();
disbleMouseWheelEvents(); disableMouseWheelEvents();
} }
ConfigTxPIDWidget::~ConfigTxPIDWidget() ConfigTxPIDWidget::~ConfigTxPIDWidget()

View File

@ -233,7 +233,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
setupGroundVehicleUI( m_aircraft->groundVehicleType->currentText() ); setupGroundVehicleUI( m_aircraft->groundVehicleType->currentText() );
setupFixedWingUI( m_aircraft->fixedWingType->currentText() ); setupFixedWingUI( m_aircraft->fixedWingType->currentText() );
disbleMouseWheelEvents(); disableMouseWheelEvents();
} }

View File

@ -37,7 +37,7 @@ inputChannelForm::inputChannelForm(QWidget *parent,bool showlegend) :
connect(ui->channelNumberDropdown,SIGNAL(currentIndexChanged(int)),this,SLOT(channelDropdownUpdated(int))); connect(ui->channelNumberDropdown,SIGNAL(currentIndexChanged(int)),this,SLOT(channelDropdownUpdated(int)));
connect(ui->channelNumber,SIGNAL(valueChanged(int)),this,SLOT(channelNumberUpdated(int))); connect(ui->channelNumber,SIGNAL(valueChanged(int)),this,SLOT(channelNumberUpdated(int)));
disbleMouseWheelEvents(); disableMouseWheelEvents();
} }

View File

@ -71,7 +71,7 @@ OutputChannelForm::OutputChannelForm(const int index, QWidget *parent, const boo
connect(ui.actuatorLink, SIGNAL(toggled(bool)), connect(ui.actuatorLink, SIGNAL(toggled(bool)),
this, SLOT(linkToggled(bool))); this, SLOT(linkToggled(bool)));
disbleMouseWheelEvents(); disableMouseWheelEvents();
} }
OutputChannelForm::~OutputChannelForm() OutputChannelForm::~OutputChannelForm()

View File

@ -1734,6 +1734,7 @@
<dataSize>60</dataSize> <dataSize>60</dataSize>
<plotCurve0> <plotCurve0>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>x</uavField> <uavField>x</uavField>
<uavObject>Accels</uavObject> <uavObject>Accels</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1742,6 +1743,7 @@
</plotCurve0> </plotCurve0>
<plotCurve1> <plotCurve1>
<color>4283782655</color> <color>4283782655</color>
<mathFunction>None</mathFunction>
<uavField>y</uavField> <uavField>y</uavField>
<uavObject>Accels</uavObject> <uavObject>Accels</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1750,6 +1752,7 @@
</plotCurve1> </plotCurve1>
<plotCurve2> <plotCurve2>
<color>4283804160</color> <color>4283804160</color>
<mathFunction>None</mathFunction>
<uavField>z</uavField> <uavField>z</uavField>
<uavObject>Accels</uavObject> <uavObject>Accels</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1774,6 +1777,7 @@
<dataSize>20</dataSize> <dataSize>20</dataSize>
<plotCurve0> <plotCurve0>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>Channel-4</uavField> <uavField>Channel-4</uavField>
<uavObject>ActuatorCommand</uavObject> <uavObject>ActuatorCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1782,6 +1786,7 @@
</plotCurve0> </plotCurve0>
<plotCurve1> <plotCurve1>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>Channel-5</uavField> <uavField>Channel-5</uavField>
<uavObject>ActuatorCommand</uavObject> <uavObject>ActuatorCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1790,6 +1795,7 @@
</plotCurve1> </plotCurve1>
<plotCurve2> <plotCurve2>
<color>4289374847</color> <color>4289374847</color>
<mathFunction>None</mathFunction>
<uavField>Channel-6</uavField> <uavField>Channel-6</uavField>
<uavObject>ActuatorCommand</uavObject> <uavObject>ActuatorCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1798,6 +1804,7 @@
</plotCurve2> </plotCurve2>
<plotCurve3> <plotCurve3>
<color>4289374847</color> <color>4289374847</color>
<mathFunction>None</mathFunction>
<uavField>Channel-7</uavField> <uavField>Channel-7</uavField>
<uavObject>ActuatorCommand</uavObject> <uavObject>ActuatorCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1822,6 +1829,7 @@
<dataSize>60</dataSize> <dataSize>60</dataSize>
<plotCurve0> <plotCurve0>
<color>4283760895</color> <color>4283760895</color>
<mathFunction>None</mathFunction>
<uavField>Roll</uavField> <uavField>Roll</uavField>
<uavObject>AttitudeActual</uavObject> <uavObject>AttitudeActual</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1830,6 +1838,7 @@
</plotCurve0> </plotCurve0>
<plotCurve1> <plotCurve1>
<color>4278233600</color> <color>4278233600</color>
<mathFunction>None</mathFunction>
<uavField>Yaw</uavField> <uavField>Yaw</uavField>
<uavObject>AttitudeActual</uavObject> <uavObject>AttitudeActual</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1838,6 +1847,7 @@
</plotCurve1> </plotCurve1>
<plotCurve2> <plotCurve2>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>Pitch</uavField> <uavField>Pitch</uavField>
<uavObject>AttitudeActual</uavObject> <uavObject>AttitudeActual</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1862,6 +1872,7 @@
<dataSize>60</dataSize> <dataSize>60</dataSize>
<plotCurve0> <plotCurve0>
<color>4278190080</color> <color>4278190080</color>
<mathFunction>None</mathFunction>
<uavField>Pressure</uavField> <uavField>Pressure</uavField>
<uavObject>BaroAltitude</uavObject> <uavObject>BaroAltitude</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1886,6 +1897,7 @@
<dataSize>40</dataSize> <dataSize>40</dataSize>
<plotCurve0> <plotCurve0>
<color>4278190207</color> <color>4278190207</color>
<mathFunction>None</mathFunction>
<uavField>Channel-1</uavField> <uavField>Channel-1</uavField>
<uavObject>ManualControlCommand</uavObject> <uavObject>ManualControlCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1894,6 +1906,7 @@
</plotCurve0> </plotCurve0>
<plotCurve1> <plotCurve1>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>Channel-4</uavField> <uavField>Channel-4</uavField>
<uavObject>ManualControlCommand</uavObject> <uavObject>ManualControlCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1902,6 +1915,7 @@
</plotCurve1> </plotCurve1>
<plotCurve2> <plotCurve2>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>Channel-5</uavField> <uavField>Channel-5</uavField>
<uavObject>ManualControlCommand</uavObject> <uavObject>ManualControlCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1910,6 +1924,7 @@
</plotCurve2> </plotCurve2>
<plotCurve3> <plotCurve3>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>Channel-6</uavField> <uavField>Channel-6</uavField>
<uavObject>ManualControlCommand</uavObject> <uavObject>ManualControlCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1918,6 +1933,7 @@
</plotCurve3> </plotCurve3>
<plotCurve4> <plotCurve4>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>Channel-7</uavField> <uavField>Channel-7</uavField>
<uavObject>ManualControlCommand</uavObject> <uavObject>ManualControlCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1926,6 +1942,7 @@
</plotCurve4> </plotCurve4>
<plotCurve5> <plotCurve5>
<color>4283825920</color> <color>4283825920</color>
<mathFunction>None</mathFunction>
<uavField>Channel-2</uavField> <uavField>Channel-2</uavField>
<uavObject>ManualControlCommand</uavObject> <uavObject>ManualControlCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1934,6 +1951,7 @@
</plotCurve5> </plotCurve5>
<plotCurve6> <plotCurve6>
<color>4294923520</color> <color>4294923520</color>
<mathFunction>None</mathFunction>
<uavField>Channel-3</uavField> <uavField>Channel-3</uavField>
<uavObject>ManualControlCommand</uavObject> <uavObject>ManualControlCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1942,6 +1960,7 @@
</plotCurve6> </plotCurve6>
<plotCurve7> <plotCurve7>
<color>4294967040</color> <color>4294967040</color>
<mathFunction>None</mathFunction>
<uavField>Channel-0</uavField> <uavField>Channel-0</uavField>
<uavObject>ManualControlCommand</uavObject> <uavObject>ManualControlCommand</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1966,6 +1985,7 @@
<dataSize>60</dataSize> <dataSize>60</dataSize>
<plotCurve0> <plotCurve0>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>x</uavField> <uavField>x</uavField>
<uavObject>Accels</uavObject> <uavObject>Accels</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1974,6 +1994,7 @@
</plotCurve0> </plotCurve0>
<plotCurve1> <plotCurve1>
<color>4283782655</color> <color>4283782655</color>
<mathFunction>None</mathFunction>
<uavField>y</uavField> <uavField>y</uavField>
<uavObject>Accels</uavObject> <uavObject>Accels</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -1982,6 +2003,7 @@
</plotCurve1> </plotCurve1>
<plotCurve2> <plotCurve2>
<color>4283804160</color> <color>4283804160</color>
<mathFunction>None</mathFunction>
<uavField>z</uavField> <uavField>z</uavField>
<uavObject>Accels</uavObject> <uavObject>Accels</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2006,6 +2028,7 @@
<dataSize>60</dataSize> <dataSize>60</dataSize>
<plotCurve0> <plotCurve0>
<color>4283804160</color> <color>4283804160</color>
<mathFunction>None</mathFunction>
<uavField>z</uavField> <uavField>z</uavField>
<uavObject>Gyros</uavObject> <uavObject>Gyros</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2014,6 +2037,7 @@
</plotCurve0> </plotCurve0>
<plotCurve1> <plotCurve1>
<color>4283782655</color> <color>4283782655</color>
<mathFunction>None</mathFunction>
<uavField>y</uavField> <uavField>y</uavField>
<uavObject>Gyros</uavObject> <uavObject>Gyros</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2022,6 +2046,7 @@
</plotCurve1> </plotCurve1>
<plotCurve2> <plotCurve2>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>x</uavField> <uavField>x</uavField>
<uavObject>Gyros</uavObject> <uavObject>Gyros</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2046,6 +2071,7 @@
<dataSize>60</dataSize> <dataSize>60</dataSize>
<plotCurve0> <plotCurve0>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>X</uavField> <uavField>X</uavField>
<uavObject>Magnetometer</uavObject> <uavObject>Magnetometer</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2054,6 +2080,7 @@
</plotCurve0> </plotCurve0>
<plotCurve1> <plotCurve1>
<color>4283782655</color> <color>4283782655</color>
<mathFunction>None</mathFunction>
<uavField>Y</uavField> <uavField>Y</uavField>
<uavObject>Magnetometer</uavObject> <uavObject>Magnetometer</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2062,6 +2089,7 @@
</plotCurve1> </plotCurve1>
<plotCurve2> <plotCurve2>
<color>4283804160</color> <color>4283804160</color>
<mathFunction>None</mathFunction>
<uavField>Z</uavField> <uavField>Z</uavField>
<uavObject>Magnetometer</uavObject> <uavObject>Magnetometer</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2086,6 +2114,7 @@
<dataSize>240</dataSize> <dataSize>240</dataSize>
<plotCurve0> <plotCurve0>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-System</uavField> <uavField>StackRemaining-System</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2094,6 +2123,7 @@
</plotCurve0> </plotCurve0>
<plotCurve1> <plotCurve1>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-Actuator</uavField> <uavField>StackRemaining-Actuator</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2102,6 +2132,7 @@
</plotCurve1> </plotCurve1>
<plotCurve10> <plotCurve10>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-Guidance</uavField> <uavField>StackRemaining-Guidance</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2110,6 +2141,7 @@
</plotCurve10> </plotCurve10>
<plotCurve11> <plotCurve11>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-Watchdog</uavField> <uavField>StackRemaining-Watchdog</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2118,6 +2150,7 @@
</plotCurve11> </plotCurve11>
<plotCurve2> <plotCurve2>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-TelemetryTx</uavField> <uavField>StackRemaining-TelemetryTx</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2126,6 +2159,7 @@
</plotCurve2> </plotCurve2>
<plotCurve3> <plotCurve3>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-TelemetryTxPri</uavField> <uavField>StackRemaining-TelemetryTxPri</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2134,6 +2168,7 @@
</plotCurve3> </plotCurve3>
<plotCurve4> <plotCurve4>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-TelemetryRx</uavField> <uavField>StackRemaining-TelemetryRx</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2142,6 +2177,7 @@
</plotCurve4> </plotCurve4>
<plotCurve5> <plotCurve5>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-GPS</uavField> <uavField>StackRemaining-GPS</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2150,6 +2186,7 @@
</plotCurve5> </plotCurve5>
<plotCurve6> <plotCurve6>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-ManualControl</uavField> <uavField>StackRemaining-ManualControl</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2158,6 +2195,7 @@
</plotCurve6> </plotCurve6>
<plotCurve7> <plotCurve7>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-Altitude</uavField> <uavField>StackRemaining-Altitude</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2166,6 +2204,7 @@
</plotCurve7> </plotCurve7>
<plotCurve8> <plotCurve8>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-AHRSComms</uavField> <uavField>StackRemaining-AHRSComms</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2174,6 +2213,7 @@
</plotCurve8> </plotCurve8>
<plotCurve9> <plotCurve9>
<color>4294945280</color> <color>4294945280</color>
<mathFunction>None</mathFunction>
<uavField>StackRemaining-Stabilization</uavField> <uavField>StackRemaining-Stabilization</uavField>
<uavObject>TaskInfo</uavObject> <uavObject>TaskInfo</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2198,6 +2238,7 @@
<dataSize>20</dataSize> <dataSize>20</dataSize>
<plotCurve0> <plotCurve0>
<color>4289374847</color> <color>4289374847</color>
<mathFunction>None</mathFunction>
<uavField>TxFailures</uavField> <uavField>TxFailures</uavField>
<uavObject>GCSTelemetryStats</uavObject> <uavObject>GCSTelemetryStats</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2206,6 +2247,7 @@
</plotCurve0> </plotCurve0>
<plotCurve1> <plotCurve1>
<color>4283782655</color> <color>4283782655</color>
<mathFunction>None</mathFunction>
<uavField>RxFailures</uavField> <uavField>RxFailures</uavField>
<uavObject>GCSTelemetryStats</uavObject> <uavObject>GCSTelemetryStats</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2214,6 +2256,7 @@
</plotCurve1> </plotCurve1>
<plotCurve2> <plotCurve2>
<color>4294901760</color> <color>4294901760</color>
<mathFunction>None</mathFunction>
<uavField>TxRetries</uavField> <uavField>TxRetries</uavField>
<uavObject>GCSTelemetryStats</uavObject> <uavObject>GCSTelemetryStats</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>
@ -2238,6 +2281,7 @@
<dataSize>240</dataSize> <dataSize>240</dataSize>
<plotCurve0> <plotCurve0>
<color>4294945407</color> <color>4294945407</color>
<mathFunction>None</mathFunction>
<uavField>FlightTime</uavField> <uavField>FlightTime</uavField>
<uavObject>SystemStats</uavObject> <uavObject>SystemStats</uavObject>
<yMaximum>0</yMaximum> <yMaximum>0</yMaximum>

View File

@ -53,8 +53,9 @@ PlotData::PlotData(QString p_uavObject, QString p_uavField)
curve = 0; curve = 0;
scalePower = 0; scalePower = 0;
interpolationSamples = 1; meanSamples = 1;
interpolationSum = 0.0f; meanSum = 0.0f;
// mathFunction=0;
correctionSum = 0.0f; correctionSum = 0.0f;
correctionCount = 0; correctionCount = 0;
yMinimum = 0; yMinimum = 0;
@ -87,7 +88,7 @@ PlotData::~PlotData()
} }
bool SequencialPlotData::append(UAVObject* obj) bool SequentialPlotData::append(UAVObject* obj)
{ {
if (uavObject == obj->getName()) { if (uavObject == obj->getName()) {
@ -96,28 +97,50 @@ bool SequencialPlotData::append(UAVObject* obj)
if (field) { if (field) {
//Shift data forward and put the new value at the front
// calculate interpolated (smoothed) value
double currentValue = valueAsDouble(obj, field) * pow(10, scalePower); double currentValue = valueAsDouble(obj, field) * pow(10, scalePower);
//Compute boxcar average
if (mathFunction == "Boxcar average" || mathFunction == "Standard deviation"){
//Put the new value at the front
yDataHistory->append( currentValue ); yDataHistory->append( currentValue );
interpolationSum += currentValue;
if(yDataHistory->size() > interpolationSamples) { // calculate average value
interpolationSum -= yDataHistory->first(); meanSum += currentValue;
if(yDataHistory->size() > meanSamples) {
meanSum -= yDataHistory->first();
yDataHistory->pop_front(); yDataHistory->pop_front();
} }
// make sure to correct the sum every interpolationSamples steps to prevent it
// from running away due to flouting point rounding errors // make sure to correct the sum every meanSamples steps to prevent it
// from running away due to floating point rounding errors
correctionSum+=currentValue; correctionSum+=currentValue;
if (++correctionCount >= interpolationSamples) { if (++correctionCount >= meanSamples) {
interpolationSum = correctionSum; meanSum = correctionSum;
correctionSum = 0.0f; correctionSum = 0.0f;
correctionCount = 0; correctionCount = 0;
} }
yData->append(interpolationSum/yDataHistory->size());
if (yData->size() > m_xWindowSize) { double boxcarAvg=meanSum/yDataHistory->size();
if ( mathFunction == "Standard deviation" ){
//Calculate square of sample standard deviation, with Bessel's correction
double stdSum=0;
for (int i=0; i < yDataHistory->size(); i++){
stdSum+= pow(yDataHistory->at(i)- boxcarAvg,2)/(meanSamples-1);
}
yData->append(sqrt(stdSum));
}
else {
yData->append(boxcarAvg);
}
}
else{
yData->append( currentValue );
}
if (yData->size() > m_xWindowSize) { //If new data overflows the window, remove old data...
yData->pop_front(); yData->pop_front();
} else } else //...otherwise, add a new y point at position xData
xData->insert(xData->size(), xData->size()); xData->insert(xData->size(), xData->size());
//notify the gui of changes in the data //notify the gui of changes in the data
@ -137,30 +160,49 @@ bool ChronoPlotData::append(UAVObject* obj)
//qDebug() << "uavObject: " << uavObject << ", uavField: " << uavField; //qDebug() << "uavObject: " << uavObject << ", uavField: " << uavField;
if (field) { if (field) {
//Put the new value at the front QDateTime NOW = QDateTime::currentDateTime(); //THINK ABOUT REIMPLEMENTING THIS TO SHOW UAVO TIME, NOT SYSTEM TIME
QDateTime NOW = QDateTime::currentDateTime();
// calculate interpolated (smoothed) value
double currentValue = valueAsDouble(obj, field) * pow(10, scalePower); double currentValue = valueAsDouble(obj, field) * pow(10, scalePower);
//Compute boxcar average
if (meanSamples > 1){
//Put the new value at the front
yDataHistory->append( currentValue ); yDataHistory->append( currentValue );
interpolationSum += currentValue;
if(yDataHistory->size() > interpolationSamples) { // calculate average value
interpolationSum -= yDataHistory->first(); meanSum += currentValue;
if(yDataHistory->size() > meanSamples) {
meanSum -= yDataHistory->first();
yDataHistory->pop_front(); yDataHistory->pop_front();
} }
// make sure to correct the sum every interpolationSamples steps to prevent it // make sure to correct the sum every meanSamples steps to prevent it
// from running away due to flouting point rounding errors // from running away due to floating point rounding errors
correctionSum+=currentValue; correctionSum+=currentValue;
if (++correctionCount >= interpolationSamples) { if (++correctionCount >= meanSamples) {
interpolationSum = correctionSum; meanSum = correctionSum;
correctionSum = 0.0f; correctionSum = 0.0f;
correctionCount = 0; correctionCount = 0;
} }
double boxcarAvg=meanSum/yDataHistory->size();
//qDebug()<<mathFunction;
if ( mathFunction == "Standard deviation" ){
//Calculate square of sample standard deviation, with Bessel's correction
double stdSum=0;
for (int i=0; i < yDataHistory->size(); i++){
stdSum+= pow(yDataHistory->at(i)- boxcarAvg,2)/(meanSamples-1);
}
yData->append(sqrt(stdSum));
}
else {
yData->append(boxcarAvg);
}
}
else{
yData->append( currentValue );
}
double valueX = NOW.toTime_t() + NOW.time().msec() / 1000.0; double valueX = NOW.toTime_t() + NOW.time().msec() / 1000.0;
double valueY = interpolationSum/yDataHistory->size();
xData->append(valueX); xData->append(valueX);
yData->append(valueY);
//qDebug() << "Data " << uavObject << "." << field->getName() << " X,Y:" << valueX << "," << valueY; //qDebug() << "Data " << uavObject << "." << field->getName() << " X,Y:" << valueX << "," << valueY;

View File

@ -44,7 +44,7 @@
\brief Defines the different type of plots. \brief Defines the different type of plots.
*/ */
enum PlotType { enum PlotType {
SequencialPlot, SequentialPlot,
ChronoPlot, ChronoPlot,
UAVObjectPlot, UAVObjectPlot,
@ -67,8 +67,9 @@ public:
QString uavSubField; QString uavSubField;
bool haveSubField; bool haveSubField;
int scalePower; //This is the power to which each value must be raised int scalePower; //This is the power to which each value must be raised
int interpolationSamples; int meanSamples;
double interpolationSum; double meanSum;
QString mathFunction;
double correctionSum; double correctionSum;
int correctionCount; int correctionCount;
double yMinimum; double yMinimum;
@ -93,16 +94,16 @@ signals:
}; };
/*! /*!
\brief The sequencial plot have a fixed size buffer of data. All the curves in one plot \brief The sequential plot have a fixed size buffer of data. All the curves in one plot
have the same size buffer. have the same size buffer.
*/ */
class SequencialPlotData : public PlotData class SequentialPlotData : public PlotData
{ {
Q_OBJECT Q_OBJECT
public: public:
SequencialPlotData(QString uavObject, QString uavField) SequentialPlotData(QString uavObject, QString uavField)
: PlotData(uavObject, uavField) {} : PlotData(uavObject, uavField) {}
~SequencialPlotData() {} ~SequentialPlotData() {}
/*! /*!
\brief Append new data to the plot \brief Append new data to the plot
@ -113,7 +114,7 @@ public:
\brief The type of plot \brief The type of plot
*/ */
virtual PlotType plotType() { virtual PlotType plotType() {
return SequencialPlot; return SequentialPlot;
} }
/*! /*!

View File

@ -49,8 +49,8 @@ void ScopeGadget::loadConfiguration(IUAVGadgetConfiguration* config)
widget->setXWindowSize(sgConfig->dataSize()); widget->setXWindowSize(sgConfig->dataSize());
widget->setRefreshInterval(sgConfig->refreshInterval()); widget->setRefreshInterval(sgConfig->refreshInterval());
if(sgConfig->plotType() == SequencialPlot ) if(sgConfig->plotType() == SequentialPlot )
widget->setupSequencialPlot(); widget->setupSequentialPlot();
else if(sgConfig->plotType() == ChronoPlot) else if(sgConfig->plotType() == ChronoPlot)
widget->setupChronoPlot(); widget->setupChronoPlot();
// else if(sgConfig->plotType() == UAVObjectPlot) // else if(sgConfig->plotType() == UAVObjectPlot)
@ -61,14 +61,16 @@ void ScopeGadget::loadConfiguration(IUAVGadgetConfiguration* config)
QString uavObject = plotCurveConfig->uavObject; QString uavObject = plotCurveConfig->uavObject;
QString uavField = plotCurveConfig->uavField; QString uavField = plotCurveConfig->uavField;
int scale = plotCurveConfig->yScalePower; int scale = plotCurveConfig->yScalePower;
int interpolation = plotCurveConfig->yInterpolationSamples; int mean = plotCurveConfig->yMeanSamples;
QString mathFunction = plotCurveConfig->mathFunction;
QRgb color = plotCurveConfig->color; QRgb color = plotCurveConfig->color;
widget->addCurvePlot( widget->addCurvePlot(
uavObject, uavObject,
uavField, uavField,
scale, scale,
interpolation, mean,
mathFunction,
QPen( QBrush(QColor(color),Qt::SolidPattern), QPen( QBrush(QColor(color),Qt::SolidPattern),
// (qreal)2, // (qreal)2,
(qreal)1, (qreal)1,

View File

@ -31,7 +31,8 @@ ScopeGadgetConfiguration::ScopeGadgetConfiguration(QString classId, QSettings* q
IUAVGadgetConfiguration(classId, parent), IUAVGadgetConfiguration(classId, parent),
m_plotType((int)ChronoPlot), m_plotType((int)ChronoPlot),
m_dataSize(60), m_dataSize(60),
m_refreshInterval(1000) m_refreshInterval(1000),
m_mathFunctionType(0)
{ {
uint currentStreamVersion = 0; uint currentStreamVersion = 0;
int plotCurveCount = 0; int plotCurveCount = 0;
@ -65,8 +66,11 @@ ScopeGadgetConfiguration::ScopeGadgetConfiguration(QString classId, QSettings* q
color = qSettings->value("color").value<QRgb>(); color = qSettings->value("color").value<QRgb>();
plotCurveConf->color = color; plotCurveConf->color = color;
plotCurveConf->yScalePower = qSettings->value("yScalePower").toInt(); plotCurveConf->yScalePower = qSettings->value("yScalePower").toInt();
plotCurveConf->yInterpolationSamples = qSettings->value("yInterpolationSamples").toInt(); plotCurveConf->mathFunction = qSettings->value("mathFunction").toString();
if (!plotCurveConf->yInterpolationSamples) plotCurveConf->yInterpolationSamples = 1; // fallback for backward compatibility with earlier versions plotCurveConf->yMeanSamples = qSettings->value("yMeanSamples").toInt();
if (!plotCurveConf->yMeanSamples) plotCurveConf->yMeanSamples = 1; // fallback for backward compatibility with earlier versions //IS THIS STILL NECESSARY?
plotCurveConf->yMinimum = qSettings->value("yMinimum").toDouble(); plotCurveConf->yMinimum = qSettings->value("yMinimum").toDouble();
plotCurveConf->yMaximum = qSettings->value("yMaximum").toDouble(); plotCurveConf->yMaximum = qSettings->value("yMaximum").toDouble();
@ -107,6 +111,7 @@ IUAVGadgetConfiguration *ScopeGadgetConfiguration::clone()
ScopeGadgetConfiguration *m = new ScopeGadgetConfiguration(this->classId()); ScopeGadgetConfiguration *m = new ScopeGadgetConfiguration(this->classId());
m->setPlotType( m_plotType); m->setPlotType( m_plotType);
m->setDataSize( m_dataSize); m->setDataSize( m_dataSize);
m->setMathFunctionType( m_mathFunctionType);
m->setRefreashInterval( m_refreshInterval); m->setRefreashInterval( m_refreshInterval);
plotCurveCount = m_PlotCurveConfigs.size(); plotCurveCount = m_PlotCurveConfigs.size();
@ -120,7 +125,9 @@ IUAVGadgetConfiguration *ScopeGadgetConfiguration::clone()
newPlotCurveConf->uavField = currentPlotCurveConf->uavField; newPlotCurveConf->uavField = currentPlotCurveConf->uavField;
newPlotCurveConf->color = currentPlotCurveConf->color; newPlotCurveConf->color = currentPlotCurveConf->color;
newPlotCurveConf->yScalePower = currentPlotCurveConf->yScalePower; newPlotCurveConf->yScalePower = currentPlotCurveConf->yScalePower;
newPlotCurveConf->yInterpolationSamples = currentPlotCurveConf->yInterpolationSamples; newPlotCurveConf->yMeanSamples = currentPlotCurveConf->yMeanSamples;
newPlotCurveConf->mathFunction = currentPlotCurveConf->mathFunction;
newPlotCurveConf->yMinimum = currentPlotCurveConf->yMinimum; newPlotCurveConf->yMinimum = currentPlotCurveConf->yMinimum;
newPlotCurveConf->yMaximum = currentPlotCurveConf->yMaximum; newPlotCurveConf->yMaximum = currentPlotCurveConf->yMaximum;
@ -136,8 +143,9 @@ IUAVGadgetConfiguration *ScopeGadgetConfiguration::clone()
return m; return m;
} }
/** /**
* Saves a configuration. * Saves a configuration. //REDEFINES saveConfig CHILD BEHAVIOR?
* *
*/ */
void ScopeGadgetConfiguration::saveConfig(QSettings* qSettings) const { void ScopeGadgetConfiguration::saveConfig(QSettings* qSettings) const {
@ -159,8 +167,9 @@ void ScopeGadgetConfiguration::saveConfig(QSettings* qSettings) const {
qSettings->setValue("uavObject", plotCurveConf->uavObject); qSettings->setValue("uavObject", plotCurveConf->uavObject);
qSettings->setValue("uavField", plotCurveConf->uavField); qSettings->setValue("uavField", plotCurveConf->uavField);
qSettings->setValue("color", plotCurveConf->color); qSettings->setValue("color", plotCurveConf->color);
qSettings->setValue("mathFunction", plotCurveConf->mathFunction);
qSettings->setValue("yScalePower", plotCurveConf->yScalePower); qSettings->setValue("yScalePower", plotCurveConf->yScalePower);
qSettings->setValue("yInterpolationSamples", plotCurveConf->yInterpolationSamples); qSettings->setValue("yMeanSamples", plotCurveConf->yMeanSamples);
qSettings->setValue("yMinimum", plotCurveConf->yMinimum); qSettings->setValue("yMinimum", plotCurveConf->yMinimum);
qSettings->setValue("yMaximum", plotCurveConf->yMaximum); qSettings->setValue("yMaximum", plotCurveConf->yMaximum);

View File

@ -41,7 +41,8 @@ struct PlotCurveConfiguration
QString uavField; QString uavField;
int yScalePower; //This is the power to which each value must be raised int yScalePower; //This is the power to which each value must be raised
QRgb color; QRgb color;
int yInterpolationSamples; int yMeanSamples;
QString mathFunction;
double yMinimum; double yMinimum;
double yMaximum; double yMaximum;
}; };
@ -56,6 +57,7 @@ public:
//configuration setter functions //configuration setter functions
void setPlotType(int value){m_plotType = value;} void setPlotType(int value){m_plotType = value;}
void setMathFunctionType(int value){m_mathFunctionType = value;}
void setDataSize(int value){m_dataSize = value;} void setDataSize(int value){m_dataSize = value;}
void setRefreashInterval(int value){m_refreshInterval = value;} void setRefreashInterval(int value){m_refreshInterval = value;}
void addPlotCurveConfig(PlotCurveConfiguration* value){m_PlotCurveConfigs.append(value);} void addPlotCurveConfig(PlotCurveConfiguration* value){m_PlotCurveConfigs.append(value);}
@ -64,11 +66,12 @@ public:
//configurations getter functions //configurations getter functions
int plotType(){return m_plotType;} int plotType(){return m_plotType;}
int mathFunctionType(){return m_mathFunctionType;}
int dataSize(){return m_dataSize;} int dataSize(){return m_dataSize;}
int refreshInterval(){return m_refreshInterval;} int refreshInterval(){return m_refreshInterval;}
QList<PlotCurveConfiguration*> plotCurveConfigs(){return m_PlotCurveConfigs;} QList<PlotCurveConfiguration*> plotCurveConfigs(){return m_PlotCurveConfigs;}
void saveConfig(QSettings* settings) const; void saveConfig(QSettings* settings) const; //THIS SEEMS TO BE UNUSED
IUAVGadgetConfiguration *clone(); IUAVGadgetConfiguration *clone();
bool getLoggingEnabled(){return m_LoggingEnabled;}; bool getLoggingEnabled(){return m_LoggingEnabled;};
@ -84,6 +87,7 @@ private:
int m_plotType; //The type of the plot int m_plotType; //The type of the plot
int m_dataSize; //The size of the data buffer to render in the curve plot int m_dataSize; //The size of the data buffer to render in the curve plot
int m_refreshInterval; //The interval to replot the curve widget. The data buffer is refresh as the data comes in. int m_refreshInterval; //The interval to replot the curve widget. The data buffer is refresh as the data comes in.
int m_mathFunctionType; //The type of math function to be used in the scope analysis
QList<PlotCurveConfiguration*> m_PlotCurveConfigs; QList<PlotCurveConfiguration*> m_PlotCurveConfigs;
void clearPlotData(); void clearPlotData();

View File

@ -53,7 +53,7 @@ QWidget* ScopeGadgetOptionsPage::createPage(QWidget *parent)
//main layout //main layout
options_page->setupUi(optionsPageWidget); options_page->setupUi(optionsPageWidget);
options_page->cmbPlotType->addItem("Sequencial Plot",""); options_page->cmbPlotType->addItem("Sequential Plot","");
options_page->cmbPlotType->addItem("Chronological Plot",""); options_page->cmbPlotType->addItem("Chronological Plot","");
// Fills the combo boxes for the UAVObjects // Fills the combo boxes for the UAVObjects
@ -69,29 +69,34 @@ QWidget* ScopeGadgetOptionsPage::createPage(QWidget *parent)
//Connect signals to slots cmbUAVObjects.currentIndexChanged //Connect signals to slots cmbUAVObjects.currentIndexChanged
connect(options_page->cmbUAVObjects, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_cmbUAVObjects_currentIndexChanged(QString))); connect(options_page->cmbUAVObjects, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_cmbUAVObjects_currentIndexChanged(QString)));
options_page->mathFunctionComboBox->addItem("None");
options_page->mathFunctionComboBox->addItem("Boxcar average");
options_page->mathFunctionComboBox->addItem("Standard deviation");
if(options_page->cmbUAVObjects->currentIndex() >= 0) if(options_page->cmbUAVObjects->currentIndex() >= 0)
on_cmbUAVObjects_currentIndexChanged(options_page->cmbUAVObjects->currentText()); on_cmbUAVObjects_currentIndexChanged(options_page->cmbUAVObjects->currentText());
options_page->cmbScale->addItem("E-9", -9); options_page->cmbScale->addItem("10^-9", -9);
options_page->cmbScale->addItem("E-6", -6); options_page->cmbScale->addItem("10^-6", -6);
options_page->cmbScale->addItem("E-5",-5); options_page->cmbScale->addItem("10^-5",-5);
options_page->cmbScale->addItem("E-4",-4); options_page->cmbScale->addItem("10^-4",-4);
options_page->cmbScale->addItem("E-3",-3); options_page->cmbScale->addItem("10^-3",-3);
options_page->cmbScale->addItem("E-2",-2); options_page->cmbScale->addItem("10^-2",-2);
options_page->cmbScale->addItem("E-1",-1); options_page->cmbScale->addItem("10^-1",-1);
options_page->cmbScale->addItem("E0",0); options_page->cmbScale->addItem("1",0);
options_page->cmbScale->addItem("E1",1); options_page->cmbScale->addItem("10^1",1);
options_page->cmbScale->addItem("E2",2); options_page->cmbScale->addItem("10^2",2);
options_page->cmbScale->addItem("E3",3); options_page->cmbScale->addItem("10^3",3);
options_page->cmbScale->addItem("E4",4); options_page->cmbScale->addItem("10^4",4);
options_page->cmbScale->addItem("E5",5); options_page->cmbScale->addItem("10^5",5);
options_page->cmbScale->addItem("E6",6); options_page->cmbScale->addItem("10^6",6);
options_page->cmbScale->addItem("E9",9); options_page->cmbScale->addItem("10^9",9);
options_page->cmbScale->addItem("E12",12); options_page->cmbScale->addItem("10^12",12);
options_page->cmbScale->setCurrentIndex(7); options_page->cmbScale->setCurrentIndex(7);
//Set widget values from settings //Set widget values from settings
options_page->cmbPlotType->setCurrentIndex(m_config->plotType()); options_page->cmbPlotType->setCurrentIndex(m_config->plotType());
options_page->mathFunctionComboBox->setCurrentIndex(m_config->mathFunctionType());
options_page->spnDataSize->setValue(m_config->dataSize()); options_page->spnDataSize->setValue(m_config->dataSize());
options_page->spnRefreshInterval->setValue(m_config->refreshInterval()); options_page->spnRefreshInterval->setValue(m_config->refreshInterval());
@ -101,10 +106,11 @@ QWidget* ScopeGadgetOptionsPage::createPage(QWidget *parent)
QString uavObject = plotData->uavObject; QString uavObject = plotData->uavObject;
QString uavField = plotData->uavField; QString uavField = plotData->uavField;
int scale = plotData->yScalePower; int scale = plotData->yScalePower;
int interpolation = plotData->yInterpolationSamples; int mean = plotData->yMeanSamples;
QString mathFunction = plotData->mathFunction;
QVariant varColor = plotData->color; QVariant varColor = plotData->color;
addPlotCurveConfig(uavObject,uavField,scale,interpolation,varColor); addPlotCurveConfig(uavObject,uavField,scale,mean,mathFunction,varColor);
} }
if(m_config->plotCurveConfigs().count() > 0) if(m_config->plotCurveConfigs().count() > 0)
@ -114,6 +120,7 @@ QWidget* ScopeGadgetOptionsPage::createPage(QWidget *parent)
connect(options_page->btnRemoveCurve, SIGNAL(clicked()), this, SLOT(on_btnRemoveCurve_clicked())); connect(options_page->btnRemoveCurve, SIGNAL(clicked()), this, SLOT(on_btnRemoveCurve_clicked()));
connect(options_page->lstCurves, SIGNAL(currentRowChanged(int)), this, SLOT(on_lstCurves_currentRowChanged(int))); connect(options_page->lstCurves, SIGNAL(currentRowChanged(int)), this, SLOT(on_lstCurves_currentRowChanged(int)));
connect(options_page->btnColor, SIGNAL(clicked()), this, SLOT(on_btnColor_clicked())); connect(options_page->btnColor, SIGNAL(clicked()), this, SLOT(on_btnColor_clicked()));
connect(options_page->mathFunctionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_mathFunctionComboBox_currentIndexChanged(int)));
connect(options_page->spnRefreshInterval, SIGNAL(valueChanged(int )), this, SLOT(on_spnRefreshInterval_valueChanged(int))); connect(options_page->spnRefreshInterval, SIGNAL(valueChanged(int )), this, SLOT(on_spnRefreshInterval_valueChanged(int)));
setYAxisWidgetFromPlotCurve(); setYAxisWidgetFromPlotCurve();
@ -127,11 +134,47 @@ QWidget* ScopeGadgetOptionsPage::createPage(QWidget *parent)
connect(options_page->LoggingEnable, SIGNAL(clicked()), this, SLOT(on_loggingEnable_clicked())); connect(options_page->LoggingEnable, SIGNAL(clicked()), this, SLOT(on_loggingEnable_clicked()));
on_loggingEnable_clicked(); on_loggingEnable_clicked();
//Disable mouse wheel events
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
sp->installEventFilter( this );
}
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
sp->installEventFilter( this );
}
foreach( QSlider * sp, findChildren<QSlider*>() ) {
sp->installEventFilter( this );
}
foreach( QComboBox * sp, findChildren<QComboBox*>() ) {
sp->installEventFilter( this );
}
return optionsPageWidget; return optionsPageWidget;
} }
bool ScopeGadgetOptionsPage::eventFilter( QObject * obj, QEvent * evt ) {
//Filter all wheel events, and ignore them
if ( evt->type() == QEvent::Wheel &&
(qobject_cast<QAbstractSpinBox*>( obj ) ||
qobject_cast<QComboBox*>( obj ) ||
qobject_cast<QAbstractSlider*>( obj ) ))
{
evt->ignore();
return true;
}
return ScopeGadgetOptionsPage::eventFilter( obj, evt );
}
void ScopeGadgetOptionsPage::on_mathFunctionComboBox_currentIndexChanged(int currentIndex){
if (currentIndex > 0){
options_page->spnMeanSamples->setEnabled(true);
}
else{
options_page->spnMeanSamples->setEnabled(false);
}
}
void ScopeGadgetOptionsPage::on_btnColor_clicked() void ScopeGadgetOptionsPage::on_btnColor_clicked()
{ {
QColor color = QColorDialog::getColor( QColor(options_page->btnColor->text())); QColor color = QColorDialog::getColor( QColor(options_page->btnColor->text()));
@ -152,6 +195,7 @@ void ScopeGadgetOptionsPage::setYAxisWidgetFromPlotCurve()
if(listItem == 0) if(listItem == 0)
return; return;
//WHAT IS UserRole DOING?
int currentIndex = options_page->cmbUAVObjects->findText( listItem->data(Qt::UserRole + 0).toString()); int currentIndex = options_page->cmbUAVObjects->findText( listItem->data(Qt::UserRole + 0).toString());
options_page->cmbUAVObjects->setCurrentIndex(currentIndex); options_page->cmbUAVObjects->setCurrentIndex(currentIndex);
@ -166,9 +210,13 @@ void ScopeGadgetOptionsPage::setYAxisWidgetFromPlotCurve()
setButtonColor(QColor((QRgb)rgb)); setButtonColor(QColor((QRgb)rgb));
int interpolation = listItem->data(Qt::UserRole + 4).toInt(&parseOK); int mean = listItem->data(Qt::UserRole + 4).toInt(&parseOK);
if(!parseOK) interpolation = 1; if(!parseOK) mean = 1;
options_page->spnInterpolationSamples->setValue(interpolation); options_page->spnMeanSamples->setValue(mean);
currentIndex = options_page->mathFunctionComboBox->findText( listItem->data(Qt::UserRole + 5).toString());
options_page->mathFunctionComboBox->setCurrentIndex(currentIndex);
} }
void ScopeGadgetOptionsPage::setButtonColor(const QColor &color) void ScopeGadgetOptionsPage::setButtonColor(const QColor &color)
@ -221,6 +269,7 @@ void ScopeGadgetOptionsPage::apply()
//Apply configuration changes //Apply configuration changes
m_config->setPlotType(options_page->cmbPlotType->currentIndex()); m_config->setPlotType(options_page->cmbPlotType->currentIndex());
m_config->setMathFunctionType(options_page->mathFunctionComboBox->currentIndex());
m_config->setDataSize(options_page->spnDataSize->value()); m_config->setDataSize(options_page->spnDataSize->value());
m_config->setRefreashInterval(options_page->spnRefreshInterval->value()); m_config->setRefreashInterval(options_page->spnRefreshInterval->value());
@ -242,9 +291,12 @@ void ScopeGadgetOptionsPage::apply()
else else
newPlotCurveConfigs->color = (QRgb)rgb; newPlotCurveConfigs->color = (QRgb)rgb;
newPlotCurveConfigs->yInterpolationSamples = listItem->data(Qt::UserRole + 4).toInt(&parseOK); newPlotCurveConfigs->yMeanSamples = listItem->data(Qt::UserRole + 4).toInt(&parseOK);
if(!parseOK) if(!parseOK)
newPlotCurveConfigs->yInterpolationSamples = 1; newPlotCurveConfigs->yMeanSamples = 1;
newPlotCurveConfigs->mathFunction = listItem->data(Qt::UserRole + 5).toString();
plotCurveConfigs.append(newPlotCurveConfigs); plotCurveConfigs.append(newPlotCurveConfigs);
} }
@ -271,7 +323,9 @@ void ScopeGadgetOptionsPage::on_btnAddCurve_clicked()
if(!parseOK) if(!parseOK)
scale = 0; scale = 0;
int interpolation = options_page->spnInterpolationSamples->value(); int mean = options_page->spnMeanSamples->value();
QString mathFunction = options_page->mathFunctionComboBox->currentText();
QVariant varColor = (int)QColor(options_page->btnColor->text()).rgb(); QVariant varColor = (int)QColor(options_page->btnColor->text()).rgb();
@ -281,27 +335,27 @@ void ScopeGadgetOptionsPage::on_btnAddCurve_clicked()
options_page->lstCurves->currentItem()->text() == uavObject + "." + uavField) options_page->lstCurves->currentItem()->text() == uavObject + "." + uavField)
{ {
QListWidgetItem *listWidgetItem = options_page->lstCurves->currentItem(); QListWidgetItem *listWidgetItem = options_page->lstCurves->currentItem();
setCurvePlotProperties(listWidgetItem,uavObject,uavField,scale,interpolation,varColor); setCurvePlotProperties(listWidgetItem,uavObject,uavField,scale,mean,mathFunction,varColor);
}else }else
{ {
addPlotCurveConfig(uavObject,uavField,scale,interpolation,varColor); addPlotCurveConfig(uavObject,uavField,scale,mean,mathFunction,varColor);
options_page->lstCurves->setCurrentRow(options_page->lstCurves->count() - 1); options_page->lstCurves->setCurrentRow(options_page->lstCurves->count() - 1);
} }
} }
void ScopeGadgetOptionsPage::addPlotCurveConfig(QString uavObject, QString uavField, int scale, int interpolation, QVariant varColor) void ScopeGadgetOptionsPage::addPlotCurveConfig(QString uavObject, QString uavField, int scale, int mean, QString mathFunction, QVariant varColor)
{ {
//Add a new curve config to the list //Add a new curve config to the list
QString listItemDisplayText = uavObject + "." + uavField; QString listItemDisplayText = uavObject + "." + uavField;
options_page->lstCurves->addItem(listItemDisplayText); options_page->lstCurves->addItem(listItemDisplayText);
QListWidgetItem *listWidgetItem = options_page->lstCurves->item(options_page->lstCurves->count() - 1); QListWidgetItem *listWidgetItem = options_page->lstCurves->item(options_page->lstCurves->count() - 1);
setCurvePlotProperties(listWidgetItem,uavObject,uavField,scale,interpolation,varColor); setCurvePlotProperties(listWidgetItem,uavObject,uavField,scale,mean,mathFunction,varColor);
} }
void ScopeGadgetOptionsPage::setCurvePlotProperties(QListWidgetItem *listWidgetItem,QString uavObject, QString uavField, int scale, int interpolation, QVariant varColor) void ScopeGadgetOptionsPage::setCurvePlotProperties(QListWidgetItem *listWidgetItem,QString uavObject, QString uavField, int scale, int mean, QString mathFunction, QVariant varColor)
{ {
bool parseOK = false; bool parseOK = false;
@ -317,7 +371,8 @@ void ScopeGadgetOptionsPage::setCurvePlotProperties(QListWidgetItem *listWidgetI
listWidgetItem->setData(Qt::UserRole + 1,QVariant(uavField)); listWidgetItem->setData(Qt::UserRole + 1,QVariant(uavField));
listWidgetItem->setData(Qt::UserRole + 2,QVariant(scale)); listWidgetItem->setData(Qt::UserRole + 2,QVariant(scale));
listWidgetItem->setData(Qt::UserRole + 3,varColor); listWidgetItem->setData(Qt::UserRole + 3,varColor);
listWidgetItem->setData(Qt::UserRole + 4,QVariant(interpolation)); listWidgetItem->setData(Qt::UserRole + 4,QVariant(mean));
listWidgetItem->setData(Qt::UserRole + 5,QVariant(mathFunction));
} }
/*! /*!

View File

@ -66,11 +66,12 @@ private:
Ui::ScopeGadgetOptionsPage *options_page; Ui::ScopeGadgetOptionsPage *options_page;
ScopeGadgetConfiguration *m_config; ScopeGadgetConfiguration *m_config;
void addPlotCurveConfig(QString uavObject, QString uavField, int scale, int interpolation, QVariant varColor); void addPlotCurveConfig(QString uavObject, QString uavField, int scale, int mean, QString mathFunction, QVariant varColor);
void setCurvePlotProperties(QListWidgetItem *listWidgetItem, QString uavObject, QString uavField, int scale, int interpolation, QVariant varColor); void setCurvePlotProperties(QListWidgetItem *listWidgetItem, QString uavObject, QString uavField, int scale, int mean, QString mathFunction, QVariant varColor);
void setYAxisWidgetFromPlotCurve(); void setYAxisWidgetFromPlotCurve();
void setButtonColor(const QColor &color); void setButtonColor(const QColor &color);
void validateRefreshInterval(); void validateRefreshInterval();
bool eventFilter( QObject * obj, QEvent * evt );
private slots: private slots:
void on_spnRefreshInterval_valueChanged(int ); void on_spnRefreshInterval_valueChanged(int );
@ -79,6 +80,7 @@ private slots:
void on_btnAddCurve_clicked(); void on_btnAddCurve_clicked();
void on_cmbUAVObjects_currentIndexChanged(QString val); void on_cmbUAVObjects_currentIndexChanged(QString val);
void on_btnColor_clicked(); void on_btnColor_clicked();
void on_mathFunctionComboBox_currentIndexChanged(int currentIndex);
void on_loggingEnable_clicked(); void on_loggingEnable_clicked();
}; };

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>544</width> <width>548</width>
<height>342</height> <height>457</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -100,7 +100,11 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="cmbPlotType"/> <widget class="QComboBox" name="cmbPlotType">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
@ -111,6 +115,9 @@
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QSpinBox" name="spnDataSize"> <widget class="QSpinBox" name="spnDataSize">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="suffix"> <property name="suffix">
<string> seconds</string> <string> seconds</string>
</property> </property>
@ -134,6 +141,9 @@
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QSpinBox" name="spnRefreshInterval"> <widget class="QSpinBox" name="spnRefreshInterval">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="suffix"> <property name="suffix">
<string>ms</string> <string>ms</string>
</property> </property>
@ -161,7 +171,7 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Plot curves</string> <string>Y-axis</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -173,7 +183,11 @@
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="5" column="1">
<widget class="QComboBox" name="cmbUAVObjects"/> <widget class="QComboBox" name="cmbUAVObjects">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item> </item>
<item row="6" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
@ -183,45 +197,67 @@
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="6" column="1">
<widget class="QComboBox" name="cmbUAVField"/> <widget class="QComboBox" name="cmbUAVField">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item> </item>
<item row="7" column="0"> <item row="9" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Color:</string> <string>Color:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="9" column="1">
<widget class="QPushButton" name="btnColor"> <widget class="QPushButton" name="btnColor">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text"> <property name="text">
<string>Choose</string> <string>Choose</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="10" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Scale:</string> <string>Y-axis scale factor:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="10" column="1">
<widget class="QComboBox" name="cmbScale"> <widget class="QComboBox" name="cmbScale">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="editable"> <property name="editable">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0"> <item row="8" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
<string>Display smoothed interpolation:</string> <string>Math window size</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="8" column="1">
<widget class="QSpinBox" name="spnInterpolationSamples"> <widget class="QSpinBox" name="spnMeanSamples">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="suffix"> <property name="suffix">
<string> samples</string> <string> samples</string>
</property> </property>
@ -239,6 +275,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0">
<widget class="QLabel" name="mathFunctionLabel">
<property name="text">
<string>Math function:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="mathFunctionComboBox">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -390,6 +440,22 @@ Update</string>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops>
<tabstop>cmbPlotType</tabstop>
<tabstop>spnDataSize</tabstop>
<tabstop>spnRefreshInterval</tabstop>
<tabstop>cmbUAVObjects</tabstop>
<tabstop>cmbUAVField</tabstop>
<tabstop>mathFunctionComboBox</tabstop>
<tabstop>spnMeanSamples</tabstop>
<tabstop>btnColor</tabstop>
<tabstop>cmbScale</tabstop>
<tabstop>btnAddCurve</tabstop>
<tabstop>btnRemoveCurve</tabstop>
<tabstop>lstCurves</tabstop>
<tabstop>LoggingEnable</tabstop>
<tabstop>LoggingConnect</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -269,9 +269,9 @@ void ScopeGadgetWidget::showCurve(QwtPlotItem *item, bool on)
mutex.unlock(); mutex.unlock();
} }
void ScopeGadgetWidget::setupSequencialPlot() void ScopeGadgetWidget::setupSequentialPlot()
{ {
preparePlot(SequencialPlot); preparePlot(SequentialPlot);
// QwtText title("Index"); // QwtText title("Index");
//// title.setFont(QFont("Helvetica", 20)); //// title.setFont(QFont("Helvetica", 20));
@ -352,12 +352,12 @@ void ScopeGadgetWidget::setupChronoPlot()
// scaleWidget->setMinBorderDist(0, fmw); // scaleWidget->setMinBorderDist(0, fmw);
} }
void ScopeGadgetWidget::addCurvePlot(QString uavObject, QString uavFieldSubField, int scaleOrderFactor, int interpolationSamples, QPen pen) void ScopeGadgetWidget::addCurvePlot(QString uavObject, QString uavFieldSubField, int scaleOrderFactor, int meanSamples, QString mathFunction, QPen pen)
{ {
PlotData* plotData; PlotData* plotData;
if (m_plotType == SequencialPlot) if (m_plotType == SequentialPlot)
plotData = new SequencialPlotData(uavObject, uavFieldSubField); plotData = new SequentialPlotData(uavObject, uavFieldSubField);
else if (m_plotType == ChronoPlot) else if (m_plotType == ChronoPlot)
plotData = new ChronoPlotData(uavObject, uavFieldSubField); plotData = new ChronoPlotData(uavObject, uavFieldSubField);
//else if (m_plotType == UAVObjectPlot) //else if (m_plotType == UAVObjectPlot)
@ -365,7 +365,8 @@ void ScopeGadgetWidget::addCurvePlot(QString uavObject, QString uavFieldSubField
plotData->m_xWindowSize = m_xWindowSize; plotData->m_xWindowSize = m_xWindowSize;
plotData->scalePower = scaleOrderFactor; plotData->scalePower = scaleOrderFactor;
plotData->interpolationSamples = interpolationSamples; plotData->meanSamples = meanSamples;
plotData->mathFunction = mathFunction;
//If the y-bounds are supplied, set them //If the y-bounds are supplied, set them
if (plotData->yMinimum != plotData->yMaximum) if (plotData->yMinimum != plotData->yMaximum)
@ -471,7 +472,7 @@ void ScopeGadgetWidget::replotNewData()
void ScopeGadgetWidget::setupExamplePlot() void ScopeGadgetWidget::setupExamplePlot()
{ {
preparePlot(SequencialPlot); preparePlot(SequentialPlot);
// Show the axes // Show the axes

View File

@ -70,7 +70,7 @@ public:
ScopeGadgetWidget(QWidget *parent = 0); ScopeGadgetWidget(QWidget *parent = 0);
~ScopeGadgetWidget(); ~ScopeGadgetWidget();
void setupSequencialPlot(); void setupSequentialPlot();
void setupChronoPlot(); void setupChronoPlot();
void setupUAVObjectPlot(); void setupUAVObjectPlot();
PlotType plotType(){return m_plotType;} PlotType plotType(){return m_plotType;}
@ -81,7 +81,7 @@ public:
int refreshInterval(){return m_refreshInterval;} int refreshInterval(){return m_refreshInterval;}
void addCurvePlot(QString uavObject, QString uavFieldSubField, int scaleOrderFactor = 0, int interpolationSamples = 1, QPen pen = QPen(Qt::black)); void addCurvePlot(QString uavObject, QString uavFieldSubField, int scaleOrderFactor = 0, int meanSamples = 1, QString mathFunction= "None", QPen pen = QPen(Qt::black));
//void removeCurvePlot(QString uavObject, QString uavField); //void removeCurvePlot(QString uavObject, QString uavField);
void clearCurvePlots(); void clearCurvePlots();
int csvLoggingStart(); int csvLoggingStart();

View File

@ -1158,7 +1158,7 @@ void ConfigTaskWidget::loadWidgetLimits(QWidget * widget,UAVObjectField * field,
} }
} }
void ConfigTaskWidget::disbleMouseWheelEvents() void ConfigTaskWidget::disableMouseWheelEvents()
{ {
//Disable mouse wheel events //Disable mouse wheel events
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) { foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
@ -1170,12 +1170,17 @@ void ConfigTaskWidget::disbleMouseWheelEvents()
foreach( QSlider * sp, findChildren<QSlider*>() ) { foreach( QSlider * sp, findChildren<QSlider*>() ) {
sp->installEventFilter( this ); sp->installEventFilter( this );
} }
foreach( QComboBox * sp, findChildren<QComboBox*>() ) {
sp->installEventFilter( this );
}
} }
bool ConfigTaskWidget::eventFilter( QObject * obj, QEvent * evt ) { bool ConfigTaskWidget::eventFilter( QObject * obj, QEvent * evt ) {
//Filter all wheel events, and ignore them //Filter all wheel events, and ignore them
if ( evt->type() == QEvent::Wheel && if ( evt->type() == QEvent::Wheel &&
(qobject_cast<QAbstractSpinBox*>( obj ) || qobject_cast<QAbstractSlider*>( obj ) )) (qobject_cast<QAbstractSpinBox*>( obj ) ||
qobject_cast<QComboBox*>( obj ) ||
qobject_cast<QAbstractSlider*>( obj ) ))
{ {
evt->ignore(); evt->ignore();
return true; return true;

View File

@ -86,7 +86,7 @@ public:
ConfigTaskWidget(QWidget *parent = 0); ConfigTaskWidget(QWidget *parent = 0);
~ConfigTaskWidget(); ~ConfigTaskWidget();
void disbleMouseWheelEvents(); void disableMouseWheelEvents();
bool eventFilter( QObject * obj, QEvent * evt ); bool eventFilter( QObject * obj, QEvent * evt );
void saveObjectToSD(UAVObject *obj); void saveObjectToSD(UAVObject *obj);