1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

OP-975 change BoardRotation data type to float so it can be used for level calibration

This commit is contained in:
Alessio Morale 2014-04-10 01:47:37 +02:00
parent 1f0885dd4f
commit 1fe591d51e
4 changed files with 10 additions and 8 deletions

View File

@ -693,8 +693,9 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *objEv)
}
// Indicates not to expend cycles on rotation
if (attitudeSettings.BoardRotation.Pitch == 0 && attitudeSettings.BoardRotation.Roll == 0 &&
attitudeSettings.BoardRotation.Yaw == 0) {
if (fabsf(attitudeSettings.BoardRotation.Pitch) < 0.00001f &&
fabsf(attitudeSettings.BoardRotation.Roll) < 0.00001f &&
fabsf(attitudeSettings.BoardRotation.Yaw) < 0.00001f) {
rotate = 0;
// Shouldn't be used but to be safe

View File

@ -458,8 +458,9 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *objEv)
AttitudeSettingsGet(&attitudeSettings);
// Indicates not to expend cycles on rotation
if (attitudeSettings.BoardRotation.Roll == 0 && attitudeSettings.BoardRotation.Pitch == 0 &&
attitudeSettings.BoardRotation.Yaw == 0) {
if (fabsf(attitudeSettings.BoardRotation.Roll) < 0.00001f
&& fabsf(attitudeSettings.BoardRotation.Pitch) < 0.00001f &&
fabsf(attitudeSettings.BoardRotation.Yaw) <0.00001f ) {
rotate = 0;
} else {
rotate = 1;

View File

@ -393,7 +393,7 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="pitchRotation">
<widget class="QDoubleSpinBox" name="pitchRotation">
<property name="minimum">
<number>-90</number>
</property>
@ -475,7 +475,7 @@ margin:1px;</string>
</spacer>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="rollRotation">
<widget class="QDoubleSpinBox" name="rollRotation">
<property name="minimum">
<number>-180</number>
</property>
@ -508,7 +508,7 @@ margin:1px;</string>
</widget>
</item>
<item row="1" column="5">
<widget class="QSpinBox" name="yawRotation">
<widget class="QDoubleSpinBox" name="yawRotation">
<property name="minimum">
<number>-180</number>
</property>

View File

@ -1,7 +1,7 @@
<xml>
<object name="AttitudeSettings" singleinstance="true" settings="true" category="State">
<description>Settings for the @ref Attitude module used on CopterControl</description>
<field name="BoardRotation" units="deg" type="int16" elementnames="Roll,Pitch,Yaw" defaultvalue="0,0,0"/>
<field name="BoardRotation" units="deg" type="float" elementnames="Roll,Pitch,Yaw" defaultvalue="0,0,0"/>
<field name="AccelKp" units="channel" type="float" elements="1" defaultvalue="0.05"/>
<field name="AccelKi" units="channel" type="float" elements="1" defaultvalue="0.0001"/>
<field name="MagKi" units="" type="float" elements="1" defaultvalue="0"/>