Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.GimbalAI
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.GimbalAI
Commits
184ebf26
Commit
184ebf26
authored
Sep 15, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新轴跟踪逻辑
parent
c2b96bb8
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
101 additions
and
110 deletions
+101
-110
VIZ.GimbalAI.Client/config/config.ini
+3
-3
VIZ.GimbalAI.Connection/UDP/Gimbal/Provider/GimbalCenterAxisProvider.cs
+14
-14
VIZ.GimbalAI.Domain/Message/Gimbal/GimbalCenterAxisMessage.cs
+0
-24
VIZ.GimbalAI.Domain/Model/Gimbal/GimbalControlModel.cs
+25
-0
VIZ.GimbalAI.Domain/VIZ.GimbalAI.Domain.csproj
+0
-1
VIZ.GimbalAI.Module/ControlView/View/ControlView.xaml
+2
-3
VIZ.GimbalAI.Module/MainView/Controller/Hotkey/HotkeyController.cs
+4
-14
VIZ.GimbalAI.Module/MainView/View/MainView.xaml
+3
-3
VIZ.GimbalAI.Module/MainView/ViewModel/MainViewModel.cs
+18
-20
VIZ.GimbalAI.Module/Setup/Provider/Setup/AppSetup_InitCenterAxis.cs
+4
-4
VIZ.GimbalAI.Module/VideoView/ViewModel/VideoViewModel.cs
+28
-24
No files found.
VIZ.GimbalAI.Client/config/config.ini
View file @
184ebf26
...
@@ -23,8 +23,8 @@ CLIENT_BINDING_IP=192.168.0.124
...
@@ -23,8 +23,8 @@ CLIENT_BINDING_IP=192.168.0.124
;客户端UDP绑定端口
;客户端UDP绑定端口
CLIENT_BINDING_PORT
=
8000
CLIENT_BINDING_PORT
=
8000
;算法UDP绑定IP
;算法UDP绑定IP
ALGORITHM_BINDING_IP
=
192.168.0.117
;
ALGORITHM_BINDING_IP=192.168.0.117
;
ALGORITHM_BINDING_IP=127.0.0.1
ALGORITHM_BINDING_IP
=
127.0.0.1
;算法UDP绑定端口
;算法UDP绑定端口
ALGORITHM_BINDING_PORT
=
8001
ALGORITHM_BINDING_PORT
=
8001
;云台UDP绑定IP
;云台UDP绑定IP
...
@@ -55,7 +55,7 @@ ALGORITHM_CMD_WINDOW_STYLE=Minimized
...
@@ -55,7 +55,7 @@ ALGORITHM_CMD_WINDOW_STYLE=Minimized
; ============================================================
; ============================================================
[Gimbal]
[Gimbal]
;云台中心轴移动速度
;云台中心轴移动速度
GIMBAL_CENTER_AXIS_SPEED
=
2
GIMBAL_CENTER_AXIS_SPEED
=
3
;云台中心轴X值
;云台中心轴X值
GIMBAL_CENTER_AXIS_X
=
960
GIMBAL_CENTER_AXIS_X
=
960
;云台中心轴Y值
;云台中心轴Y值
...
...
VIZ.GimbalAI.Connection/UDP/Gimbal/Provider/GimbalCenterAxisProvider.cs
View file @
184ebf26
...
@@ -37,22 +37,22 @@ namespace VIZ.GimbalAI.Connection
...
@@ -37,22 +37,22 @@ namespace VIZ.GimbalAI.Connection
return
;
return
;
// 更新坐标位置
// 更新坐标位置
double
x
=
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisX
+
(
package
.
h
>
0
?
1
:
-
1
)
*
GIMBAL_CENTER_AXIS_SPEED
;
double
x
=
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisX
;
double
y
=
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisY
+
(
package
.
v
>
0
?
1
:
-
1
)
*
GIMBAL_CENTER_AXIS_SPEED
;
double
y
=
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisY
;
x
=
MathHelper
.
Clip
(
0
,
1920
,
x
);
y
=
MathHelper
.
Clip
(
0
,
1080
,
y
);
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisX
=
x
;
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisY
=
y
;
// 向算法发送最新的中心轴位置
if
(
package
.
h
!=
0
)
UdpEndpointManager
manager
=
ConnectionManager
.
UdpConnection
.
GetEndpointManager
(
UdpEndpointKeys
.
algorithm
);
{
AlgorithmSender
.
CenterAxis
(
manager
);
x
+=
(
package
.
h
>
0
?
-
1
:
1
)
*
GIMBAL_CENTER_AXIS_SPEED
;
}
if
(
package
.
v
!=
0
)
{
y
+=
(
package
.
v
>
0
?
-
1
:
1
)
*
GIMBAL_CENTER_AXIS_SPEED
;
}
// 向界面发送更新轴信息消息
x
=
MathHelper
.
Clip
(
0
,
1920
,
x
);
GimbalCenterAxisMessage
message
=
new
GimbalCenterAxisMessage
();
y
=
MathHelper
.
Clip
(
0
,
1080
,
y
);
message
.
X
=
x
;
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisX
=
x
;
message
.
Y
=
y
;
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisY
=
y
;
ApplicationDomainEx
.
MessageManager
.
Send
(
message
);
}
}
}
}
}
}
VIZ.GimbalAI.Domain/Message/Gimbal/GimbalCenterAxisMessage.cs
deleted
100644 → 0
View file @
c2b96bb8
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.GimbalAI.Domain
{
/// <summary>
/// 云台中心轴消息
/// </summary>
public
class
GimbalCenterAxisMessage
{
/// <summary>
/// 中心轴X坐标
/// </summary>
public
double
X
{
get
;
set
;
}
/// <summary>
/// 中心轴Y坐标
/// </summary>
public
double
Y
{
get
;
set
;
}
}
}
VIZ.GimbalAI.Domain/Model/Gimbal/GimbalControlModel.cs
View file @
184ebf26
...
@@ -13,13 +13,38 @@ namespace VIZ.GimbalAI.Domain
...
@@ -13,13 +13,38 @@ namespace VIZ.GimbalAI.Domain
public
class
GimbalControlModel
:
ModelBase
public
class
GimbalControlModel
:
ModelBase
{
{
/// <summary>
/// <summary>
/// 目标中心轴X坐标
/// </summary>
public
double
TargetCenterAxisX
{
get
;
set
;
}
=
1920
/
2
;
/// <summary>
/// 中心轴X坐标
/// 中心轴X坐标
/// </summary>
/// </summary>
public
double
CenterAxisX
{
get
;
set
;
}
=
1920
/
2
;
public
double
CenterAxisX
{
get
;
set
;
}
=
1920
/
2
;
/// <summary>
/// <summary>
/// 目标中心轴Y坐标
/// </summary>
public
double
TargetCenterAxisY
{
get
;
set
;
}
=
1080
/
2
;
/// <summary>
/// 中心轴Y坐标
/// 中心轴Y坐标
/// </summary>
/// </summary>
public
double
CenterAxisY
{
get
;
set
;
}
=
1080
/
2
;
public
double
CenterAxisY
{
get
;
set
;
}
=
1080
/
2
;
/// <summary>
/// 更新中心轴
/// </summary>
/// <returns>中心轴是否有变化</returns>
public
bool
UpdateCenterAxis
()
{
if
(
this
.
CenterAxisX
==
this
.
TargetCenterAxisX
&&
this
.
CenterAxisY
==
this
.
TargetCenterAxisY
)
return
false
;
this
.
CenterAxisX
=
this
.
TargetCenterAxisX
;
this
.
CenterAxisY
=
this
.
TargetCenterAxisY
;
return
true
;
}
}
}
}
}
VIZ.GimbalAI.Domain/VIZ.GimbalAI.Domain.csproj
View file @
184ebf26
...
@@ -85,7 +85,6 @@
...
@@ -85,7 +85,6 @@
<ItemGroup>
<ItemGroup>
<Compile Include="Enum\NDIViewKeys.cs" />
<Compile Include="Enum\NDIViewKeys.cs" />
<Compile Include="Enum\ServiceKeys.cs" />
<Compile Include="Enum\ServiceKeys.cs" />
<Compile Include="Message\Gimbal\GimbalCenterAxisMessage.cs" />
<Compile Include="Message\Gimbal\GimbalInitCompleteMessage.cs" />
<Compile Include="Message\Gimbal\GimbalInitCompleteMessage.cs" />
<Compile Include="Model\Gimbal\GimbalControlModel.cs" />
<Compile Include="Model\Gimbal\GimbalControlModel.cs" />
<Compile Include="Model\NDI\NdiStreamGroupModel.cs" />
<Compile Include="Model\NDI\NdiStreamGroupModel.cs" />
...
...
VIZ.GimbalAI.Module/ControlView/View/ControlView.xaml
View file @
184ebf26
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
<Grid>
<Grid>
<Grid.RowDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="300"></RowDefinition>
</Grid.RowDefinitions>
</Grid.RowDefinitions>
<Grid IsEnabled="{Binding Path=IsEnabled,Mode=OneWay}">
<Grid IsEnabled="{Binding Path=IsEnabled,Mode=OneWay}">
<Grid.RowDefinitions>
<Grid.RowDefinitions>
...
@@ -115,8 +114,8 @@
...
@@ -115,8 +114,8 @@
</Grid>
</Grid>
<!-- 控制台输出 -->
<!-- 控制台输出 -->
<Border Grid.Row="1">
<
!--<
Border Grid.Row="1">
<local:ConsoleView></local:ConsoleView>
<local:ConsoleView></local:ConsoleView>
</Border>
</Border>
-->
</Grid>
</Grid>
</UserControl>
</UserControl>
VIZ.GimbalAI.Module/MainView/Controller/Hotkey/HotkeyController.cs
View file @
184ebf26
...
@@ -48,8 +48,8 @@ namespace VIZ.GimbalAI.Module
...
@@ -48,8 +48,8 @@ namespace VIZ.GimbalAI.Module
/// <param name="e">事件参数</param>
/// <param name="e">事件参数</param>
public
void
MoveCenterAxis
(
KeyEventArgs
e
)
public
void
MoveCenterAxis
(
KeyEventArgs
e
)
{
{
double
x
=
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisX
;
double
x
=
ApplicationDomainEx
.
GimbalControlModel
.
Target
CenterAxisX
;
double
y
=
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisY
;
double
y
=
ApplicationDomainEx
.
GimbalControlModel
.
Target
CenterAxisY
;
if
(
e
.
KeyCode
==
Keys
.
Left
)
if
(
e
.
KeyCode
==
Keys
.
Left
)
{
{
...
@@ -70,18 +70,8 @@ namespace VIZ.GimbalAI.Module
...
@@ -70,18 +70,8 @@ namespace VIZ.GimbalAI.Module
x
=
MathHelper
.
Clip
(
0
,
1920
,
x
);
x
=
MathHelper
.
Clip
(
0
,
1920
,
x
);
y
=
MathHelper
.
Clip
(
0
,
1080
,
y
);
y
=
MathHelper
.
Clip
(
0
,
1080
,
y
);
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisX
=
x
;
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisX
=
x
;
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisY
=
y
;
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisY
=
y
;
// 向算法发送最新的中心轴位置
UdpEndpointManager
manager
=
ConnectionManager
.
UdpConnection
.
GetEndpointManager
(
UdpEndpointKeys
.
algorithm
);
AlgorithmSender
.
CenterAxis
(
manager
);
// 向界面发送更新轴信息消息
GimbalCenterAxisMessage
message
=
new
GimbalCenterAxisMessage
();
message
.
X
=
x
;
message
.
Y
=
y
;
ApplicationDomainEx
.
MessageManager
.
Send
(
message
);
}
}
}
}
}
}
VIZ.GimbalAI.Module/MainView/View/MainView.xaml
View file @
184ebf26
...
@@ -44,9 +44,9 @@
...
@@ -44,9 +44,9 @@
<TextBlock Text="调试信息 --" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="调试信息 --" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="算法FPS:" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="算法FPS:" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="{Binding Path=AlgorithmFPS.FPS,Mode=OneWay}" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="{Binding Path=AlgorithmFPS.FPS,Mode=OneWay}" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
<
TextBlock Text="云台FPS:" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
<
Button Width="120" Height="30" Margin="10,0,10,0" Content="重启算法"
<TextBlock Text="{Binding Path=GimbalFPS.FPS,Mode=OneWay}" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
IsEnabled="{Binding Path=IsRestartAlgorithmEnabled,Mode=OneWay}"
<Button Width="120" Height="30" Margin="10,0,10,0" Content="重启算法" Command="{Binding Path=RestartAlgorithmCommand
}"></Button>
Command="{Binding Path=RestartAlgorithmCommand,Mode=OneWay
}"></Button>
</StackPanel>
</StackPanel>
</common:DebugBorder>
</common:DebugBorder>
</StackPanel>
</StackPanel>
...
...
VIZ.GimbalAI.Module/MainView/ViewModel/MainViewModel.cs
View file @
184ebf26
...
@@ -52,7 +52,6 @@ namespace VIZ.GimbalAI.Module
...
@@ -52,7 +52,6 @@ namespace VIZ.GimbalAI.Module
private
void
InitFPS
()
private
void
InitFPS
()
{
{
this
.
AlgorithmFPS
.
Start
();
this
.
AlgorithmFPS
.
Start
();
this
.
GimbalFPS
.
Start
();
}
}
/// <summary>
/// <summary>
...
@@ -74,7 +73,7 @@ namespace VIZ.GimbalAI.Module
...
@@ -74,7 +73,7 @@ namespace VIZ.GimbalAI.Module
private
void
InitMessage
()
private
void
InitMessage
()
{
{
ApplicationDomainEx
.
MessageManager
.
Register
<
VideoRenderRectangleMessage
>(
this
,
this
.
VideoRenderRectangle
);
ApplicationDomainEx
.
MessageManager
.
Register
<
VideoRenderRectangleMessage
>(
this
,
this
.
VideoRenderRectangle
);
ApplicationDomainEx
.
MessageManager
.
Register
<
GimbalCenterAxisMessage
>(
this
,
this
.
GimbalCenterAxis
);
ApplicationDomainEx
.
MessageManager
.
Register
<
AlgorithmInitCompleteMessage
>(
this
,
this
.
AlgorithmInitComplete
);
}
}
/// <summary>
/// <summary>
...
@@ -151,30 +150,30 @@ namespace VIZ.GimbalAI.Module
...
@@ -151,30 +150,30 @@ namespace VIZ.GimbalAI.Module
#
endregion
#
endregion
#
region
AlgorithmFPS
--
算法
FPS
模型
#
region
IsRestartAlgorithmEnabled
--
重启算法按钮是否可用
private
FPSHelper
algorithmFPS
=
new
FPSHelper
()
;
private
bool
isRestartAlgorithmEnabled
;
/// <summary>
/// <summary>
///
算法FPS模型
///
重启算法按钮是否可用
/// </summary>
/// </summary>
public
FPSHelper
AlgorithmFPS
public
bool
IsRestartAlgorithmEnabled
{
{
get
{
return
algorithmFPS
;
}
get
{
return
isRestartAlgorithmEnabled
;
}
set
{
algorithmFPS
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
AlgorithmFPS
));
}
set
{
isRestartAlgorithmEnabled
=
value
;
this
.
RaisePropertySaveChanged
(
nameof
(
IsRestartAlgorithmEnabled
));
}
}
}
#
endregion
#
endregion
#
region
GimbalFPS
--
云台
FPS
模型
#
region
AlgorithmFPS
--
算法
FPS
模型
private
FPSHelper
gimbal
FPS
=
new
FPSHelper
();
private
FPSHelper
algorithm
FPS
=
new
FPSHelper
();
/// <summary>
/// <summary>
///
云台
FPS模型
///
算法
FPS模型
/// </summary>
/// </summary>
public
FPSHelper
Gimbal
FPS
public
FPSHelper
Algorithm
FPS
{
{
get
{
return
gimbal
FPS
;
}
get
{
return
algorithm
FPS
;
}
set
{
gimbalFPS
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Gimbal
FPS
));
}
set
{
algorithmFPS
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Algorithm
FPS
));
}
}
}
#
endregion
#
endregion
...
@@ -321,6 +320,7 @@ namespace VIZ.GimbalAI.Module
...
@@ -321,6 +320,7 @@ namespace VIZ.GimbalAI.Module
/// </summary>
/// </summary>
private
void
RestartAlgorithm
()
private
void
RestartAlgorithm
()
{
{
this
.
IsRestartAlgorithmEnabled
=
false
;
this
.
AlgorithmController
.
Restart
();
this
.
AlgorithmController
.
Restart
();
}
}
...
@@ -371,20 +371,18 @@ namespace VIZ.GimbalAI.Module
...
@@ -371,20 +371,18 @@ namespace VIZ.GimbalAI.Module
#
endregion
#
endregion
#
region
GimbalCenterAxisMessage
--
云台中心轴改变
消息
#
region
AlgorithmInitCompleteMessage
--
算法初始化完成
消息
/// <summary>
/// <summary>
///
云台中心轴改变消息
///
算法初始化完成
/// </summary>
/// </summary>
/// <param name="msg">消息</param>
/// <param name="msg">消息</param>
p
rivate
void
GimbalCenterAxis
(
GimbalCenterAxis
Message
msg
)
p
ublic
void
AlgorithmInitComplete
(
AlgorithmInitComplete
Message
msg
)
{
{
// 统计FPS
this
.
IsRestartAlgorithmEnabled
=
true
;
this
.
GimbalFPS
.
CalcFps
();
}
}
#
endregion
#
endregion
// ======================================================================================
// ======================================================================================
// === Private Function ===
// === Private Function ===
// ======================================================================================
// ======================================================================================
...
...
VIZ.GimbalAI.Module/Setup/Provider/Setup/AppSetup_InitCenterAxis.cs
View file @
184ebf26
...
@@ -33,8 +33,8 @@ namespace VIZ.GimbalAI.Module
...
@@ -33,8 +33,8 @@ namespace VIZ.GimbalAI.Module
/// <returns>是否成功执行</returns>
/// <returns>是否成功执行</returns>
public
override
bool
Setup
(
AppSetupContext
context
)
public
override
bool
Setup
(
AppSetupContext
context
)
{
{
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisX
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
int
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_X
);
ApplicationDomainEx
.
GimbalControlModel
.
Target
CenterAxisX
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
int
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_X
);
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisY
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
int
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_Y
);
ApplicationDomainEx
.
GimbalControlModel
.
Target
CenterAxisY
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
int
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_Y
);
ApplicationDomainEx
.
LoopManager
.
Register
(
"AppSetup_InitCenterAxis.Setup"
,
30
,
()
=>
ApplicationDomainEx
.
LoopManager
.
Register
(
"AppSetup_InitCenterAxis.Setup"
,
30
,
()
=>
{
{
...
@@ -60,8 +60,8 @@ namespace VIZ.GimbalAI.Module
...
@@ -60,8 +60,8 @@ namespace VIZ.GimbalAI.Module
{
{
try
try
{
{
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_X
,
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisX
);
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_X
,
ApplicationDomainEx
.
GimbalControlModel
.
Target
CenterAxisX
);
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_Y
,
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisY
);
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_Y
,
ApplicationDomainEx
.
GimbalControlModel
.
Target
CenterAxisY
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
...
VIZ.GimbalAI.Module/VideoView/ViewModel/VideoViewModel.cs
View file @
184ebf26
...
@@ -18,6 +18,7 @@ using OpenCvSharp.WpfExtensions;
...
@@ -18,6 +18,7 @@ using OpenCvSharp.WpfExtensions;
using
OpenCvSharp.Extensions
;
using
OpenCvSharp.Extensions
;
using
SharpDX.Mathematics.Interop
;
using
SharpDX.Mathematics.Interop
;
using
VIZ.Framework.Storage
;
using
VIZ.Framework.Storage
;
using
System.Windows.Interop
;
namespace
VIZ.GimbalAI.Module
namespace
VIZ.GimbalAI.Module
{
{
...
@@ -84,7 +85,7 @@ namespace VIZ.GimbalAI.Module
...
@@ -84,7 +85,7 @@ namespace VIZ.GimbalAI.Module
CenterAxisInfo
centerAxisInfo
=
new
CenterAxisInfo
();
CenterAxisInfo
centerAxisInfo
=
new
CenterAxisInfo
();
centerAxisInfo
.
AxisWidth
=
this
.
VIDEO_CENTER_AXIS_WIDTH
;
centerAxisInfo
.
AxisWidth
=
this
.
VIDEO_CENTER_AXIS_WIDTH
;
centerAxisInfo
.
AxisColor
=
this
.
VIDEO_CENTER_AXIS_COLOR
;
centerAxisInfo
.
AxisColor
=
this
.
VIDEO_CENTER_AXIS_COLOR
;
centerAxisInfo
.
SrcCenter
=
new
RawVector2
((
float
)
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisX
,
(
float
)
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisY
);
centerAxisInfo
.
SrcCenter
=
new
RawVector2
((
float
)
ApplicationDomainEx
.
GimbalControlModel
.
TargetCenterAxisX
,
(
float
)
ApplicationDomainEx
.
GimbalControlModel
.
Target
CenterAxisY
);
this
.
centerAxisPlugin
.
Update
(
centerAxisInfo
);
this
.
centerAxisPlugin
.
Update
(
centerAxisInfo
);
}
}
...
@@ -102,7 +103,6 @@ namespace VIZ.GimbalAI.Module
...
@@ -102,7 +103,6 @@ namespace VIZ.GimbalAI.Module
private
void
InitMessage
()
private
void
InitMessage
()
{
{
ApplicationDomainEx
.
MessageManager
.
Register
<
VideoRenderRectangleMessage
>(
this
,
this
.
VideoRenderRectangle
);
ApplicationDomainEx
.
MessageManager
.
Register
<
VideoRenderRectangleMessage
>(
this
,
this
.
VideoRenderRectangle
);
ApplicationDomainEx
.
MessageManager
.
Register
<
GimbalCenterAxisMessage
>(
this
,
this
.
GimbalCenterAxis
);
}
}
/// <summary>
/// <summary>
...
@@ -342,28 +342,6 @@ namespace VIZ.GimbalAI.Module
...
@@ -342,28 +342,6 @@ namespace VIZ.GimbalAI.Module
#
endregion
#
endregion
#
region
GimbalCenterAxisMessage
--
中心轴更新消息
/// <summary>
/// 中心轴更新消息
/// </summary>
/// <param name="msg">消息</param>
private
void
GimbalCenterAxis
(
GimbalCenterAxisMessage
msg
)
{
VideoView
view
=
this
.
GetView
<
VideoView
>();
if
(
view
==
null
)
return
;
CenterAxisInfo
info
=
new
CenterAxisInfo
();
info
.
SrcCenter
=
new
RawVector2
((
float
)
msg
.
X
,
(
float
)
msg
.
Y
);
info
.
AxisWidth
=
this
.
VIDEO_CENTER_AXIS_WIDTH
;
info
.
AxisColor
=
this
.
VIDEO_CENTER_AXIS_COLOR
;
view
.
videoControl
.
UpdateCenterAxis
(
info
);
}
#
endregion
// ======================================================================================
// ======================================================================================
// === Public Function ===
// === Public Function ===
// ======================================================================================
// ======================================================================================
...
@@ -440,7 +418,33 @@ namespace VIZ.GimbalAI.Module
...
@@ -440,7 +418,33 @@ namespace VIZ.GimbalAI.Module
if
(
view
==
null
)
if
(
view
==
null
)
return
;
return
;
// 更新视频
view
.
videoControl
.
UpdateVideoFrame
(
e
.
Frame
);
view
.
videoControl
.
UpdateVideoFrame
(
e
.
Frame
);
// 更新中心轴
this
.
UpdateCenterAxis
(
view
);
}
/// <summary>
/// 更新中心轴
/// </summary>
/// <param name="view">视图</param>
private
void
UpdateCenterAxis
(
VideoView
view
)
{
if
(!
ApplicationDomainEx
.
GimbalControlModel
.
UpdateCenterAxis
())
return
;
// 界面更新
CenterAxisInfo
info
=
new
CenterAxisInfo
();
info
.
SrcCenter
=
new
RawVector2
((
float
)
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisX
,
(
float
)
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisY
);
info
.
AxisWidth
=
this
.
VIDEO_CENTER_AXIS_WIDTH
;
info
.
AxisColor
=
this
.
VIDEO_CENTER_AXIS_COLOR
;
view
.
videoControl
.
UpdateCenterAxis
(
info
);
// 向算法发送最新的中心轴位置
UdpEndpointManager
manager
=
ConnectionManager
.
UdpConnection
.
GetEndpointManager
(
UdpEndpointKeys
.
algorithm
);
AlgorithmSender
.
CenterAxis
(
manager
);
}
}
/// <summary>
/// <summary>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment