Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
autoCar
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
李远洪
autoCar
Commits
2df27cb9
Commit
2df27cb9
authored
Apr 17, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
尝试修复了一下里程有油耗累加的bug
parent
a776cb38
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
150 deletions
+76
-150
data/protocolTools/2_大坪到南滨路钟楼.json
data/protocolTools/2_大坪到南滨路钟楼.json
+0
-0
data/protocolTools/carData/M202003060520.json
data/protocolTools/carData/M202003060520.json
+1
-1
lib/socket/service/AutoCarService.py
lib/socket/service/AutoCarService.py
+15
-9
result.txt
result.txt
+59
-139
start.py
start.py
+1
-1
No files found.
data/protocolTools/
GPSLines/
2_大坪到南滨路钟楼.json
→
data/protocolTools/2_大坪到南滨路钟楼.json
View file @
2df27cb9
File moved
data/protocolTools/carData/M202003060520.json
View file @
2df27cb9
{
"time"
:
{
"dateTime"
:
"2020-04-16 13:47:50"
,
"date"
:
"2020-04-16"
,
"time"
:
"13:47:50"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
84048
,
"todayTotalOil"
:
102
,
"todayTotalTime"
:
102
,
"theMilleage"
:
1632
,
"theOil"
:
1
,
"theTime"
:
1
},
"travelData"
:
{
"totalMilleage"
:
103664
,
"totalOil"
:
151
,
"totalTime"
:
151
}}
\ No newline at end of file
{
"time"
:
{
"dateTime"
:
"2020-04-17 17:53:51"
,
"date"
:
"2020-04-17"
,
"time"
:
"17:53:51"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
139860
,
"todayTotalOil"
:
770
,
"todayTotalTime"
:
350
,
"theMilleage"
:
73815
,
"theOil"
:
396
,
"theTime"
:
180
},
"travelData"
:
{
"totalMilleage"
:
243524
,
"totalOil"
:
921
,
"totalTime"
:
501
}}
\ No newline at end of file
lib/socket/service/AutoCarService.py
View file @
2df27cb9
...
...
@@ -209,9 +209,9 @@ class AutoCarService():
with
open
(
"data/protocolTools/carData/"
+
self
.
carId
+
".json"
,
"r"
,
encoding
=
"utf-8"
)
as
fi
:
content
=
fi
.
read
()
conJson
=
json
.
loads
(
content
)
conJson
[
"curDayTravel"
][
"theMilleage"
]
=
0
# 今日行驶总里程
conJson
[
"curDayTravel"
][
"theOil"
]
=
0
# 今日行驶总油耗
conJson
[
"curDayTravel"
][
"theTime"
]
=
0
# 今日行驶总时间
#
conJson["curDayTravel"]["theMilleage"] = 0 # 今日行驶总里程
#
conJson["curDayTravel"]["theOil"] = 0 # 今日行驶总油耗
#
conJson["curDayTravel"]["theTime"] = 0 # 今日行驶总时间
timeStamp
=
time
.
time
()
timeArray
=
time
.
localtime
(
timeStamp
)
dateTimeM
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
,
timeArray
)
...
...
@@ -223,18 +223,24 @@ class AutoCarService():
if
dateM
==
conJson
[
"time"
][
"date"
]:
pass
else
:
#如果不是当天日期,则将日期设置为当天,并写入车辆数据文件
conJson
[
"time"
][
"dateTime"
]
=
dateTimeM
conJson
[
"time"
][
"date"
]
=
dateM
conJson
[
"time"
][
"time"
]
=
timeM
conJson
[
"curDayTravel"
][
"todayTotalMilleage"
]
=
0
# 今日行驶总里程
conJson
[
"curDayTravel"
][
"todayTotalOil"
]
=
0
# 今日行驶总油耗
conJson
[
"curDayTravel"
][
"todayTotalTime"
]
=
0
# 今日行驶总时间
#
conJson["time"]["dateTime"] = dateTimeM
#
conJson["time"]["date"] = dateM
#
conJson["time"]["time"] = timeM
#
conJson["curDayTravel"]["todayTotalMilleage"] = 0 # 今日行驶总里程
#
conJson["curDayTravel"]["todayTotalOil"] = 0 # 今日行驶总油耗
#
conJson["curDayTravel"]["todayTotalTime"] = 0 # 今日行驶总时间
self
.
carDataObj
.
setTodayTotalMilleage
(
0
)
self
.
carDataObj
.
setTodayTodayTotalOil
(
0
)
self
.
carDataObj
.
setTodayTodayTotalTime
(
0
)
self
.
carDataObj
.
setDateTime2file
(
dateTimeM
)
self
.
carDataObj
.
setData2file
(
dateM
)
self
.
carDataObj
.
setTime2file
(
timeM
)
self
.
OBDdata
[
"totailMileage"
]
=
self
.
carDataObj
[
"travelData"
][
"totalMilleage"
]
self
.
OBDdataOri
[
"totailMileage"
]
=
self
.
carDataObj
[
"travelData"
][
"totalMilleage"
]
self
.
OBDdata
[
"totalOilExpen"
]
=
self
.
carDataObj
[
"travelData"
][
"totalOil"
]
self
.
OBDdataOri
[
"totalOilExpen"
]
=
self
.
carDataObj
[
"travelData"
][
"totalOil"
]
self
.
OBDdata
[
"totalRunTime"
]
=
self
.
carDataObj
[
"travelData"
][
"totalTime"
]
self
.
OBDdataOri
[
"totalRunTime"
]
=
self
.
carDataObj
[
"travelData"
][
"totalTime"
]
self
.
carData
=
conJson
fireOnEventObj
=
EventReport_protocol
(
DEV_ID
=
self
.
carId
,
WATER_CODE
=
self
.
sn
)
gpsData
=
self
.
genGPSData
(
self
.
gpsLine
[
0
][
"lat"
],
self
.
gpsLine
[
0
][
"lng"
])
...
...
result.txt
View file @
2df27cb9
[2020-04-16 17:34:23] 建立了连接
[2020-04-16 17:34:23] 进行了登录操作
[2020-04-16 17:34:24] 发送了版本信息
[2020-04-16 17:34:24] 当前设置了GPS轨迹:6_先涛的车轨迹(短).txt
[2020-04-16 17:34:24] 发送了点火事件
[2020-04-16 17:34:26] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:28] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:29] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:30] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:31] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:32] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:33] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:34] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:35] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:36] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:38] 维度:29.585448 经度:106.279711
[2020-04-16 17:34:39] 维度:29.586623 经度:106.287903
[2020-04-16 17:34:40] 维度:29.586608 经度:106.289041
[2020-04-16 17:34:41] 维度:29.586631 经度:106.293958
[2020-04-16 17:34:42] 维度:29.586603 经度:106.296643
[2020-04-16 17:34:43] 维度:29.586588 经度:106.29702
[2020-04-16 17:34:44] 维度:29.586625 经度:106.297076
[2020-04-16 17:34:45] 发送了熄火事件:
[2020-04-16 17:34:46] 发送了熄火事件:
[2020-04-16 17:34:46] 执行了停止行驶服务
[2020-04-16 17:34:46] gps轨迹跑完,自动停止行驶!
[2020-04-17 18:20:28] 建立了连接
[2020-04-17 18:20:28] 进行了登录操作
[2020-04-17 18:20:29] 发送了版本信息
[2020-04-17 18:20:29] 当前设置了GPS轨迹:6_先涛的车轨迹(短).txt
[2020-04-17 18:20:29] 发送了点火事件
[2020-04-17 18:20:31] 维度:29.585448 经度:106.279711
[2020-04-17 18:20:37] 维度:29.585448 经度:106.279711
[2020-04-17 18:20:42] 维度:29.585448 经度:106.279711
[2020-04-17 18:20:47] 维度:29.585448 经度:106.279711
[2020-04-17 18:20:52] 维度:29.585448 经度:106.279711
[2020-04-17 18:20:57] 维度:29.585448 经度:106.279711
[2020-04-17 18:21:02] 维度:29.585448 经度:106.279711
[2020-04-17 18:21:07] 维度:29.585448 经度:106.279711
[2020-04-17 18:21:12] 维度:29.585448 经度:106.279711
[2020-04-17 18:21:17] 维度:29.585448 经度:106.279711
[2020-04-17 18:21:22] 维度:29.585448 经度:106.279711
[2020-04-17 18:21:28] 维度:29.586623 经度:106.287903
[2020-04-17 18:21:33] 维度:29.586608 经度:106.289041
[2020-04-17 18:21:38] 维度:29.586631 经度:106.293958
[2020-04-17 18:21:43] 维度:29.586603 经度:106.296643
[2020-04-17 18:21:48] 维度:29.586588 经度:106.29702
[2020-04-17 18:21:53] 维度:29.586625 经度:106.297076
[2020-04-17 18:21:58] 发送了熄火事件:
[2020-04-17 18:21:58] 执行了停止行驶服务
[2020-04-17 18:21:58] gps轨迹跑完,自动停止行驶!
------------------------------------------------------------------------
[2020-04-16 17:34:46] 请稍后240秒,正在切换轨迹行驶...
[2020-04-16 17:38:46] 建立了连接
[2020-04-16 17:38:47] 进行了登录操作
[2020-04-16 17:38:47] 发送了版本信息
[2020-04-16 17:38:48] 当前设置了GPS轨迹:1_sample(短).json
[2020-04-16 17:38:48] 发送了点火事件
[2020-04-16 17:38:49] 维度:29.569215 经度:106.586935
[2020-04-16 17:38:50] 维度:29.569215 经度:106.587114
[2020-04-16 17:38:51] 维度:29.569231 经度:106.587424
[2020-04-16 17:38:52] 维度:29.569278 经度:106.587685
[2020-04-16 17:38:53] 维度:29.569298 经度:106.587981
[2020-04-16 17:38:54] 维度:29.569341 经度:106.588098
[2020-04-16 17:38:56] 维度:29.569392 经度:106.588287
[2020-04-16 17:38:57] 维度:29.569439 经度:106.588435
[2020-04-16 17:38:58] 维度:29.569506 经度:106.588565
[2020-04-16 17:38:59] 维度:29.569565 经度:106.588646
[2020-04-16 17:39:00] 维度:29.569651 经度:106.588763
[2020-04-16 17:39:01] 维度:29.569745 经度:106.588884
[2020-04-16 17:39:02] 维度:29.569832 经度:106.589073
[2020-04-16 17:39:03] 维度:29.569977 经度:106.589374
[2020-04-16 17:39:05] 维度:29.570114 经度:106.589688
[2020-04-16 17:39:06] 维度:29.570228 经度:106.589993
[2020-04-16 17:39:07] 维度:29.570271 经度:106.590146
[2020-04-16 17:39:08] 维度:29.570291 经度:106.590357
[2020-04-16 17:39:09] 维度:29.570264 经度:106.590573
[2020-04-16 17:39:10] 维度:29.570248 经度:106.590802
[2020-04-16 17:39:11] 维度:29.570205 经度:106.59095
[2020-04-16 17:39:12] 维度:29.570256 经度:106.59108
[2020-04-16 17:39:13] 维度:29.570421 经度:106.591273
[2020-04-16 17:39:15] 维度:29.570578 经度:106.591507
[2020-04-16 17:39:16] 维度:29.570703 经度:106.591673
[2020-04-16 17:39:17] 维度:29.570774 经度:106.591772
[2020-04-16 17:39:18] 维度:29.570943 经度:106.591974
[2020-04-16 17:39:19] 维度:29.57108 经度:106.592145
[2020-04-16 17:39:20] 维度:29.571261 经度:106.592342
[2020-04-16 17:39:21] 维度:29.571332 经度:106.592383
[2020-04-16 17:39:22] 维度:29.571493 经度:106.592527
[2020-04-16 17:39:23] 维度:29.571642 经度:106.592679
[2020-04-16 17:39:25] 维度:29.571748 经度:106.592765
[2020-04-16 17:39:26] 维度:29.571834 经度:106.592877
[2020-04-16 17:39:27] 维度:29.571901 经度:106.593007
[2020-04-16 17:39:28] 维度:29.571936 经度:106.593182
[2020-04-16 17:39:29] 维度:29.571936 经度:106.593308
[2020-04-16 17:39:30] 维度:29.571874 经度:106.593407
[2020-04-16 17:39:31] 维度:29.571815 经度:106.593591
[2020-04-16 17:39:32] 维度:29.571795 经度:106.593784
[2020-04-16 17:39:34] 维度:29.571862 经度:106.593847
[2020-04-16 17:39:35] 发送了熄火事件:
[2020-04-16 17:39:35] 发送了熄火事件:
[2020-04-16 17:39:35] 执行了停止行驶服务
[2020-04-16 17:39:35] gps轨迹跑完,自动停止行驶!
[2020-04-17 18:21:58] 请稍后240秒,正在切换轨迹行驶...
[2020-04-17 18:25:58] 建立了连接
[2020-04-17 18:25:59] 进行了登录操作
[2020-04-17 18:26:00] 发送了版本信息
[2020-04-17 18:26:00] 当前设置了GPS轨迹:6_先涛的车轨迹(短).txt
[2020-04-17 18:26:01] 发送了点火事件
[2020-04-17 18:26:06] 维度:29.585448 经度:106.279711
[2020-04-17 18:26:11] 维度:29.585448 经度:106.279711
[2020-04-17 18:26:16] 维度:29.585448 经度:106.279711
[2020-04-17 18:26:21] 维度:29.585448 经度:106.279711
[2020-04-17 18:26:26] 维度:29.585448 经度:106.279711
[2020-04-17 18:26:31] 维度:29.585448 经度:106.279711
[2020-04-17 18:26:36] 维度:29.585448 经度:106.279711
[2020-04-17 18:26:41] 维度:29.585448 经度:106.279711
[2020-04-17 18:26:47] 维度:29.585448 经度:106.279711
[2020-04-17 18:26:52] 维度:29.585448 经度:106.279711
[2020-04-17 18:26:57] 维度:29.586623 经度:106.287903
[2020-04-17 18:27:02] 维度:29.586608 经度:106.289041
[2020-04-17 18:27:07] 维度:29.586631 经度:106.293958
[2020-04-17 18:27:12] 维度:29.586603 经度:106.296643
[2020-04-17 18:27:17] 维度:29.586588 经度:106.29702
[2020-04-17 18:27:22] 维度:29.586625 经度:106.297076
[2020-04-17 18:27:28] 发送了熄火事件:
[2020-04-17 18:27:28] 执行了停止行驶服务
[2020-04-17 18:27:28] gps轨迹跑完,自动停止行驶!
------------------------------------------------------------------------
[2020-04-16 17:39:35] 请稍后240秒,正在切换轨迹行驶...
[2020-04-16 17:43:35] 建立了连接
[2020-04-16 17:43:36] 进行了登录操作
[2020-04-16 17:43:36] 发送了版本信息
[2020-04-16 17:43:37] 当前设置了GPS轨迹:1_sample(短).json
[2020-04-16 17:43:37] 发送了点火事件
[2020-04-16 17:43:38] 维度:29.569215 经度:106.586935
[2020-04-16 17:43:39] 维度:29.569215 经度:106.587114
[2020-04-16 17:43:40] 维度:29.569231 经度:106.587424
[2020-04-16 17:43:42] 维度:29.569278 经度:106.587685
[2020-04-16 17:43:43] 维度:29.569298 经度:106.587981
[2020-04-16 17:43:44] 维度:29.569341 经度:106.588098
[2020-04-16 17:43:45] 维度:29.569392 经度:106.588287
[2020-04-16 17:43:46] 维度:29.569439 经度:106.588435
[2020-04-16 17:43:47] 维度:29.569506 经度:106.588565
[2020-04-16 17:43:48] 维度:29.569565 经度:106.588646
[2020-04-16 17:43:49] 维度:29.569651 经度:106.588763
[2020-04-16 17:43:50] 维度:29.569745 经度:106.588884
[2020-04-16 17:43:52] 维度:29.569832 经度:106.589073
[2020-04-16 17:43:53] 维度:29.569977 经度:106.589374
[2020-04-16 17:43:54] 维度:29.570114 经度:106.589688
[2020-04-16 17:43:55] 维度:29.570228 经度:106.589993
[2020-04-16 17:43:56] 维度:29.570271 经度:106.590146
[2020-04-16 17:43:57] 维度:29.570291 经度:106.590357
[2020-04-16 17:43:58] 维度:29.570264 经度:106.590573
[2020-04-16 17:43:59] 维度:29.570248 经度:106.590802
[2020-04-16 17:44:00] 维度:29.570205 经度:106.59095
[2020-04-16 17:44:02] 维度:29.570256 经度:106.59108
[2020-04-16 17:44:03] 维度:29.570421 经度:106.591273
[2020-04-16 17:44:04] 维度:29.570578 经度:106.591507
[2020-04-16 17:44:05] 维度:29.570703 经度:106.591673
[2020-04-16 17:44:06] 维度:29.570774 经度:106.591772
[2020-04-16 17:44:07] 维度:29.570943 经度:106.591974
[2020-04-16 17:44:08] 维度:29.57108 经度:106.592145
[2020-04-16 17:44:09] 维度:29.571261 经度:106.592342
[2020-04-16 17:44:10] 维度:29.571332 经度:106.592383
[2020-04-16 17:44:12] 维度:29.571493 经度:106.592527
[2020-04-16 17:44:13] 维度:29.571642 经度:106.592679
[2020-04-16 17:44:14] 维度:29.571748 经度:106.592765
[2020-04-16 17:44:15] 维度:29.571834 经度:106.592877
[2020-04-16 17:44:16] 维度:29.571901 经度:106.593007
[2020-04-16 17:44:17] 维度:29.571936 经度:106.593182
[2020-04-16 17:44:18] 维度:29.571936 经度:106.593308
[2020-04-16 17:44:19] 维度:29.571874 经度:106.593407
[2020-04-16 17:44:21] 维度:29.571815 经度:106.593591
[2020-04-16 17:44:22] 维度:29.571795 经度:106.593784
[2020-04-16 17:44:23] 维度:29.571862 经度:106.593847
[2020-04-16 17:44:24] 发送了熄火事件:
[2020-04-16 17:44:24] 发送了熄火事件:
[2020-04-16 17:44:24] 执行了停止行驶服务
[2020-04-16 17:44:24] gps轨迹跑完,自动停止行驶!
------------------------------------------------------------------------
[2020-04-16 17:44:24] 请稍后240秒,正在切换轨迹行驶...
[2020-04-16 17:48:24] 建立了连接
[2020-04-16 17:48:25] 进行了登录操作
[2020-04-16 17:48:27] 发送了版本信息
[2020-04-16 17:48:27] 当前设置了GPS轨迹:1_sample(短).json
[2020-04-16 17:48:27] 发送了点火事件
[2020-04-16 17:48:29] 发送了熄火事件:
[2020-04-16 17:48:29] 执行了停止行驶服务
[2020-04-16 17:48:29] 本次车机模拟程序跑完........
[2020-04-17 18:27:28] 请稍后240秒,正在切换轨迹行驶...
[2020-04-17 18:31:28] 建立了连接
[2020-04-17 18:31:29] 进行了登录操作
[2020-04-17 18:31:29] 发送了版本信息
[2020-04-17 18:31:30] 当前设置了GPS轨迹:6_先涛的车轨迹(短).txt
[2020-04-17 18:31:30] 发送了点火事件
[2020-04-17 18:31:35] 发送了熄火事件:
[2020-04-17 18:31:35] 执行了停止行驶服务
[2020-04-17 18:31:35] 本次车机模拟程序跑完........
start.py
View file @
2df27cb9
...
...
@@ -14,7 +14,7 @@ def startSimulaterService():
autoCarObj
.
setServiceTime
(
1
*
10
*
60
)
# 设置整个服务的持续时间
autoCarObj
.
setOilExpend
(
10
)
# 设置1L 油跑多少公里
autoCarObj
.
setSpeed
(
6
0
)
#设置车速,每小时多少公里
autoCarObj
.
setSpeed
(
8
0
)
#设置车速,每小时多少公里
autoCarObj
.
startService
()
if
__name__
==
"__main__"
:
...
...
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