WiKi
HUD即Head Up Display,用于显示无人机的三个姿态角,即俯仰角(Pitch)、翻滚角(Roll)、偏航角(Yaw)。例如下面的视图。
相关资料
gitHub主页:https://github.com/fengdingfeilong/HUD
使用
从GitHub上下载后,用VS2015打开,直接运行,即可直接运行出来里面的实例。可以点击解决方案中HUD工程,build出DLL文件。
查看HudSample代码,使用HUD相当简单,只有一行代码。
<Window x:Class="HUDSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:HUDSample"
xmlns:hud="clr-namespace:HUD;assembly=HUD"
mc:Ignorable="d"
Title="MainWindow" Height="800" Width="1200">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<hud:HUDControl YawAngle="{Binding ElementName=Slider_Yaw,Path=Value,Mode=TwoWay}" PitchAngle="{Binding ElementName=Slider_Pitch,Path=Value}" RollAngle="{Binding ElementName=Slider_Roll,Path=Value}" MaxRollAngle="80"/>
<Border Grid.Column="1">
<Grid Width="300" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="航向角" VerticalAlignment="Center"/>
<Slider Name="Slider_Yaw" Grid.Column="1" Minimum="-180" Maximum="180" Value="0" TickFrequency="20" TickPlacement="BottomRight" VerticalAlignment="Center"/>
<TextBlock Text="俯仰角" VerticalAlignment="Center" Grid.Row="1"/>
<Slider Name="Slider_Pitch" Grid.Column="1" Grid.Row="1" Minimum="-90" Maximum="90" Value="0" TickFrequency="10" TickPlacement="BottomRight" VerticalAlignment="Center"/>
<TextBlock Text="翻转角" VerticalAlignment="Center" Grid.Row="2"/>
<Slider Name="Slider_Roll" Grid.Column="1" Grid.Row="2" Minimum="-180" Maximum="180" Value="0" TickFrequency="20" TickPlacement="BottomRight" VerticalAlignment="Center"/>
</Grid>
</Border>
</Grid>
</Window>