@@ -70,6 +70,7 @@ class FlightTab(Tab, flight_tab_class):
7070 _emergency_stop_updated_signal = pyqtSignal (bool )
7171 _assisted_control_updated_signal = pyqtSignal (bool )
7272 _heighthold_input_updated_signal = pyqtSignal (float , float , float , float )
73+ _hover_input_updated_signal = pyqtSignal (float , float , float , float )
7374
7475 _log_error_signal = pyqtSignal (object , str )
7576
@@ -111,6 +112,10 @@ def __init__(self, tabWidget, helper, *args):
111112 self ._heighthold_input_updated_signal .emit )
112113 self ._heighthold_input_updated_signal .connect (
113114 self ._heighthold_input_updated )
115+ self .helper .inputDeviceReader .hover_input_updated .add_callback (
116+ self ._hover_input_updated_signal .emit )
117+ self ._hover_input_updated_signal .connect (
118+ self ._hover_input_updated )
114119
115120 self .helper .inputDeviceReader .assisted_control_updated .add_callback (
116121 self ._assisted_control_updated_signal .emit )
@@ -269,11 +274,22 @@ def _baro_data_received(self, timestamp, data, logconf):
269274
270275 def _heighthold_input_updated (self , roll , pitch , yaw , height ):
271276 if (self .isVisible () and
272- ((self .helper .inputDeviceReader .get_assisted_control () ==
273- self .helper .inputDeviceReader .ASSISTED_CONTROL_HEIGHTHOLD ) or
274- (self .helper .inputDeviceReader .get_assisted_control () ==
275- self .helper .inputDeviceReader .ASSISTED_CONTROL_HOVER ))):
276- self .targetHeight .setText (("%.2f" % height ))
277+ (self .helper .inputDeviceReader .get_assisted_control () ==
278+ self .helper .inputDeviceReader .ASSISTED_CONTROL_HEIGHTHOLD )):
279+ self .targetRoll .setText (("%0.2f deg" % roll ))
280+ self .targetPitch .setText (("%0.2f deg" % pitch ))
281+ self .targetYaw .setText (("%0.2f deg/s" % yaw ))
282+ self .targetHeight .setText (("%.2f m" % height ))
283+ self .ai .setHover (height , self .is_visible ())
284+
285+ def _hover_input_updated (self , vx , vy , yaw , height ):
286+ if (self .isVisible () and
287+ (self .helper .inputDeviceReader .get_assisted_control () ==
288+ self .helper .inputDeviceReader .ASSISTED_CONTROL_HOVER )):
289+ self .targetRoll .setText (("%0.2f m/s" % vy ))
290+ self .targetPitch .setText (("%0.2f m/s" % vx ))
291+ self .targetYaw .setText (("%0.2f deg/s" % yaw ))
292+ self .targetHeight .setText (("%.2f m" % height ))
277293 self .ai .setHover (height , self .is_visible ())
278294
279295 def _imu_data_received (self , timestamp , data , logconf ):
@@ -431,9 +447,9 @@ def calUpdateFromInput(self, rollCal, pitchCal):
431447 self .targetCalPitch .setValue (pitchCal )
432448
433449 def updateInputControl (self , roll , pitch , yaw , thrust ):
434- self .targetRoll .setText (("%0.2f" % roll ))
435- self .targetPitch .setText (("%0.2f" % pitch ))
436- self .targetYaw .setText (("%0.2f" % yaw ))
450+ self .targetRoll .setText (("%0.2f deg " % roll ))
451+ self .targetPitch .setText (("%0.2f deg " % pitch ))
452+ self .targetYaw .setText (("%0.2f deg/s " % yaw ))
437453 self .targetThrust .setText (("%0.2f %%" %
438454 self .thrustToPercentage (thrust )))
439455 self .thrustProgress .setValue (thrust )
@@ -622,10 +638,13 @@ def _populate_assisted_mode_dropdown(self):
622638
623639 try :
624640 assistmodeComboIndex = Config ().get ("assistedControl" )
625- if assistmodeComboIndex == 2 and not heightHoldPossible :
641+ if assistmodeComboIndex == 3 and not hoverPossible :
626642 self ._assist_mode_combo .setCurrentIndex (0 )
627643 self ._assist_mode_combo .currentIndexChanged .emit (0 )
628- elif assistmodeComboIndex == 3 and hoverPossible :
644+ elif assistmodeComboIndex == 0 and hoverPossible :
645+ self ._assist_mode_combo .setCurrentIndex (3 )
646+ self ._assist_mode_combo .currentIndexChanged .emit (3 )
647+ elif assistmodeComboIndex == 2 and not heightHoldPossible :
629648 self ._assist_mode_combo .setCurrentIndex (0 )
630649 self ._assist_mode_combo .currentIndexChanged .emit (0 )
631650 elif assistmodeComboIndex == 0 and heightHoldPossible :
@@ -637,7 +656,9 @@ def _populate_assisted_mode_dropdown(self):
637656 assistmodeComboIndex )
638657 except KeyError :
639658 defaultOption = 0
640- if heightHoldPossible :
659+ if hoverPossible :
660+ defaultOption = 3
661+ elif heightHoldPossible :
641662 defaultOption = 2
642663 self ._assist_mode_combo .setCurrentIndex (defaultOption )
643664 self ._assist_mode_combo .currentIndexChanged .emit (defaultOption )
0 commit comments