diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-01-12 12:47:10 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-01-12 12:47:10 +0100 |
commit | c8917c62d6415706380102c78af3c99a127722ed (patch) | |
tree | 2cd0a9b6f64d6f8bf95b0f64bb86387b7ae9a889 | |
parent | 94226df9ba710ee8bf5a28baeebbb5d470796e24 (diff) |
accela: implement separate rot/trans deadbands
-rw-r--r-- | ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui | 152 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.cpp | 7 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.h | 6 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp | 3 |
4 files changed, 104 insertions, 64 deletions
diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui index 54493041..a3deacbd 100644 --- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui +++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>215</width> - <height>285</height> + <width>261</width> + <height>330</height> </rect> </property> <property name="sizePolicy"> @@ -54,19 +54,16 @@ <property name="horizontalSpacing"> <number>7</number> </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_2"> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string>Rotation</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + <string>Translation</string> </property> </widget> </item> @@ -98,16 +95,33 @@ </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string>Translation</string> + <string>Rotation</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>Exponent</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Order #3</string> </property> </widget> </item> @@ -143,15 +157,8 @@ </property> </widget> </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>Order #3</string> - </property> - </widget> - </item> <item row="5" column="1"> - <widget class="QDoubleSpinBox" name="deadzone"> + <widget class="QDoubleSpinBox" name="rot_deadzone"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -178,35 +185,6 @@ </property> </widget> </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string>Exponent</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QDoubleSpinBox" name="expt"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>0.050000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.050000000000000</double> - </property> - </widget> - </item> <item row="5" column="0"> <widget class="QLabel" name="lblSensYaw_6"> <property name="sizePolicy"> @@ -232,11 +210,11 @@ background:none;</string> </property> <property name="text"> - <string>Deadband</string> + <string>Rotation deadband</string> </property> </widget> </item> - <item row="7" column="0" colspan="2"> + <item row="8" column="0" colspan="2"> <widget class="QLabel" name="label_9"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> @@ -281,7 +259,29 @@ background:none;</string> </property> </widget> </item> - <item row="8" column="0" colspan="2"> + <item row="7" column="1"> + <widget class="QDoubleSpinBox" name="expt"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>0.050000000000000</double> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.050000000000000</double> + </property> + </widget> + </item> + <item row="9" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> @@ -294,8 +294,8 @@ background:none;</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="order_2nd"> + <item row="4" column="1"> + <widget class="QDoubleSpinBox" name="order_3rd"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -322,8 +322,8 @@ background:none;</string> </property> </widget> </item> - <item row="4" column="1"> - <widget class="QDoubleSpinBox" name="order_3rd"> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="order_2nd"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -350,6 +350,41 @@ background:none;</string> </property> </widget> </item> + <item row="6" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Translation deadband</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QDoubleSpinBox" name="trans_deadzone"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>0.000000000000000</double> + </property> + <property name="maximum"> + <double>3.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.050000000000000</double> + </property> + <property name="value"> + <double>0.000000000000000</double> + </property> + </widget> + </item> </layout> </widget> <tabstops> @@ -357,7 +392,8 @@ background:none;</string> <tabstop>translation_alpha</tabstop> <tabstop>order_2nd</tabstop> <tabstop>order_3rd</tabstop> - <tabstop>deadzone</tabstop> + <tabstop>rot_deadzone</tabstop> + <tabstop>trans_deadzone</tabstop> <tabstop>expt</tabstop> <tabstop>buttonBox</tabstop> </tabstops> diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 1e12e4de..558b3189 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -89,10 +89,11 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, const double a = i >= 3 ? s.rotation_alpha : s.translation_alpha;
const double a2 = a * s.second_order_alpha;
const double a3 = a * s.third_order_alpha;
+ const double deadzone = i >= 3 ? s.rot_deadzone : s.trans_deadzone;
const double velocity =
- parabola(a, vec, s.deadzone, s.expt) +
- parabola(a2, vec2, s.deadzone, s.expt) +
- parabola(a3, vec3, s.deadzone, s.expt);
+ parabola(a, vec, deadzone, s.expt) +
+ parabola(a2, vec2, deadzone, s.expt) +
+ parabola(a3, vec3, deadzone, s.expt);
const double result = last_output[0][i] + velocity;
const bool done = sign > 0 ? result >= target_camera_position[i] : result <= target_camera_position[i];
new_camera_position[i] = done ? target_camera_position[i] : result;
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index e8f077c3..42d9b772 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -19,7 +19,8 @@ struct settings { translation_alpha,
second_order_alpha,
third_order_alpha,
- deadzone,
+ rot_deadzone,
+ trans_deadzone,
expt;
settings() :
b(bundle("Accela")),
@@ -27,7 +28,8 @@ struct settings { translation_alpha(b, "translation-alpha", ACCELA_SMOOTHING_TRANSLATION),
second_order_alpha(b, "second-order-alpha", ACCELA_SECOND_ORDER_ALPHA),
third_order_alpha(b, "third-order-alpha", ACCELA_THIRD_ORDER_ALPHA),
- deadzone(b, "deadzone", 0),
+ rot_deadzone(b, "rotation-deadband", 0),
+ trans_deadzone(b, "translation-deadband", 0),
expt(b, "exponent", 2)
{}
};
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index 56b76a55..ca321891 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -16,7 +16,8 @@ FilterControls::FilterControls() : tie_setting(s.translation_alpha, ui.translation_alpha); tie_setting(s.second_order_alpha, ui.order_2nd); tie_setting(s.third_order_alpha, ui.order_3rd); - tie_setting(s.deadzone, ui.deadzone); + tie_setting(s.rot_deadzone, ui.rot_deadzone); + tie_setting(s.trans_deadzone, ui.trans_deadzone); tie_setting(s.expt, ui.expt); } |