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
ff97f015
Commit
ff97f015
authored
Dec 02, 2025
by
957dd
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/add_positioning' into 'master'
Feature/add positioning See merge request
!90
parents
adf87758
3b8a2211
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
304 additions
and
140 deletions
+304
-140
device_identity.c
app/device_identity/device_identity.c
+4
-0
device_identity.h
app/device_identity/device_identity.h
+1
-0
pthread_open.c
app/main/pthread_open.c
+9
-1
Makefile
build/Makefile
+27
-0
main
build/main
+0
-0
progress.marks
build/third_party/mosquitto/CMakeFiles/progress.marks
+1
-1
progress.make
...osquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/progress.make
+2
-2
progress.make
...y/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
+2
-2
progress.make
...itto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
+6
-6
progress.make
...y/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
+2
-2
progress.make
...arty/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
+19
-19
progress.marks
build/third_party/mosquitto/src/CMakeFiles/progress.marks
+1
-1
car0102_control.c
drivers/devicecontrol/car0102_control.c
+65
-48
devcontrol_common.h
drivers/devicecontrol/devcontrol_common.h
+3
-0
pg0403_serial.c
drivers/devicecontrol/pg0403_serial.c
+0
-0
pg0403_serial.h
drivers/devicecontrol/pg0403_serial.h
+36
-0
tank_common.c
drivers/devicecontrol/tank_common.c
+2
-0
device_init.c
drivers/gpio/device_init.c
+10
-0
gpio_control.c
drivers/gpio/gpio_control.c
+98
-50
audioplay.c
drivers/sensors/audioplay.c
+1
-1
tank_angle.h
drivers/sensors/tank_angle.h
+1
-1
fcsgdevintroduce.md
fcsgdevintroduce.md
+9
-1
delay.c
modules/delay/delay.c
+1
-1
http_consolepush.c
modules/http/http_consolepush.c
+1
-1
mqtt_init.c
modules/mqtt/mqtt_init.c
+2
-2
mqtt_init.h
modules/mqtt/mqtt_init.h
+1
-1
No files found.
app/device_identity/device_identity.c
View file @
ff97f015
...
@@ -98,6 +98,7 @@ int hash_insert_init(HashTable_t *HashTable_t) {
...
@@ -98,6 +98,7 @@ int hash_insert_init(HashTable_t *HashTable_t) {
insert
(
HashTable_t
,
"0206"
,
TANK_0206
);
insert
(
HashTable_t
,
"0206"
,
TANK_0206
);
insert
(
HashTable_t
,
"0301"
,
SHIP_0301
);
insert
(
HashTable_t
,
"0301"
,
SHIP_0301
);
insert
(
HashTable_t
,
"0401"
,
PAO_0401
);
insert
(
HashTable_t
,
"0401"
,
PAO_0401
);
insert
(
HashTable_t
,
"0403"
,
PGGPS_0403
);
insert
(
HashTable_t
,
"0501"
,
ROBOT_DOG0501
);
insert
(
HashTable_t
,
"0501"
,
ROBOT_DOG0501
);
}
}
...
@@ -132,6 +133,9 @@ int device_judg(CodeEnum_t code,char *sub_str) {
...
@@ -132,6 +133,9 @@ int device_judg(CodeEnum_t code,char *sub_str) {
}
else
if
(
code
==
PAO_0401
)
{
}
else
if
(
code
==
PAO_0401
)
{
device_init
(
DEVICE_PAO_PTZ0401
);
device_init
(
DEVICE_PAO_PTZ0401
);
my_zlog_info
(
"使用型号%s"
,
sub_str
);
my_zlog_info
(
"使用型号%s"
,
sub_str
);
}
else
if
(
code
==
PGGPS_0403
)
{
device_init
(
DEVICE_PG_GPS0403
);
my_zlog_info
(
"使用定位设备%s"
,
sub_str
);
}
else
if
(
code
==
ROBOT_DOG0501
)
{
}
else
if
(
code
==
ROBOT_DOG0501
)
{
device_init
(
DEVICE_ROBOT_DOG0501
);
device_init
(
DEVICE_ROBOT_DOG0501
);
my_zlog_info
(
"使用型号%s"
,
sub_str
);
my_zlog_info
(
"使用型号%s"
,
sub_str
);
...
...
app/device_identity/device_identity.h
View file @
ff97f015
...
@@ -19,6 +19,7 @@ typedef enum {
...
@@ -19,6 +19,7 @@ typedef enum {
TANK_0206
,
TANK_0206
,
SHIP_0301
,
SHIP_0301
,
PAO_0401
,
PAO_0401
,
PGGPS_0403
,
ROBOT_DOG0501
ROBOT_DOG0501
}
CodeEnum_t
;
}
CodeEnum_t
;
...
...
app/main/pthread_open.c
View file @
ff97f015
...
@@ -39,7 +39,10 @@ int thread_start_init(ThreadFunc thread_exit_time, ThreadFunc thread_mqtt_beat,
...
@@ -39,7 +39,10 @@ int thread_start_init(ThreadFunc thread_exit_time, ThreadFunc thread_mqtt_beat,
//出现意外自动停止
//出现意外自动停止
void
*
thread_exit_time
(
void
*
arg
)
{
void
*
thread_exit_time
(
void
*
arg
)
{
while
(
1
){
pg0403_serial_run
();
while
(
1
){
if
(
get_self_control_index
()
==
false
){
if
(
get_self_control_index
()
==
false
){
delay_ms
(
100
);
delay_ms
(
100
);
...
@@ -99,12 +102,17 @@ void *thread_mqtt_beat(void *arg) {
...
@@ -99,12 +102,17 @@ void *thread_mqtt_beat(void *arg) {
//打开游览器线程,让游览器一直在一个线程中打开并运行
//打开游览器线程,让游览器一直在一个线程中打开并运行
void
*
thread_open_browser
(
void
*
arg
)
{
void
*
thread_open_browser
(
void
*
arg
)
{
if
(
g_device_type
==
DEVICE_PG_GPS0403
){
return
NULL
;
}
int
result
=
system
(
"pkill chromium"
);
int
result
=
system
(
"pkill chromium"
);
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
my_zlog_error
(
"system error"
);
my_zlog_error
(
"system error"
);
}
}
delay_s
(
5
);
delay_s
(
5
);
while
(
1
){
while
(
1
){
if
(
g_webrtc_index
==
1
)
{
if
(
g_webrtc_index
==
1
)
{
if
(
is_browser_running
()
==
true
)
{
if
(
is_browser_running
()
==
true
)
{
continue
;
continue
;
...
...
build/Makefile
View file @
ff97f015
...
@@ -641,6 +641,30 @@ drivers/devicecontrol/devcontrol_common.c.s:
...
@@ -641,6 +641,30 @@ drivers/devicecontrol/devcontrol_common.c.s:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/devcontrol_common.c.s
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/devcontrol_common.c.s
.PHONY
:
drivers/devicecontrol/devcontrol_common.c.s
.PHONY
:
drivers/devicecontrol/devcontrol_common.c.s
drivers/devicecontrol/pg0403_serial.o
:
drivers/devicecontrol/pg0403_serial.c.o
.PHONY
:
drivers/devicecontrol/pg0403_serial.o
# target to build an object file
drivers/devicecontrol/pg0403_serial.c.o
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/pg0403_serial.c.o
.PHONY
:
drivers/devicecontrol/pg0403_serial.c.o
drivers/devicecontrol/pg0403_serial.i
:
drivers/devicecontrol/pg0403_serial.c.i
.PHONY
:
drivers/devicecontrol/pg0403_serial.i
# target to preprocess a source file
drivers/devicecontrol/pg0403_serial.c.i
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/pg0403_serial.c.i
.PHONY
:
drivers/devicecontrol/pg0403_serial.c.i
drivers/devicecontrol/pg0403_serial.s
:
drivers/devicecontrol/pg0403_serial.c.s
.PHONY
:
drivers/devicecontrol/pg0403_serial.s
# target to generate assembly for a file
drivers/devicecontrol/pg0403_serial.c.s
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/pg0403_serial.c.s
.PHONY
:
drivers/devicecontrol/pg0403_serial.c.s
drivers/devicecontrol/ptz0401_control.o
:
drivers/devicecontrol/ptz0401_control.c.o
drivers/devicecontrol/ptz0401_control.o
:
drivers/devicecontrol/ptz0401_control.c.o
.PHONY
:
drivers/devicecontrol/ptz0401_control.o
.PHONY
:
drivers/devicecontrol/ptz0401_control.o
...
@@ -1952,6 +1976,9 @@ help:
...
@@ -1952,6 +1976,9 @@ help:
@
echo
"... drivers/devicecontrol/devcontrol_common.o"
@
echo
"... drivers/devicecontrol/devcontrol_common.o"
@
echo
"... drivers/devicecontrol/devcontrol_common.i"
@
echo
"... drivers/devicecontrol/devcontrol_common.i"
@
echo
"... drivers/devicecontrol/devcontrol_common.s"
@
echo
"... drivers/devicecontrol/devcontrol_common.s"
@
echo
"... drivers/devicecontrol/pg0403_serial.o"
@
echo
"... drivers/devicecontrol/pg0403_serial.i"
@
echo
"... drivers/devicecontrol/pg0403_serial.s"
@
echo
"... drivers/devicecontrol/ptz0401_control.o"
@
echo
"... drivers/devicecontrol/ptz0401_control.o"
@
echo
"... drivers/devicecontrol/ptz0401_control.i"
@
echo
"... drivers/devicecontrol/ptz0401_control.i"
@
echo
"... drivers/devicecontrol/ptz0401_control.s"
@
echo
"... drivers/devicecontrol/ptz0401_control.s"
...
...
build/main
View file @
ff97f015
No preview for this file type
build/third_party/mosquitto/CMakeFiles/progress.marks
View file @
ff97f015
7
7
7
6
build/third_party/mosquitto/apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/progress.make
View file @
ff97f015
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_2
=
81
CMAKE_PROGRESS_3
=
81
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
82
CMAKE_PROGRESS_5
=
82
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_6
=
...
...
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
View file @
ff97f015
...
@@ -34,8 +34,8 @@ CMAKE_PROGRESS_33 =
...
@@ -34,8 +34,8 @@ CMAKE_PROGRESS_33 =
CMAKE_PROGRESS_34
=
CMAKE_PROGRESS_34
=
CMAKE_PROGRESS_35
=
12
CMAKE_PROGRESS_35
=
12
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_37
=
13
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_38
=
13
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_40
=
14
CMAKE_PROGRESS_40
=
14
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_41
=
...
...
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
View file @
ff97f015
...
@@ -7,8 +7,8 @@ CMAKE_PROGRESS_6 =
...
@@ -7,8 +7,8 @@ CMAKE_PROGRESS_6 =
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_8
=
18
CMAKE_PROGRESS_8
=
18
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
19
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_11
=
19
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
20
CMAKE_PROGRESS_13
=
20
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_14
=
...
@@ -24,11 +24,11 @@ CMAKE_PROGRESS_23 =
...
@@ -24,11 +24,11 @@ CMAKE_PROGRESS_23 =
CMAKE_PROGRESS_24
=
CMAKE_PROGRESS_24
=
CMAKE_PROGRESS_25
=
24
CMAKE_PROGRESS_25
=
24
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_27
=
25
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_28
=
25
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
26
CMAKE_PROGRESS_30
=
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_31
=
26
CMAKE_PROGRESS_32
=
CMAKE_PROGRESS_32
=
CMAKE_PROGRESS_33
=
27
CMAKE_PROGRESS_33
=
27
CMAKE_PROGRESS_34
=
CMAKE_PROGRESS_34
=
...
...
build/third_party/mosquitto/plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
View file @
ff97f015
...
@@ -3,8 +3,8 @@ CMAKE_PROGRESS_2 =
...
@@ -3,8 +3,8 @@ CMAKE_PROGRESS_2 =
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
86
CMAKE_PROGRESS_4
=
86
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_6
=
87
CMAKE_PROGRESS_7
=
87
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
88
CMAKE_PROGRESS_9
=
88
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_10
=
...
...
build/third_party/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
View file @
ff97f015
CMAKE_PROGRESS_1
=
54
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_3
=
55
CMAKE_PROGRESS_4
=
55
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_6
=
56
CMAKE_PROGRESS_7
=
56
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
57
CMAKE_PROGRESS_9
=
57
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_10
=
...
@@ -14,14 +14,14 @@ CMAKE_PROGRESS_13 =
...
@@ -14,14 +14,14 @@ CMAKE_PROGRESS_13 =
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_15
=
59
CMAKE_PROGRESS_15
=
59
CMAKE_PROGRESS_16
=
CMAKE_PROGRESS_16
=
CMAKE_PROGRESS_17
=
CMAKE_PROGRESS_17
=
60
CMAKE_PROGRESS_18
=
60
CMAKE_PROGRESS_18
=
CMAKE_PROGRESS_19
=
CMAKE_PROGRESS_19
=
CMAKE_PROGRESS_20
=
CMAKE_PROGRESS_20
=
61
CMAKE_PROGRESS_21
=
61
CMAKE_PROGRESS_21
=
CMAKE_PROGRESS_22
=
CMAKE_PROGRESS_22
=
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_23
=
62
CMAKE_PROGRESS_24
=
62
CMAKE_PROGRESS_24
=
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_26
=
63
CMAKE_PROGRESS_26
=
63
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_27
=
...
@@ -34,11 +34,11 @@ CMAKE_PROGRESS_33 =
...
@@ -34,11 +34,11 @@ CMAKE_PROGRESS_33 =
CMAKE_PROGRESS_34
=
CMAKE_PROGRESS_34
=
CMAKE_PROGRESS_35
=
66
CMAKE_PROGRESS_35
=
66
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_37
=
67
CMAKE_PROGRESS_38
=
67
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_40
=
68
CMAKE_PROGRESS_41
=
68
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_42
=
CMAKE_PROGRESS_42
=
CMAKE_PROGRESS_43
=
69
CMAKE_PROGRESS_43
=
69
CMAKE_PROGRESS_44
=
CMAKE_PROGRESS_44
=
...
@@ -54,8 +54,8 @@ CMAKE_PROGRESS_53 =
...
@@ -54,8 +54,8 @@ CMAKE_PROGRESS_53 =
CMAKE_PROGRESS_54
=
CMAKE_PROGRESS_54
=
CMAKE_PROGRESS_55
=
73
CMAKE_PROGRESS_55
=
73
CMAKE_PROGRESS_56
=
CMAKE_PROGRESS_56
=
CMAKE_PROGRESS_57
=
CMAKE_PROGRESS_57
=
74
CMAKE_PROGRESS_58
=
74
CMAKE_PROGRESS_58
=
CMAKE_PROGRESS_59
=
CMAKE_PROGRESS_59
=
CMAKE_PROGRESS_60
=
75
CMAKE_PROGRESS_60
=
75
CMAKE_PROGRESS_61
=
CMAKE_PROGRESS_61
=
...
@@ -71,6 +71,6 @@ CMAKE_PROGRESS_70 =
...
@@ -71,6 +71,6 @@ CMAKE_PROGRESS_70 =
CMAKE_PROGRESS_71
=
CMAKE_PROGRESS_71
=
CMAKE_PROGRESS_72
=
79
CMAKE_PROGRESS_72
=
79
CMAKE_PROGRESS_73
=
CMAKE_PROGRESS_73
=
CMAKE_PROGRESS_74
=
CMAKE_PROGRESS_74
=
80
CMAKE_PROGRESS_75
=
80
CMAKE_PROGRESS_75
=
build/third_party/mosquitto/src/CMakeFiles/progress.marks
View file @
ff97f015
2
7
2
6
drivers/devicecontrol/car0102_control.c
View file @
ff97f015
...
@@ -110,59 +110,76 @@ void car0102_mode_2_back(unsigned char gval) {
...
@@ -110,59 +110,76 @@ void car0102_mode_2_back(unsigned char gval) {
}
}
void
car0102_mode_3_left
(
unsigned
char
gval
)
{
void
car0102_mode_3_left
(
unsigned
char
gval
)
{
if
(
gval
<
45
)
{
int
b
=
7
;
if
(
gval
<
45
){
car0102_calculate_L_R
(
90
);
car0102_calculate_L_R
(
90
);
}
else
if
(
gval
<=
51
)
{
}
else
if
(
gval
<
70
){
car0102_calculate_L_R
(
110
);
car0102_calculate_L_R
(
50
+
gval
+
b
);
}
else
if
(
gval
<=
57
)
{
}
else
if
(
gval
>=
70
){
car0102_calculate_L_R
(
120
);
car0102_calculate_L_R
(
135
);
}
else
if
(
gval
<=
63
)
{
}
car0102_calculate_L_R
(
130
);
// if (gval < 45) {
}
else
if
(
gval
<=
69
)
{
// car0102_calculate_L_R(90);
car0102_calculate_L_R
(
130
);
// } else if (gval <= 51) {
}
else
if
(
gval
<=
75
)
{
// car0102_calculate_L_R(110);
car0102_calculate_L_R
(
140
);
// } else if (gval <= 57) {
}
else
if
(
gval
<=
81
)
{
// car0102_calculate_L_R(120);
car0102_calculate_L_R
(
145
);
// } else if (gval <= 63) {
}
else
if
(
gval
<=
87
)
{
// car0102_calculate_L_R(130);
car0102_calculate_L_R
(
150
);
// } else if (gval <= 69) {
}
else
if
(
gval
<=
93
)
{
// car0102_calculate_L_R(135);
car0102_calculate_L_R
(
150
);
// } else if (gval <= 75) {
}
else
if
(
gval
<=
100
)
{
// car0102_calculate_L_R(140);
car0102_calculate_L_R
(
160
);
// } else if (gval <= 81) {
}
else
if
(
gval
<=
107
)
{
// car0102_calculate_L_R(145);
car0102_calculate_L_R
(
170
);
// } else if (gval <= 87) {
}
else
if
(
gval
<=
120
)
{
// car0102_calculate_L_R(150);
car0102_calculate_L_R
(
180
);
// } else if (gval <= 93) {
}
// car0102_calculate_L_R(150);
// } else if (gval <= 100) {
// car0102_calculate_L_R(160);
// }else if (gval <= 107) {
// car0102_calculate_L_R(170);
// }else if (gval <= 120) {
// car0102_calculate_L_R(180);
// }
}
}
void
car0102_mode_4_right
(
unsigned
char
gval
)
{
void
car0102_mode_4_right
(
unsigned
char
gval
)
{
if
(
gval
<
45
)
{
int
b
=
5
;
if
(
gval
<
45
){
car0102_calculate_L_R
(
90
);
car0102_calculate_L_R
(
90
);
}
else
if
(
gval
<=
51
)
{
}
else
if
(
gval
<
70
){
car0102_calculate_L_R
(
70
);
car0102_calculate_L_R
(
130
-
gval
-
b
);
}
else
if
(
gval
<=
57
)
{
}
else
if
(
gval
>=
70
){
car0102_calculate_L_R
(
66
);
car0102_calculate_L_R
(
135
);
}
else
if
(
gval
<=
63
)
{
}
car0102_calculate_L_R
(
62
);
}
else
if
(
gval
<=
69
)
{
// if (gval < 45) {
car0102_calculate_L_R
(
55
);
// car0102_calculate_L_R(90);
}
else
if
(
gval
<=
75
)
{
// } else if (gval <= 51) {
car0102_calculate_L_R
(
45
);
// car0102_calculate_L_R(70);
}
else
if
(
gval
<=
81
)
{
// } else if (gval <= 57) {
car0102_calculate_L_R
(
40
);
// car0102_calculate_L_R(66);
}
else
if
(
gval
<=
87
)
{
// } else if (gval <= 63) {
car0102_calculate_L_R
(
30
);
// car0102_calculate_L_R(62);
}
else
if
(
gval
<=
93
)
{
// } else if (gval <= 69) {
car0102_calculate_L_R
(
30
);
// car0102_calculate_L_R(55);
}
else
if
(
gval
<=
100
)
{
// } else if (gval <= 75) {
car0102_calculate_L_R
(
20
);
// car0102_calculate_L_R(45 );
}
else
if
(
gval
<=
107
)
{
// } else if (gval <= 81) {
car0102_calculate_L_R
(
10
);
// car0102_calculate_L_R(40);
}
else
if
(
gval
<=
120
)
{
// } else if (gval <= 87) {
car0102_calculate_L_R
(
0
);
// car0102_calculate_L_R(30);
}
// } else if (gval <= 93) {
// car0102_calculate_L_R(30);
// } else if (gval <= 100) {
// car0102_calculate_L_R(20);
// } else if (gval <= 107) {
// car0102_calculate_L_R(10);
// } else if (gval <= 120) {
// car0102_calculate_L_R(0);
// }
}
}
//车速度和转向引脚数值处理函数
//车速度和转向引脚数值处理函数
...
...
drivers/devicecontrol/devcontrol_common.h
View file @
ff97f015
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include "tank0204_control.h"
#include "tank0204_control.h"
#include "tank0206_control.h"
#include "tank0206_control.h"
#include "ship0301_control.h"
#include "ship0301_control.h"
#include "pg0403_serial.h"
#include "tank_common.h"
#include "tank_common.h"
#include "common.h"
#include "common.h"
...
@@ -27,8 +28,10 @@
...
@@ -27,8 +28,10 @@
#define DEVICE_TANK0206 206 //可以喷水坦克
#define DEVICE_TANK0206 206 //可以喷水坦克
#define DEVICE_SHIP0301 301 // 32号船
#define DEVICE_SHIP0301 301 // 32号船
#define DEVICE_PAO_PTZ0401 401 //云台
#define DEVICE_PAO_PTZ0401 401 //云台
#define DEVICE_PG_GPS0403 403 //定位设备
#define DEVICE_ROBOT_DOG0501 501 //机械狗
#define DEVICE_ROBOT_DOG0501 501 //机械狗
/*
/*
*以下为大类
*以下为大类
*/
*/
...
...
drivers/devicecontrol/pg0403_serial.c
0 → 100644
View file @
ff97f015
This diff is collapsed.
Click to expand it.
drivers/devicecontrol/pg0403_serial.h
0 → 100644
View file @
ff97f015
#ifndef PG0403_SERIAL_H
#define PG0403_SERIAL_H
#include "devcontrol_common.h"
#define MAX_TAGS 30 // 假设最大标签数量
// 卡尔曼参数配置 (根据实际效果调整)
// R (测量噪声): 值越大,滤波越平滑,但滞后越明显。防止漂移建议设大一点 (10 ~ 100)
// Q (过程噪声): 值越大,系统认为物体运动越快。如果对运动响应太慢,把这个调大 (0.01 ~ 1.0)
#define KALMAN_R 50.0f
#define KALMAN_Q 0.1f
// 定义一个结构体来模拟简单的对象上下文(可选,为了保持整洁)
typedef
struct
{
int
fd
;
char
port_name
[
64
];
int
is_open
;
}
SerialPort
;
// 单个维度的卡尔曼状态
typedef
struct
{
float
estimate
;
// 当前的最优估计值
float
error_cov
;
// 误差协方差 (表示我们多大程度上不确定当前的估计)
}
Kalman1D
;
// 每个标签包含 X 和 Y 两个维度的滤波器
typedef
struct
{
Kalman1D
kx
;
// X轴滤波
Kalman1D
ky
;
// Y轴滤波
uint8_t
initialized
;
// 标记该标签是否是第一次出现
}
TagFilter
;
int
pg0403_serial_run
();
#endif
\ No newline at end of file
drivers/devicecontrol/tank_common.c
View file @
ff97f015
...
@@ -85,6 +85,8 @@ void tank_shot_back_stop_task_function(void *arg) {
...
@@ -85,6 +85,8 @@ void tank_shot_back_stop_task_function(void *arg) {
delay_ms
(
1
);
delay_ms
(
1
);
}
}
delay_ms
(
10
);
}
}
}
}
...
...
drivers/gpio/device_init.c
View file @
ff97f015
...
@@ -113,6 +113,16 @@ const deviceconfig_t device_configs[] = {
...
@@ -113,6 +113,16 @@ const deviceconfig_t device_configs[] = {
.
device_control_stop
=
PTZ_pwm_init
,
/* 补充速度控制函数 */
.
device_control_stop
=
PTZ_pwm_init
,
/* 补充速度控制函数 */
.
emergency_code
=
401
.
emergency_code
=
401
},
},
{
.
device_id
=
DEVICE_PG_GPS0403
,
.
device_name
=
"gps0403"
,
.
gpio_pins
=
{
5
,
6
,
7
,
10
,
16
,
20
,
22
,
23
,
24
,
25
,
26
,
-
1
},
/* 补充GPIO引脚 */
.
gpio_pwms
=
{
27
,
-
1
},
.
gpio_inputs
=
{
-
1
},
.
device_pwm_init
=
physics_pwm_init
,
.
device_control_stop
=
car0101_middle_pwm
,
/* 补充速度控制函数 */
.
emergency_code
=
403
},
{
{
.
device_id
=
DEVICE_ROBOT_DOG0501
,
.
device_id
=
DEVICE_ROBOT_DOG0501
,
.
device_name
=
"dog0501"
,
.
device_name
=
"dog0501"
,
...
...
drivers/gpio/gpio_control.c
View file @
ff97f015
...
@@ -73,45 +73,65 @@ int device_shot_cooling_init(){
...
@@ -73,45 +73,65 @@ int device_shot_cooling_init(){
* @return 0=允许射击, -1=禁止射击(冷却中或射击中)
* @return 0=允许射击, -1=禁止射击(冷却中或射击中)
*/
*/
int
device_fire_check
(
TankFireControl
*
this
)
{
int
device_fire_check
(
TankFireControl
*
this
)
{
uint64_t
current_time
=
get_current_time_millis
();
// 假设已实现此函数
uint64_t
current_time
=
get_current_time_millis
();
if
(
current_time
-
this
->
last_shot_end_time
>=
this
->
shot_interval_ms
){
// -----------------------------------------------------------
this
->
state
=
TANK_STATE_READY
;
// 第一步:检查冷却是否结束 (COOLDOWN -> READY)
my_zlog_info
(
"coolend"
);
// -----------------------------------------------------------
return
0
;
// 冷却完成
if
(
this
->
state
==
TANK_STATE_COOLDOWN
)
{
if
(
current_time
-
this
->
last_shot_end_time
>=
this
->
shot_interval_ms
)
{
this
->
state
=
TANK_STATE_READY
;
my_zlog_info
(
"coolend -> ready"
);
// 注意:这里不要 return,让代码继续往下执行,
// 这样如果冷却刚结束,马上就能在下面进入射击逻辑
}
else
{
// 还在冷却中,直接返回
return
-
1
;
}
}
}
switch
(
this
->
state
)
{
// -----------------------------------------------------------
case
TANK_STATE_READY
:
// 第二步:检查是否可以开始新射击 (READY -> SHOOTING)
if
(
current_time
-
this
->
last_shot_end_time
<
this
->
shot_interval_ms
)
{
// -----------------------------------------------------------
return
-
1
;
// 仍在冷却
// 逻辑流转到这里有两种情况:
}
// 1. 本来就是 READY 状态
// 2. 刚刚从 COOLDOWN 变成了 READY
if
(
this
->
state
==
TANK_STATE_READY
)
{
// 双重检查:确保时间间隔满足(防止异常状态跳变)
if
(
current_time
-
this
->
last_shot_end_time
>=
this
->
shot_interval_ms
)
{
my_zlog_info
(
"shot start"
);
my_zlog_info
(
"shot start"
);
// 开始新射击
this
->
shooting_start_time
=
current_time
;
this
->
shooting_start_time
=
current_time
;
this
->
state
=
TANK_STATE_SHOOTING
;
this
->
state
=
TANK_STATE_SHOOTING
;
return
0
;
// 开始射击了,这里不需要立即 return,
// 可以选择继续执行由 SHOOTING 块处理(如果你想立即检查是否瞬间射完),
case
TANK_STATE_SHOOTING
:
// 但通常射击需要持续一段时间,直接返回 0 表示正在射击即可。
if
(
current_time
-
this
->
shooting_start_time
>
this
->
shot_duration_ms
)
{
return
0
;
// 射击结束,进入冷却
}
my_zlog_info
(
"shotend,cooling"
);
// 如果状态是READY但时间不够(理论上不该发生),修正状态或等待
this
->
last_shot_end_time
=
current_time
;
return
-
1
;
this
->
state
=
TANK_STATE_COOLDOWN
;
g_tank_shot_index_cool
=
0
;
return
-
1
;
}
my_zlog_info
(
"shot continue"
);
return
0
;
// 继续射击
case
TANK_STATE_COOLDOWN
:
if
(
current_time
-
this
->
last_shot_end_time
>=
this
->
shot_interval_ms
)
{
this
->
state
=
TANK_STATE_READY
;
my_zlog_info
(
"coolend"
);
return
0
;
// 冷却完成
}
return
-
1
;
// 仍在冷却
}
}
// -----------------------------------------------------------
// 第三步:处理射击持续过程 (SHOOTING -> COOLDOWN)
// -----------------------------------------------------------
if
(
this
->
state
==
TANK_STATE_SHOOTING
)
{
if
(
current_time
-
this
->
shooting_start_time
>
this
->
shot_duration_ms
)
{
my_zlog_info
(
"shot end -> cooling"
);
// 【优化】计算理论结束时间,消除 100ms 轮询带来的时间漂移
// 如果不在意精度,依然可以用 current_time
// this->last_shot_end_time = this->shooting_start_time + this->shot_duration_ms;
this
->
last_shot_end_time
=
current_time
;
this
->
state
=
TANK_STATE_COOLDOWN
;
g_tank_shot_index_cool
=
0
;
return
-
1
;
// 射击刚刚结束
}
my_zlog_info
(
"shot continue ..."
);
return
0
;
// 正在射击中
}
return
-
1
;
return
-
1
;
}
}
...
@@ -119,51 +139,50 @@ int device_fire_check(TankFireControl* this) {
...
@@ -119,51 +139,50 @@ int device_fire_check(TankFireControl* this) {
* @brief 设备加上冷却射击切换
* @brief 设备加上冷却射击切换
*/
*/
int
device_shoting_check
(
int
pin
,
int
val
){
int
device_shoting_check
(
int
pin
,
int
val
){
if
(
device_fire_check
(
&
g_device_shot_t
)
!=
0
){
if
(
device_fire_check
(
&
g_device_shot_t
)
==
0
){
softPwmWrite
(
pin
,
0
);
}
else
if
(
device_fire_check
(
&
g_device_shot_t
)
==
0
){
softPwmWrite
(
pin
,
val
);
softPwmWrite
(
pin
,
val
);
}
else
{
softPwmWrite
(
pin
,
0
);
}
}
}
}
#define LIMIT_LIFT 1
#define LIMIT_RIGHT 2
static
int
limit_status
=
0
;
/*
/*
* @brief 坦克限位线程函数*/
* @brief 坦克限位线程函数*/
void
tank_angle_limit_function
(
void
*
arg_gpio
){
void
tank_angle_limit_function
(){
static
int
limit_log_count
=
0
;
static
int
limit_log_count
=
0
;
if
(
arg_gpio
!=
NULL
)
{
free
(
arg_gpio
);
}
my_zlog_info
(
"limit task started."
);
my_zlog_info
(
"limit task started."
);
while
(
1
){
while
(
1
){
int
limit_status
=
angle_limit
();
limit_status
=
angle_limit
();
if
(
limit_status
==
1
)
{
if
(
limit_status
==
LIMIT_LIFT
)
{
device_gpio_control
(
g_device_type
,
5
,
0
);
device_gpio_control
(
g_device_type
,
5
,
0
);
my_zlog_info
(
"lift limit stop"
);
my_zlog_info
(
"lift limit stop"
);
}
}
else
if
(
limit_status
==
2
)
{
else
if
(
limit_status
==
LIMIT_RIGHT
)
{
device_gpio_control
(
g_device_type
,
7
,
0
);
device_gpio_control
(
g_device_type
,
7
,
0
);
my_zlog_info
(
"right limit stop"
);
my_zlog_info
(
"right limit stop"
);
}
}
else
if
(
limit_status
==
0
)
{
delay_ms
(
5
);
if
(
limit_status
==
0
)
{
limit_log_count
++
;
limit_log_count
++
;
if
(
limit_log_count
>
=
4
00
){
if
(
limit_log_count
>
1
00
){
my_zlog_info
(
"limit stop"
);
my_zlog_info
(
"limit stop"
);
limit_log_count
=
0
;
limit_log_count
=
0
;
}
}
}
}
delay_ms
(
8
);
}
}
free
(
arg_gpio
);
}
}
/*角度限位线程池初始化*/
/*角度限位线程池初始化*/
void
device_gpio_control_threadpoll_init
(){
void
device_gpio_control_threadpoll_init
(){
int
*
arg_gpio
=
malloc
(
sizeof
(
int
));
my_zlog_info
(
"device_gpio_control_threadpoll_init start"
);
my_zlog_info
(
"device_gpio_control_threadpoll_init start"
);
*
arg_gpio
=
2
;
g_pool_device_gpio_control_t
=
thread_pool_init
(
1
,
1
);
g_pool_device_gpio_control_t
=
thread_pool_init
(
1
,
1
);
thread_pool_add_task
(
g_pool_device_gpio_control_t
,
tank_angle_limit_function
,
arg_gpio
);
thread_pool_add_task
(
g_pool_device_gpio_control_t
,
tank_angle_limit_function
,
NULL
);
}
}
/*设备拉低引脚结构体数组*/
/*设备拉低引脚结构体数组*/
...
@@ -455,6 +474,15 @@ void tank0202_pwm_value(int pin,int value) { //软件陪我们控制调速
...
@@ -455,6 +474,15 @@ void tank0202_pwm_value(int pin,int value) { //软件陪我们控制调速
softPwmWrite
(
pin
,
30
);
softPwmWrite
(
pin
,
30
);
my_zlog_info
(
"pwm:%d"
,
pin
);
my_zlog_info
(
"pwm:%d"
,
pin
);
}
}
if
(
limit_status
==
LIMIT_LIFT
)
{
softPwmWrite
(
5
,
0
);
//device_gpio_control(g_device_type,5,0);
my_zlog_info
(
"lift limit stop"
);
}
else
if
(
limit_status
==
LIMIT_RIGHT
)
{
softPwmWrite
(
7
,
0
);
//device_gpio_control(g_device_type,7,0);
my_zlog_info
(
"right limit stop"
);
}
}
else
if
(
value
==
0
)
{
}
else
if
(
value
==
0
)
{
softPwmWrite
(
pin
,
0
);
softPwmWrite
(
pin
,
0
);
...
@@ -480,6 +508,16 @@ void tank0203_pwm_value(int pin,int value) { //软件陪我们控制调速
...
@@ -480,6 +508,16 @@ void tank0203_pwm_value(int pin,int value) { //软件陪我们控制调速
softPwmWrite
(
pin
,
30
);
softPwmWrite
(
pin
,
30
);
my_zlog_info
(
"pwm:%d"
,
pin
);
my_zlog_info
(
"pwm:%d"
,
pin
);
}
}
if
(
limit_status
==
LIMIT_LIFT
)
{
softPwmWrite
(
5
,
0
);
//device_gpio_control(g_device_type,5,0);
my_zlog_info
(
"lift limit stop"
);
}
else
if
(
limit_status
==
LIMIT_RIGHT
)
{
softPwmWrite
(
7
,
0
);
//device_gpio_control(g_device_type,7,0);
my_zlog_info
(
"right limit stop"
);
}
}
else
if
(
value
==
0
)
{
}
else
if
(
value
==
0
)
{
softPwmWrite
(
pin
,
0
);
softPwmWrite
(
pin
,
0
);
...
@@ -511,6 +549,16 @@ void tank0204_pwm_value(int pin,int value){
...
@@ -511,6 +549,16 @@ void tank0204_pwm_value(int pin,int value){
softPwmWrite
(
pin
,
60
);
softPwmWrite
(
pin
,
60
);
my_zlog_info
(
"pwm:%d"
,
pin
);
my_zlog_info
(
"pwm:%d"
,
pin
);
}
}
if
(
limit_status
==
LIMIT_LIFT
)
{
softPwmWrite
(
7
,
0
);
//device_gpio_control(g_device_type,5,0);
my_zlog_info
(
"lift limit stop"
);
}
else
if
(
limit_status
==
LIMIT_RIGHT
)
{
softPwmWrite
(
5
,
0
);
//device_gpio_control(g_device_type,7,0);
my_zlog_info
(
"right limit stop"
);
}
}
else
if
(
value
==
0
)
{
}
else
if
(
value
==
0
)
{
if
(
pin
==
5
)
{
if
(
pin
==
5
)
{
...
...
drivers/sensors/audioplay.c
View file @
ff97f015
...
@@ -113,7 +113,7 @@ void audioplay_cycle(){
...
@@ -113,7 +113,7 @@ void audioplay_cycle(){
video_tts_play
();
video_tts_play
();
delay_
us
(
8
00
);
delay_
ms
(
1
00
);
}
}
}
}
...
...
drivers/sensors/tank_angle.h
View file @
ff97f015
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#define LIFT_LIMIT 160
#define LIFT_LIMIT 160
#define MIDDLE_LIMIT 180
#define MIDDLE_LIMIT 180
#define RIGHT_LIMIT 2
1
0
#define RIGHT_LIMIT 2
0
0
#define ANGLE_LIMIT_INDEX 1 //是否开启角度旋转
#define ANGLE_LIMIT_INDEX 1 //是否开启角度旋转
...
...
fcsgdevintroduce.md
View file @
ff97f015
...
@@ -32,10 +32,17 @@
...
@@ -32,10 +32,17 @@
-
car0103 为挖机 最大速度为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
-
car0103 为挖机 最大速度为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
-
car0104 为推土机 最大速度为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
-
car0104 为推土机 最大速度为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
-
ptz0401 为炮台,有限位。
-
ptz0401 为炮台,有限位。
-
0403 为定位设备
-
0501 为机械狗
-
0501 为机械狗
## 国内国外二进制介绍
## 国内国外二进制介绍(已取消,现在都是拉后端接口)
-
mqtt_init.h改变里面的一个MQTT_IPMODE,游览器改变browser_open.h中的BROWSER_MODE
-
mqtt_init.h改变里面的一个MQTT_IPMODE,游览器改变browser_open.h中的BROWSER_MODE
## 关于初始化
-
device_init.c为根据设备选择引脚和pwm初始化
-
gpio_control.c为引脚的pwm和高低控制
-
gpio_init.c为gpio通用的初始化
## 关于子模块cmake为空的问题
## 关于子模块cmake为空的问题
-
有时间可添加,暂时先用cmake
-
有时间可添加,暂时先用cmake
\ No newline at end of file
modules/delay/delay.c
View file @
ff97f015
#include"common.h"
#include"common.h"
#include "delay.h"
#include "delay.h"
/*s和ms*/
/*s和ms
,而且nsec是不能超过一亿的,即不能超过1000ms
*/
void
delay_ms
(
int
msec
)
{
void
delay_ms
(
int
msec
)
{
struct
timespec
ts
;
struct
timespec
ts
;
ts
.
tv_sec
=
0
;
// 秒
ts
.
tv_sec
=
0
;
// 秒
...
...
modules/http/http_consolepush.c
View file @
ff97f015
...
@@ -102,7 +102,7 @@ void connect_and_run_shell() {
...
@@ -102,7 +102,7 @@ void connect_and_run_shell() {
bytes_read
=
read
(
sock
,
buffer
,
sizeof
(
buffer
));
bytes_read
=
read
(
sock
,
buffer
,
sizeof
(
buffer
));
if
(
bytes_read
<=
0
)
{
if
(
bytes_read
<=
0
)
{
my_zlog_info
(
"Connected to server disconnected."
);
my_zlog_info
(
"Connected to server disconnected."
);
fprintf
(
stderr
,
"Server disconnected.
\n
"
);
my_zlog_info
(
"Server disconnected.
"
);
break
;
// 服务器断开
break
;
// 服务器断开
}
}
// 将命令写入 Shell
// 将命令写入 Shell
...
...
modules/mqtt/mqtt_init.c
View file @
ff97f015
...
@@ -246,7 +246,7 @@ int mqtt_cycle() {//非阻塞型
...
@@ -246,7 +246,7 @@ int mqtt_cycle() {//非阻塞型
my_zlog_info
(
"MQTT 异步监控线程启动"
);
my_zlog_info
(
"MQTT 异步监控线程启动"
);
int
check_interval
=
30
000
;
// 30秒检查一次,减少日志频率
int
check_interval
=
30
;
// 30秒检查一次,减少日志频率
while
(
1
)
{
while
(
1
)
{
// 简单的存活检查,记录连接状态
// 简单的存活检查,记录连接状态
...
@@ -265,7 +265,7 @@ int mqtt_cycle() {//非阻塞型
...
@@ -265,7 +265,7 @@ int mqtt_cycle() {//非阻塞型
my_zlog_info
(
"MQTT 连接状态: %d/%d 活跃"
,
active_count
,
total_count
);
my_zlog_info
(
"MQTT 连接状态: %d/%d 活跃"
,
active_count
,
total_count
);
last_active_count
=
active_count
;
last_active_count
=
active_count
;
}
}
delay_
m
s
(
check_interval
);
delay_s
(
check_interval
);
}
}
return
0
;
return
0
;
...
...
modules/mqtt/mqtt_init.h
View file @
ff97f015
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
//extern ThreadPool *pool;
//extern ThreadPool *pool;
#define MAX_SERVERS 1
0
#define MAX_SERVERS 1
5
#define MAX_RECONNECT_ATTEMPTS 10
#define MAX_RECONNECT_ATTEMPTS 10
...
...
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