@@ -96,6 +96,7 @@ static MixerSettingsMixer1TypeOptions types_mixer[MAX_MIX_ACTUATORS];
9696 */
9797
9898static float motor_mixer [MAX_MIX_ACTUATORS * MIXERSETTINGS_MIXER1VECTOR_NUMELEM ];
99+ static float motor_mixer_inv [MAX_MIX_ACTUATORS * MIXERSETTINGS_MIXER1VECTOR_NUMELEM ];
99100
100101/* These are various settings objects used throughout the actuator code */
101102static ActuatorSettingsData actuatorSettings ;
@@ -372,6 +373,12 @@ static void compute_mixer()
372373#endif
373374}
374375
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+
375382static void fill_desired_vector (
376383 ActuatorDesiredData * desired ,
377384 float val1 , float val2 ,
@@ -738,20 +745,31 @@ static void actuator_task(void* parameters)
738745 actuator_settings_update ();
739746 }
740747
748+ PIOS_WDG_UpdateFlag (PIOS_WDG_ACTUATOR );
749+
750+ UAVObjEvent ev ;
751+
741752 if (mixer_settings_updated ) {
742753 mixer_settings_updated = false;
743754 SystemSettingsAirframeTypeGet (& airframe_type );
744755
745756 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
746768
747769 MixerSettingsThrottleCurve2Get (curve2 );
748770 MixerSettingsCurve2SourceGet (& curve2_src );
749771 }
750772
751- PIOS_WDG_UpdateFlag (PIOS_WDG_ACTUATOR );
752-
753- UAVObjEvent ev ;
754-
755773 // Wait until the ActuatorDesired object is updated
756774 if (!PIOS_Queue_Receive (queue , & ev , FAILSAFE_TIMEOUT_MS )) {
757775 // If we hit a timeout, set the actuator failsafe and
0 commit comments