Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
car-controlserver
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenzhongjian
car-controlserver
Commits
845a4293
Commit
845a4293
authored
Jan 15, 2026
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入了云台相关算法,让移动更流畅
parent
f81fc9a1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
220 additions
and
119 deletions
+220
-119
main
build/main
+0
-0
devcontrol_common.c
drivers/devicecontrol/devcontrol_common.c
+5
-5
ptz0401_control.c
drivers/devicecontrol/ptz0401_control.c
+190
-107
ptz0401_control.h
drivers/devicecontrol/ptz0401_control.h
+15
-1
tank_common.c
drivers/devicecontrol/tank_common.c
+3
-3
tank_common.h
drivers/devicecontrol/tank_common.h
+2
-1
gpio_control.c
drivers/gpio/gpio_control.c
+3
-2
gpio_control.h
drivers/gpio/gpio_control.h
+2
-0
No files found.
build/main
View file @
845a4293
No preview for this file type
drivers/devicecontrol/devcontrol_common.c
View file @
845a4293
...
...
@@ -88,7 +88,7 @@ const device_abnormal_close_t devcontrol_config_t[]= {
{
.
device_id
=
DEVICE_TANK0202
,
.
device_abnormal_stop
=
tank0202_middle
,
.
device_close
=
tank_
thread_close
,
.
device_close
=
device_poil
thread_close
,
.
gpio_pin_pulled
=
pin_all_default
,
.
gpio_pwm_pulled
=
pwm_all_default
},
...
...
@@ -96,7 +96,7 @@ const device_abnormal_close_t devcontrol_config_t[]= {
{
.
device_id
=
DEVICE_TANK0203
,
.
device_abnormal_stop
=
tank0203_middle
,
.
device_close
=
tank_
thread_close
,
.
device_close
=
device_poil
thread_close
,
.
gpio_pin_pulled
=
pin_all_default
,
.
gpio_pwm_pulled
=
pwm_all_default
},
...
...
@@ -104,7 +104,7 @@ const device_abnormal_close_t devcontrol_config_t[]= {
{
.
device_id
=
DEVICE_TANK0204
,
.
device_abnormal_stop
=
tank0204_stop
,
.
device_close
=
tank_
thread_close
,
.
device_close
=
device_poil
thread_close
,
.
gpio_pin_pulled
=
pin_all_default
,
.
gpio_pwm_pulled
=
tankpwm_default
},
...
...
@@ -135,8 +135,8 @@ const device_abnormal_close_t devcontrol_config_t[]= {
{
.
device_id
=
DEVICE_PAO_PTZ0401
,
.
device_abnormal_stop
=
PTZ_pwm_init
,
.
device_close
=
NULL
,
// TANK0206没有单独的关闭函数
.
device_abnormal_stop
=
ptz_pwm_stop
,
.
device_close
=
device_poilthread_close
,
// TANK0206没有单独的关闭函数
.
gpio_pin_pulled
=
pin_all_default
,
.
gpio_pwm_pulled
=
pwm_all_default
},
...
...
drivers/devicecontrol/ptz0401_control.c
View file @
845a4293
This diff is collapsed.
Click to expand it.
drivers/devicecontrol/ptz0401_control.h
View file @
845a4293
#ifndef PTZ0401_CONTROL_H__
#define PTZ0401_CONTROL_H__
/* ===================== 轴结构体与全局变量 ===================== */
// 增加了限位属性,便于在算法内部强制约束
typedef
struct
{
float
angle
;
// 当前角度
float
target
;
// 目标角度
float
speed
;
// 当前速度
float
min_limit
;
// 最小限位
float
max_limit
;
// 最大限位
}
ServoAxis
;
void
device_ptz_pwm_task_threadpoll_init
();
void
pwm_PTZ_hz
();
void
PTZ_pwm_init
();
void
PTZ_pwm_change
(
unsigned
char
*
buf
)
;
void
ptz_pwm_stop
();
#endif
\ No newline at end of file
drivers/devicecontrol/tank_common.c
View file @
845a4293
...
...
@@ -229,9 +229,9 @@ void set_tank_shot_index_cool(bool index){
/*
* @brief 销毁坦克使用的线程池,让其正常销毁,只有在tank相关设备号下才有用,最后销毁都会到device——common.h中
*/
void
tank_
thread_close
(){
thread_pool_destroy
(
pool_tank_t
);
thread_pool_destroy
(
g_pool_device_gpio_control_t
);
void
device_poil
thread_close
(){
if
(
pool_tank_t
)
thread_pool_destroy
(
pool_tank_t
);
if
(
g_pool_device_gpio_control_t
)
thread_pool_destroy
(
g_pool_device_gpio_control_t
);
}
/*坦克射击接口,只有在特定设备号下使用*/
...
...
drivers/devicecontrol/tank_common.h
View file @
845a4293
...
...
@@ -41,6 +41,6 @@ bool set_backshotstatus(bool flag);
int
tankshot_detection_backcount
(
int
*
cool_time
,
int
flag
);
/*关闭线程*/
void
tank_
thread_close
();
void
device_poil
thread_close
();
#endif
\ No newline at end of file
drivers/gpio/gpio_control.c
View file @
845a4293
...
...
@@ -31,6 +31,7 @@ void dog0501_pwm_value(int pin,int value);
TankFireControl
g_device_shot_t
;
// 真正的结构体变量
/**
* @brief 初始化坦克射击控制器
* @param this 控制器指针
...
...
@@ -197,8 +198,7 @@ void tank_angle_limit_function(){
}
delay_ms
(
5
);
}
}
}
...
...
@@ -209,6 +209,7 @@ void device_gpio_control_threadpoll_init(){
thread_pool_add_task
(
g_pool_device_gpio_control_t
,
tank_angle_limit_function
,
NULL
);
}
/*设备拉低引脚结构体数组*/
const
gpiocontrol_t
gpio_configs
[]
=
{
{
...
...
drivers/gpio/gpio_control.h
View file @
845a4293
...
...
@@ -33,6 +33,8 @@ int device_shot_cooling_init();
extern
ThreadPool_t
*
g_pool_device_gpio_control_t
;
void
set_gpio_control_config_t
(
ThreadPool_t
*
s
);
extern
int
g_tank_shot_index
;
void
device_fast_read
();
//快速判断
...
...
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