@@ -96,6 +96,7 @@ static MixerSettingsMixer1TypeOptions types_mixer[MAX_MIX_ACTUATORS];
96
96
*/
97
97
98
98
static float motor_mixer [MAX_MIX_ACTUATORS * MIXERSETTINGS_MIXER1VECTOR_NUMELEM ];
99
+ static float motor_mixer_inv [MAX_MIX_ACTUATORS * MIXERSETTINGS_MIXER1VECTOR_NUMELEM ];
99
100
100
101
/* These are various settings objects used throughout the actuator code */
101
102
static ActuatorSettingsData actuatorSettings ;
@@ -372,6 +373,12 @@ static void compute_mixer()
372
373
#endif
373
374
}
374
375
376
+ static bool compute_inverse_mixer ()
377
+ {
378
+ return matrix_pseudoinv (motor_mixer , motor_mixer_inv ,
379
+ MAX_MIX_ACTUATORS , MIXERSETTINGS_MIXER1VECTOR_NUMELEM );
380
+ }
381
+
375
382
static void fill_desired_vector (
376
383
ActuatorDesiredData * desired ,
377
384
float val1 , float val2 ,
@@ -738,20 +745,31 @@ static void actuator_task(void* parameters)
738
745
actuator_settings_update ();
739
746
}
740
747
748
+ PIOS_WDG_UpdateFlag (PIOS_WDG_ACTUATOR );
749
+
750
+ UAVObjEvent ev ;
751
+
741
752
if (mixer_settings_updated ) {
742
753
mixer_settings_updated = false;
743
754
SystemSettingsAirframeTypeGet (& airframe_type );
744
755
745
756
compute_mixer ();
757
+ <<<<<<< HEAD
758
+ == = == ==
759
+
760
+ /* If we can't calculate a proper inverse mixer,
761
+ * set failsafe.
762
+ */
763
+ if (compute_inverse_mixer ()) {
764
+ set_failsafe ();
765
+ continue ;
766
+ }
767
+ >>>>>>> mlyle /mpl - actmodel
746
768
747
769
MixerSettingsThrottleCurve2Get (curve2 );
748
770
MixerSettingsCurve2SourceGet (& curve2_src );
749
771
}
750
772
751
- PIOS_WDG_UpdateFlag (PIOS_WDG_ACTUATOR );
752
-
753
- UAVObjEvent ev ;
754
-
755
773
// Wait until the ActuatorDesired object is updated
756
774
if (!PIOS_Queue_Receive (queue , & ev , FAILSAFE_TIMEOUT_MS )) {
757
775
// If we hit a timeout, set the actuator failsafe and
0 commit comments