Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.GimbalAI.Controller
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.Controller
Commits
f32b61a4
Commit
f32b61a4
authored
Aug 03, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上行数据接入
parent
a18c53cf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
4 deletions
+38
-4
VIZ.GimbalAI.Controller.Module/Setup/Provider/AppSetup_SerialPort.cs
+20
-2
VIZ.GimbalAI.Controller.Storage/Ini/Config/GimbalConfig.cs
+12
-0
VIZ.GimbalAI.Controller/config/config.ini
+6
-2
No files found.
VIZ.GimbalAI.Controller.Module/Setup/Provider/AppSetup_SerialPort.cs
View file @
f32b61a4
...
@@ -11,6 +11,7 @@ using VIZ.Framework.Connection;
...
@@ -11,6 +11,7 @@ using VIZ.Framework.Connection;
using
VIZ.Framework.Module
;
using
VIZ.Framework.Module
;
using
VIZ.GimbalAI.Controller.Connection
;
using
VIZ.GimbalAI.Controller.Connection
;
using
VIZ.GimbalAI.Controller.Domain
;
using
VIZ.GimbalAI.Controller.Domain
;
using
VIZ.GimbalAI.Controller.Storage
;
namespace
VIZ.GimbalAI.Controller.Module
namespace
VIZ.GimbalAI.Controller.Module
{
{
...
@@ -30,6 +31,16 @@ namespace VIZ.GimbalAI.Controller.Module
...
@@ -30,6 +31,16 @@ namespace VIZ.GimbalAI.Controller.Module
public
override
string
Detail
{
get
;
}
=
"应用程序启动 -- 串口"
;
public
override
string
Detail
{
get
;
}
=
"应用程序启动 -- 串口"
;
/// <summary>
/// <summary>
/// 下行数据串口号(摇杆 -> 云台)
/// </summary>
private
readonly
string
GIMBAL_SERIAL_PORT_DOWN
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
string
>(
p
=>
p
.
GIMBAL_SERIAL_PORT_DOWN
);
/// <summary>
/// 上行护具串口号(云台 -> 摇杆)
/// </summary>
private
readonly
string
GIMBAL_SERIAL_PORT_UP
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
GimbalConfig
,
string
>(
p
=>
p
.
GIMBAL_SERIAL_PORT_UP
);
/// <summary>
/// 执行启动
/// 执行启动
/// </summary>
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <param name="context">应用程序启动上下文</param>
...
@@ -39,12 +50,19 @@ namespace VIZ.GimbalAI.Controller.Module
...
@@ -39,12 +50,19 @@ namespace VIZ.GimbalAI.Controller.Module
ConnectionManager
.
SerialPortConnection
=
new
SerialPortConnection
();
ConnectionManager
.
SerialPortConnection
=
new
SerialPortConnection
();
// 下行
// 下行
SerialPortEndpointManager
down_endpoint_manager
=
new
SerialPortEndpointManager
(
SerialPortKeys
.
DOWN
,
"COM4"
,
115200
,
Parity
.
None
,
8
,
StopBits
.
One
);
SerialPortEndpointManager
down_endpoint_manager
=
new
SerialPortEndpointManager
(
SerialPortKeys
.
DOWN
,
GIMBAL_SERIAL_PORT_DOWN
,
115200
,
Parity
.
None
,
8
,
StopBits
.
One
);
down_endpoint_manager
.
PackageProvider
=
new
GimbalPackageDownProvider
(
53
,
new
byte
[]
{
0xA5
,
0xE7
},
SerialPortKeys
.
DOWN
);
down_endpoint_manager
.
PackageProvider
=
new
GimbalPackageDownProvider
(
53
,
new
byte
[]
{
0xA5
,
0xE7
},
SerialPortKeys
.
DOWN
);
ConnectionManager
.
SerialPortConnection
.
AddEndpointManager
(
down_endpoint_manager
);
ConnectionManager
.
SerialPortConnection
.
AddEndpointManager
(
down_endpoint_manager
);
down_endpoint_manager
.
Open
();
down_endpoint_manager
.
Open
();
// 上行
SerialPortEndpointManager
up_endpoint_manager
=
new
SerialPortEndpointManager
(
SerialPortKeys
.
UP
,
GIMBAL_SERIAL_PORT_UP
,
115200
,
Parity
.
None
,
8
,
StopBits
.
One
);
up_endpoint_manager
.
PackageProvider
=
new
GimbalPackageUpProvider
(
53
,
new
byte
[]
{
0x58
,
0xA0
},
SerialPortKeys
.
UP
);
ConnectionManager
.
SerialPortConnection
.
AddEndpointManager
(
up_endpoint_manager
);
up_endpoint_manager
.
Open
();
return
true
;
return
true
;
}
}
...
@@ -54,7 +72,7 @@ namespace VIZ.GimbalAI.Controller.Module
...
@@ -54,7 +72,7 @@ namespace VIZ.GimbalAI.Controller.Module
/// <param name="context">应用程序启动上下文</param>
/// <param name="context">应用程序启动上下文</param>
public
override
void
Shutdown
(
AppSetupContext
context
)
public
override
void
Shutdown
(
AppSetupContext
context
)
{
{
ConnectionManager
.
SerialPortConnection
.
Dispose
();
}
}
}
}
}
}
VIZ.GimbalAI.Controller.Storage/Ini/Config/GimbalConfig.cs
View file @
f32b61a4
...
@@ -18,5 +18,17 @@ namespace VIZ.GimbalAI.Controller.Storage
...
@@ -18,5 +18,17 @@ namespace VIZ.GimbalAI.Controller.Storage
/// </summary>
/// </summary>
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"True"
,
Type
=
typeof
(
bool
))]
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"True"
,
Type
=
typeof
(
bool
))]
public
string
GIMBAL_IS_WRITE_DATA
{
get
;
set
;
}
public
string
GIMBAL_IS_WRITE_DATA
{
get
;
set
;
}
/// <summary>
/// 下行数据串口号(摇杆 -> 云台)
/// </summary>
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"True"
,
Type
=
typeof
(
bool
))]
public
string
GIMBAL_SERIAL_PORT_DOWN
{
get
;
set
;
}
/// <summary>
/// 上行护具串口号(云台 -> 摇杆)
/// </summary>
[
Ini
(
Section
=
"Gimbal"
,
DefaultValue
=
"True"
,
Type
=
typeof
(
bool
))]
public
string
GIMBAL_SERIAL_PORT_UP
{
get
;
set
;
}
}
}
}
}
VIZ.GimbalAI.Controller/config/config.ini
View file @
f32b61a4
...
@@ -10,4 +10,8 @@ APPLICATION_IS_DEBUG=true
...
@@ -10,4 +10,8 @@ APPLICATION_IS_DEBUG=true
; ============================================================
; ============================================================
[Gimbal]
[Gimbal]
; 是否输出数据
; 是否输出数据
GIMBAL_IS_WRITE_DATA
=
true
GIMBAL_IS_WRITE_DATA
=
true
\ No newline at end of file
; 下行数据串口号(摇杆 -> 云台)
GIMBAL_SERIAL_PORT_DOWN
=
COM3
; 上行护具串口号(云台 -> 摇杆)
GIMBAL_SERIAL_PORT_UP
=
COM4
\ No newline at end of file
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