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
d46b8ca0
Commit
d46b8ca0
authored
Sep 14, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加算法控制器
parent
e828ccee
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
387 additions
and
20 deletions
+387
-20
VIZ.GimbalAI.Client/App.xaml.cs
+2
-0
VIZ.GimbalAI.Client/config/config.ini
+15
-7
VIZ.GimbalAI.Module/ControlView/Service/IControlViewService.cs
+5
-0
VIZ.GimbalAI.Module/MainView/Controller/Algorithm/AlgorithmController.cs
+126
-0
VIZ.GimbalAI.Module/MainView/Controller/Algorithm/IAlgorithmSupport.cs
+16
-0
VIZ.GimbalAI.Module/MainView/View/MainView.xaml
+12
-1
VIZ.GimbalAI.Module/MainView/ViewModel/MainViewModel.cs
+104
-10
VIZ.GimbalAI.Module/Setup/Provider/Setup/AppSetup_InitCenterAxis.cs
+72
-0
VIZ.GimbalAI.Module/VIZ.GimbalAI.Module.csproj
+3
-0
VIZ.GimbalAI.Module/VideoView/ViewModel/VideoViewModel.cs
+13
-1
VIZ.GimbalAI.Storage/Ini/Config/AlgorithmConfig.cs
+7
-1
VIZ.GimbalAI.Storage/Ini/Config/GimbalConfig.cs
+12
-0
No files found.
VIZ.GimbalAI.Client/App.xaml.cs
View file @
d46b8ca0
...
@@ -22,6 +22,8 @@ namespace VIZ.GimbalAI.Client
...
@@ -22,6 +22,8 @@ namespace VIZ.GimbalAI.Client
AppSetup
.
AppendSetup
(
new
AppSetup_InitCSV
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitCSV
());
// 初始化 LiteDB
// 初始化 LiteDB
AppSetup
.
AppendSetup
(
new
AppSetup_InitLiteDB
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitLiteDB
());
// 初始化中心轴
AppSetup
.
AppendSetup
(
new
AppSetup_InitCenterAxis
());
// 初始化 NDI
// 初始化 NDI
AppSetup
.
AppendSetup
(
new
AppSetup_InitNDI
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitNDI
());
// 初始化 UDP
// 初始化 UDP
...
...
VIZ.GimbalAI.Client/config/config.ini
View file @
d46b8ca0
; ============================================================
; ============================================================
; === Application ===
; ============================================================
[Application]
;是否是调试模式
APPLICATION_IS_DEBUG
=
true
; ============================================================
; === Client ===
; === Client ===
; ============================================================
; ============================================================
[Client]
[Client]
...
@@ -36,9 +42,11 @@ NDI_STREAM_NAME=LAPTOP-6ESNHBU6 (Test Pattern)
...
@@ -36,9 +42,11 @@ NDI_STREAM_NAME=LAPTOP-6ESNHBU6 (Test Pattern)
; === Algorithm ===
; === Algorithm ===
; ============================================================
; ============================================================
[Algorithm]
[Algorithm]
;python.exe 进程路径 或 python命令
ALGORITHM_PYTHON_PATH
=
python
;算法启动 绝对路径 或 相对路径(相对于智能云台跟踪系统EXE文件的路径)
;算法启动 绝对路径 或 相对路径(相对于智能云台跟踪系统EXE文件的路径)
;ALGORITHM_SETUP_PATH=..\python\python.bat
;ALGORITHM_SETUP_PATH=..\python\python.bat
ALGORITHM_SETUP_PATH
=
C:
\U
sers
\a
dmin
\D
esktop
\o
bject_tracker
\
s
tart.bat
ALGORITHM_SETUP_PATH
=
C:
\U
sers
\a
dmin
\D
esktop
\o
bject_tracker
\
m
ain.py
;算法命令行窗口显示样式
;算法命令行窗口显示样式
;Normal | Hidden | Minimized | Maximized
;Normal | Hidden | Minimized | Maximized
ALGORITHM_CMD_WINDOW_STYLE
=
Minimized
ALGORITHM_CMD_WINDOW_STYLE
=
Minimized
...
@@ -46,13 +54,12 @@ ALGORITHM_CMD_WINDOW_STYLE=Minimized
...
@@ -46,13 +54,12 @@ ALGORITHM_CMD_WINDOW_STYLE=Minimized
; === Gimbal ===
; === Gimbal ===
; ============================================================
; ============================================================
[Gimbal]
[Gimbal]
;云台启动 绝对路径 或 相对路径(相对于智能云台跟踪系统EXE文件的路径)
GIMBAL_SETUP_PATH
=
..
\p
ython
\p
ython.bat
;云台命令行窗口显示样式
;Normal | Hidden | Minimized | Maximized
GIMBAL_CMD_WINDOW_STYLE
=
Minimized
;云台中心轴移动速度
;云台中心轴移动速度
GIMBAL_CENTER_AXIS_SPEED
=
1
GIMBAL_CENTER_AXIS_SPEED
=
1
;云台中心轴X值
GIMBAL_CENTER_AXIS_X
=
960
;云台中心轴Y值
GIMBAL_CENTER_AXIS_Y
=
540
; ============================================================
; ============================================================
; === Video ===
; === Video ===
; ============================================================
; ============================================================
...
@@ -88,6 +95,6 @@ VIDEO_SIDE_CHECK_POLYGON_OPACITY=0.15
...
@@ -88,6 +95,6 @@ VIDEO_SIDE_CHECK_POLYGON_OPACITY=0.15
;视频人工校准区域透明度
;视频人工校准区域透明度
VIDEO_MANUAL_CORRECTION_OPACITY
=
0.2
VIDEO_MANUAL_CORRECTION_OPACITY
=
0.2
;中心轴宽度
;中心轴宽度
VIDEO_CENTER_AXIS_WIDTH
=
2
VIDEO_CENTER_AXIS_WIDTH
=
3
;中心轴颜色
;中心轴颜色
VIDEO_CENTER_AXIS_COLOR
=
#44000000
VIDEO_CENTER_AXIS_COLOR
=
#44000000
\ No newline at end of file
VIZ.GimbalAI.Module/ControlView/Service/IControlViewService.cs
View file @
d46b8ca0
...
@@ -13,6 +13,11 @@ namespace VIZ.GimbalAI.Module
...
@@ -13,6 +13,11 @@ namespace VIZ.GimbalAI.Module
public
interface
IControlViewService
:
IService
public
interface
IControlViewService
:
IService
{
{
/// <summary>
/// <summary>
/// 面板是否可用
/// </summary>
bool
IsEnabled
{
get
;
set
;
}
/// <summary>
/// 是否是手动模式
/// 是否是手动模式
/// </summary>
/// </summary>
bool
IsManualModeChecked
{
get
;
}
bool
IsManualModeChecked
{
get
;
}
...
...
VIZ.GimbalAI.Module/MainView/Controller/Algorithm/AlgorithmController.cs
0 → 100644
View file @
d46b8ca0
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Common
;
using
VIZ.Framework.Domain
;
using
VIZ.GimbalAI.Domain
;
using
VIZ.GimbalAI.Storage
;
namespace
VIZ.GimbalAI.Module
{
/// <summary>
/// 算法控制器
/// </summary>
public
class
AlgorithmController
{
/// <summary>
/// 日志
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AlgorithmController
));
/// <summary>
/// 算法那控制器
/// </summary>
/// <param name="support">支持</param>
public
AlgorithmController
(
IAlgorithmSupport
support
)
{
this
.
Support
=
support
;
}
/// <summary>
/// 支持
/// </summary>
public
IAlgorithmSupport
Support
{
get
;
private
set
;
}
/// <summary>
/// python.exe 进程路径 或 python命令
/// </summary>
private
readonly
string
ALGORITHM_PYTHON_PATH
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
AlgorithmConfig
,
string
>(
p
=>
p
.
ALGORITHM_PYTHON_PATH
);
/// <summary>
/// 算法启动 绝对路径 或 相对路径(相对于智能云台跟踪系统EXE文件的路径)
/// </summary>
private
readonly
string
ALGORITHM_SETUP_PATH
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
AlgorithmConfig
,
string
>(
p
=>
p
.
ALGORITHM_SETUP_PATH
);
/// <summary>
/// 算法进程
/// </summary>
private
Process
Process
;
/// <summary>
/// 重启算法
/// </summary>
public
void
Restart
()
{
// 停止算法
this
.
Stop
();
// 启动算法
this
.
Start
();
}
/// <summary>
/// 启动算法
/// </summary>
private
void
Start
()
{
IControlViewService
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IControlViewService
>(
ServiceKeys
.
ControlView
);
if
(
service
==
null
)
return
;
service
.
IsEnabled
=
false
;
Task
.
Run
(()
=>
{
// 算法启动路径
string
fullPath
=
null
;
Uri
uri
=
new
Uri
(
this
.
ALGORITHM_SETUP_PATH
,
UriKind
.
RelativeOrAbsolute
);
if
(
uri
.
IsAbsoluteUri
)
{
fullPath
=
uri
.
LocalPath
;
}
else
{
fullPath
=
new
Uri
(
new
Uri
(
AppDomain
.
CurrentDomain
.
BaseDirectory
),
uri
).
LocalPath
;
}
Process
proc
=
new
Process
();
proc
.
StartInfo
.
UseShellExecute
=
true
;
proc
.
StartInfo
.
FileName
=
this
.
ALGORITHM_PYTHON_PATH
;
proc
.
StartInfo
.
Arguments
=
$"\"
{
fullPath
}
\""
;
proc
.
StartInfo
.
WindowStyle
=
ProcessWindowStyle
.
Normal
;
if
(!
proc
.
Start
())
{
log
.
Error
(
$"算法启动失败!"
);
MessageBoxEx
.
ShowDialog
(
$"算法启动失败!"
);
}
this
.
Process
=
proc
;
});
}
/// <summary>
/// 停止算法
/// </summary>
public
void
Stop
()
{
try
{
if
(
this
.
Process
==
null
)
return
;
this
.
Process
.
Kill
();
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
);
}
}
}
}
VIZ.GimbalAI.Module/MainView/Controller/Algorithm/IAlgorithmSupport.cs
0 → 100644
View file @
d46b8ca0
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.GimbalAI.Module
{
/// <summary>
/// 算法控制器支持
/// </summary>
public
interface
IAlgorithmSupport
{
}
}
VIZ.GimbalAI.Module/MainView/View/MainView.xaml
View file @
d46b8ca0
...
@@ -5,10 +5,11 @@
...
@@ -5,10 +5,11 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:module="clr-namespace:VIZ.GimbalAI.Module"
xmlns:module="clr-namespace:VIZ.GimbalAI.Module"
xmlns:common="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
d:DataContext="{d:DesignInstance Type=module:MainViewModel}"
d:DataContext="{d:DesignInstance Type=module:MainViewModel}"
Background="Black"
Background="Black"
mc:Ignorable="d"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1
2
00">
d:DesignHeight="800" d:DesignWidth="1
9
00">
<UserControl.Resources>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary.MergedDictionaries>
...
@@ -38,6 +39,16 @@
...
@@ -38,6 +39,16 @@
<!-- 标题 & 状态 -->
<!-- 标题 & 状态 -->
<StackPanel Orientation="Horizontal" Grid.ColumnSpan="3" Margin="10,0,0,10">
<StackPanel Orientation="Horizontal" Grid.ColumnSpan="3" Margin="10,0,0,10">
<TextBlock Text="智能云台跟拍系统" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="36" Foreground="White" ></TextBlock>
<TextBlock Text="智能云台跟拍系统" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="36" Foreground="White" ></TextBlock>
<common:DebugBorder Margin="20,0,20,10">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<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="{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>
<TextBlock Text="{Binding Path=GimbalFPS.FPS,Mode=OneWay}" FontSize="20" Foreground="Red" Margin="0,0,10,0"></TextBlock>
<Button Width="120" Height="30" Margin="10,0,10,0" Content="重启算法" Command="{Binding Path=RestartAlgorithmCommand}"></Button>
</StackPanel>
</common:DebugBorder>
</StackPanel>
</StackPanel>
<Border HorizontalAlignment="Right" VerticalAlignment="Center" Height="50" Width="240" Background="#22ffffff" Grid.Column="1" Margin="0,0,30,0">
<Border HorizontalAlignment="Right" VerticalAlignment="Center" Height="50" Width="240" Background="#22ffffff" Grid.Column="1" Margin="0,0,30,0">
<TextBlock Text="{Binding Path=StatusMessage,Mode=OneWay}"
<TextBlock Text="{Binding Path=StatusMessage,Mode=OneWay}"
...
...
VIZ.GimbalAI.Module/MainView/ViewModel/MainViewModel.cs
View file @
d46b8ca0
...
@@ -18,15 +18,30 @@ namespace VIZ.GimbalAI.Module
...
@@ -18,15 +18,30 @@ namespace VIZ.GimbalAI.Module
/// <summary>
/// <summary>
/// 主视图模型
/// 主视图模型
/// </summary>
/// </summary>
public
class
MainViewModel
:
ViewModelBase
public
class
MainViewModel
:
ViewModelBase
,
IAlgorithmSupport
{
{
public
MainViewModel
()
public
MainViewModel
()
{
{
// 初始化命令
// 初始化命令
this
.
InitCommand
();
this
.
InitCommand
();
// 初始化控制器
this
.
InitController
();
// 初始化消息
// 初始化消息
this
.
InitMessage
();
this
.
InitMessage
();
// 初始化FPS
this
.
InitFPS
();
}
/// <summary>
/// 初始化FPS
/// </summary>
private
void
InitFPS
()
{
this
.
AlgorithmFPS
.
Start
();
this
.
GimbalFPS
.
Start
();
}
}
/// <summary>
/// <summary>
...
@@ -39,6 +54,7 @@ namespace VIZ.GimbalAI.Module
...
@@ -39,6 +54,7 @@ namespace VIZ.GimbalAI.Module
this
.
MinCommand
=
new
VCommand
(
this
.
Min
);
this
.
MinCommand
=
new
VCommand
(
this
.
Min
);
this
.
ChangeNdiCommand
=
new
VCommand
(
this
.
ChangeNdi
);
this
.
ChangeNdiCommand
=
new
VCommand
(
this
.
ChangeNdi
);
this
.
ChangeNdiVideoDelayCommand
=
new
VCommand
(
this
.
ChangeNdiVideoDelay
);
this
.
ChangeNdiVideoDelayCommand
=
new
VCommand
(
this
.
ChangeNdiVideoDelay
);
this
.
RestartAlgorithmCommand
=
new
VCommand
(
this
.
RestartAlgorithm
);
}
}
/// <summary>
/// <summary>
...
@@ -47,9 +63,27 @@ namespace VIZ.GimbalAI.Module
...
@@ -47,9 +63,27 @@ 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>
private
void
InitController
()
{
this
.
AlgorithmController
=
new
AlgorithmController
(
this
);
}
}
// ======================================================================================
// ======================================================================================
// === Controller ===
// ======================================================================================
/// <summary>
/// 算法控制器
/// </summary>
private
AlgorithmController
AlgorithmController
;
// ======================================================================================
// === Property ===
// === Property ===
// ======================================================================================
// ======================================================================================
...
@@ -81,6 +115,34 @@ namespace VIZ.GimbalAI.Module
...
@@ -81,6 +115,34 @@ namespace VIZ.GimbalAI.Module
#
endregion
#
endregion
#
region
AlgorithmFPS
--
算法
FPS
模型
private
FPSHelper
algorithmFPS
=
new
FPSHelper
();
/// <summary>
/// 算法FPS模型
/// </summary>
public
FPSHelper
AlgorithmFPS
{
get
{
return
algorithmFPS
;
}
set
{
algorithmFPS
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
AlgorithmFPS
));
}
}
#
endregion
#
region
GimbalFPS
--
云台
FPS
模型
private
FPSHelper
gimbalFPS
=
new
FPSHelper
();
/// <summary>
/// 云台FPS模型
/// </summary>
public
FPSHelper
GimbalFPS
{
get
{
return
gimbalFPS
;
}
set
{
gimbalFPS
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
GimbalFPS
));
}
}
#
endregion
// ======================================================================================
// ======================================================================================
// === Command ===
// === Command ===
// ======================================================================================
// ======================================================================================
...
@@ -97,17 +159,16 @@ namespace VIZ.GimbalAI.Module
...
@@ -97,17 +159,16 @@ namespace VIZ.GimbalAI.Module
/// </summary>
/// </summary>
private
void
Loaded
()
private
void
Loaded
()
{
{
// 加载完成后3秒执行加载流程
// 执行加载流程
ApplicationDomainEx
.
DelayManager
.
Wait
(
"VIZ.GimbalAI.Module.MainViewModel.Loaded"
,
3
,
()
=>
AppSetupContext
context
=
AppSetup
.
Load
(
this
.
GetWindow
());
if
(!
context
.
IsSuccess
)
{
{
// 执行加载流程
MessageBoxEx
.
ShowDialog
(
$"执行
{
context
.
ProviderDetail
}
失败"
);
AppSetupContext
context
=
AppSetup
.
Load
(
this
.
GetWindow
());
}
if
(!
context
.
IsSuccess
)
// 启动算法
{
this
.
AlgorithmController
.
Restart
();
MessageBoxEx
.
ShowDialog
(
$"执行
{
context
.
ProviderDetail
}
失败"
);
}
});
}
}
#
endregion
#
endregion
...
@@ -212,6 +273,23 @@ namespace VIZ.GimbalAI.Module
...
@@ -212,6 +273,23 @@ namespace VIZ.GimbalAI.Module
#
endregion
#
endregion
#
region
RestartAlgorithmCommand
--
重启算法命令
/// <summary>
/// 重启算法命令
/// </summary>
public
VCommand
RestartAlgorithmCommand
{
get
;
set
;
}
/// <summary>
/// 重启算法
/// </summary>
private
void
RestartAlgorithm
()
{
this
.
AlgorithmController
.
Restart
();
}
#
endregion
// ======================================================================================
// ======================================================================================
// === Message ===
// === Message ===
// ======================================================================================
// ======================================================================================
...
@@ -250,9 +328,25 @@ namespace VIZ.GimbalAI.Module
...
@@ -250,9 +328,25 @@ namespace VIZ.GimbalAI.Module
break
;
break
;
}
}
});
});
// 统计FPS
this
.
AlgorithmFPS
.
CalcFps
();
}
}
#
endregion
#
endregion
#
region
GimbalCenterAxisMessage
--
云台中心轴改变消息
/// <summary>
/// 云台中心轴改变消息
/// </summary>
/// <param name="msg">消息</param>
private
void
GimbalCenterAxis
(
GimbalCenterAxisMessage
msg
)
{
// 统计FPS
this
.
GimbalFPS
.
CalcFps
();
}
#
endregion
}
}
}
}
VIZ.GimbalAI.Module/Setup/Provider/Setup/AppSetup_InitCenterAxis.cs
0 → 100644
View file @
d46b8ca0
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
log4net
;
using
VIZ.GimbalAI.Domain
;
using
VIZ.GimbalAI.Connection
;
using
VIZ.GimbalAI.Storage
;
using
VIZ.Framework.Module
;
namespace
VIZ.GimbalAI.Module
{
/// <summary>
/// 应用程序启动 -- 初始化中心轴
/// </summary>
public
class
AppSetup_InitCenterAxis
:
AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AppSetup_InitCenterAxis
));
/// <summary>
/// 描述
/// </summary>
public
override
string
Detail
{
get
;
}
=
"应用程序启动 -- 初始化中心轴"
;
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public
override
bool
Setup
(
AppSetupContext
context
)
{
ApplicationDomainEx
.
GimbalControlModel
.
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
.
LoopManager
.
Register
(
"AppSetup_InitCenterAxis.Setup"
,
30
,
()
=>
{
this
.
WriteCenterAxis
();
});
return
true
;
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public
override
void
Shutdown
(
AppSetupContext
context
)
{
this
.
WriteCenterAxis
();
}
/// <summary>
/// 写入中心轴值
/// </summary>
private
void
WriteCenterAxis
()
{
try
{
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_X
,
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisX
);
ApplicationDomainEx
.
IniStorage
.
SetValue
<
GimbalConfig
>(
p
=>
p
.
GIMBAL_CENTER_AXIS_Y
,
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisY
);
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
);
}
}
}
}
VIZ.GimbalAI.Module/VIZ.GimbalAI.Module.csproj
View file @
d46b8ca0
...
@@ -184,6 +184,8 @@
...
@@ -184,6 +184,8 @@
<Compile Include="ControlView\View\ControlView.xaml.cs">
<Compile Include="ControlView\View\ControlView.xaml.cs">
<DependentUpon>ControlView.xaml</DependentUpon>
<DependentUpon>ControlView.xaml</DependentUpon>
</Compile>
</Compile>
<Compile Include="MainView\Controller\Algorithm\AlgorithmController.cs" />
<Compile Include="MainView\Controller\Algorithm\IAlgorithmSupport.cs" />
<Compile Include="MainView\ViewModel\MainViewModel.cs" />
<Compile Include="MainView\ViewModel\MainViewModel.cs" />
<Compile Include="MainView\View\MainView.xaml.cs">
<Compile Include="MainView\View\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
<DependentUpon>MainView.xaml</DependentUpon>
...
@@ -207,6 +209,7 @@
...
@@ -207,6 +209,7 @@
</Compile>
</Compile>
<Compile Include="Setup\Provider\Load\AppSetup_SetupGimbal.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_SetupGimbal.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_SetupAlgorithm.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_SetupAlgorithm.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitCenterAxis.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitNDI.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitNDI.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitCSV.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitCSV.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitUDP.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitUDP.cs" />
...
...
VIZ.GimbalAI.Module/VideoView/ViewModel/VideoViewModel.cs
View file @
d46b8ca0
...
@@ -78,7 +78,14 @@ namespace VIZ.GimbalAI.Module
...
@@ -78,7 +78,14 @@ namespace VIZ.GimbalAI.Module
view
.
videoControl
.
AttachPlugin
(
this
.
selectionBoxPlugin
);
view
.
videoControl
.
AttachPlugin
(
this
.
selectionBoxPlugin
);
// 中心轴位置插件
// 中心轴位置插件
// TODO : 中心轴位置插件
this
.
centerAxisPlugin
=
new
CenterAxisPlugin
(
view
.
videoControl
);
view
.
videoControl
.
AttachPlugin
(
this
.
centerAxisPlugin
);
CenterAxisInfo
centerAxisInfo
=
new
CenterAxisInfo
();
centerAxisInfo
.
AxisWidth
=
this
.
VIDEO_CENTER_AXIS_WIDTH
;
centerAxisInfo
.
AxisColor
=
this
.
VIDEO_CENTER_AXIS_COLOR
;
centerAxisInfo
.
SrcCenter
=
new
RawVector2
((
float
)
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisX
,
(
float
)
ApplicationDomainEx
.
GimbalControlModel
.
CenterAxisY
);
this
.
centerAxisPlugin
.
Update
(
centerAxisInfo
);
}
}
/// <summary>
/// <summary>
...
@@ -126,6 +133,11 @@ namespace VIZ.GimbalAI.Module
...
@@ -126,6 +133,11 @@ namespace VIZ.GimbalAI.Module
private
SelectionBoxPlugin
selectionBoxPlugin
;
private
SelectionBoxPlugin
selectionBoxPlugin
;
/// <summary>
/// <summary>
/// 中心轴插件
/// </summary>
private
CenterAxisPlugin
centerAxisPlugin
;
/// <summary>
/// 算法矩形框宽度(单位:像素)
/// 算法矩形框宽度(单位:像素)
/// </summary>
/// </summary>
private
readonly
int
VIDEO_TRACKING_BOX_BORDER_WIDTH
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
VideoConfig
,
int
>(
p
=>
p
.
VIDEO_TRACKING_BOX_BORDER_WIDTH
);
private
readonly
int
VIDEO_TRACKING_BOX_BORDER_WIDTH
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
VideoConfig
,
int
>(
p
=>
p
.
VIDEO_TRACKING_BOX_BORDER_WIDTH
);
...
...
VIZ.GimbalAI.Storage/Ini/Config/AlgorithmConfig.cs
View file @
d46b8ca0
...
@@ -13,7 +13,13 @@ namespace VIZ.GimbalAI.Storage
...
@@ -13,7 +13,13 @@ namespace VIZ.GimbalAI.Storage
public
class
AlgorithmConfig
:
IniConfigBase
public
class
AlgorithmConfig
:
IniConfigBase
{
{
/// <summary>
/// <summary>
/// 算法启动相对路径
/// python.exe 进程路径 或 python命令
/// </summary>
[
Ini
(
Section
=
"Algorithm"
,
DefaultValue
=
"python"
)]
public
string
ALGORITHM_PYTHON_PATH
{
get
;
set
;
}
/// <summary>
/// 算法启动 绝对路径 或 相对路径(相对于智能云台跟踪系统EXE文件的路径)
/// </summary>
/// </summary>
[
Ini
(
Section
=
"Algorithm"
,
DefaultValue
=
@"..\python\python.bat"
)]
[
Ini
(
Section
=
"Algorithm"
,
DefaultValue
=
@"..\python\python.bat"
)]
public
string
ALGORITHM_SETUP_PATH
{
get
;
set
;
}
public
string
ALGORITHM_SETUP_PATH
{
get
;
set
;
}
...
...
VIZ.GimbalAI.Storage/Ini/Config/GimbalConfig.cs
View file @
d46b8ca0
...
@@ -29,5 +29,17 @@ namespace VIZ.GimbalAI.Storage
...
@@ -29,5 +29,17 @@ namespace VIZ.GimbalAI.Storage
/// </summary>
/// </summary>
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"1"
,
Type
=
typeof
(
int
))]
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"1"
,
Type
=
typeof
(
int
))]
public
string
GIMBAL_CENTER_AXIS_SPEED
{
get
;
set
;
}
public
string
GIMBAL_CENTER_AXIS_SPEED
{
get
;
set
;
}
/// <summary>
/// 云台中心轴X位置
/// </summary>
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"960"
,
Type
=
typeof
(
int
))]
public
string
GIMBAL_CENTER_AXIS_X
{
get
;
set
;
}
/// <summary>
/// 云台中心轴Y位置
/// </summary>
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"540"
,
Type
=
typeof
(
int
))]
public
string
GIMBAL_CENTER_AXIS_Y
{
get
;
set
;
}
}
}
}
}
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