查看: 1240|回复: 0

[项目提交] 2023 DigiKey 汽车应用创意挑战赛--汽车驾驶评分器

[复制链接]
  • TA的每日心情
    开心
    2024-12-14 09:07
  • 签到天数: 19 天

    连续签到: 1 天

    [LV.4]偶尔看看III

    发表于 2024-1-16 10:03:56 | 显示全部楼层 |阅读模式
    分享到:
    本帖最后由 aramy 于 2024-2-2 16:02 编辑

      一、项目名称:汽车驾驶评分器
    作者:aramy

    二、项目概述:
    公司有公用的维护车,每个员工开车习惯都不同,但是行车安全最重要。制作了“汽车驾驶评分器”这个项目,用来监督记录每次行车状态数据。出现危险驾驶行为进行扣分。
    项目硬件使用CoreS3。是一个M5Stack 推出的基于乐鑫 ESP32-S3 开发的 Core 系列第三代主机 CoreS3,集成了多个传感器,其中包括这次项目使用到的加速度传感器、SD卡和2.0寸的触摸屏。另外添加了一个GROVE - GPS (AIR530)模块,使用GPS+北斗来进行定位。
    1、主要框架:系统主要分为3个部分。
    第一部分,收集传感器信息。GPS+北斗定位信息和加速度传感器信息。
    1.png
    GPS+北斗定位信息,用来获得当前车辆的详细位置和速度。有想过将交通地图集成到系统中去,但是能力有限,没能实现。定位信息结合交通地图就能获得不同道路的限速信息,从而实现对不同道路的限速评分管理,但是这个功能暂时没有能够实现。所以对速度的评分,仅仅实现了最高速的扣分(当时速超过120公里/小时则扣分)。加速度传感器用来收集车辆加减速和转弯时的加速度信息。设定了阈值,当车辆加速度超过1倍重力加速度时,意味着产生了急加速、急减速的情况,就给与扣分。
    第二部分为驾驶信息记录部分。CoreS3能力有限,所以将行车时传感器获取到的数据,以文件的方式保留下来。对行车数据进行收集,为以后做出驾驶行为评估模型搭建数据基础。记录文件采取每分钟写入一个单独文件,保障文件不会因断电丢失。
    第三部分为UI部分。最为车载系统,尽可能做到不干扰驾驶员的注意力。所以界面使用仪表盘方式显示了 车速和当前评分。经纬度、加速度等信息辅助显示,颜色使用较为暗淡的方式,尽量做到不干扰驾驶员的注意力。
    2.png

    UI界面使用了LVGL,使用了Guider工具进行UI绘制,代码使用Arduino的C来编写,编程工具使用的是Vscode+platformio。
    2、打分。系统默认驾驶员的驾驶行为为满分(10分)。扣分有三种情况。i:超速行为,当车速超过120公里/小时开始扣分,每秒扣1分。ii:当加速度连续2次(2秒)检测到超过1倍重力加速度,则扣1分。iii:当加速度超过1.5倍重力加速度,则扣1分。
    1. // 评分标准 如果连续两次加速度超过1 或者单次加速度超过1.5 则扣一分,速度超过120KM/小时 扣1分
    2. static int score = 10;
    3. static float oldacc = 0; // 上次的加速度
    4. int judgeScore(LvglQueue lvglmsg)
    5. {
    6.     float acc = lvglmsg.acc; // 本次加速度
    7.     if (oldacc > 1 && acc > 1)
    8.     {
    9.         score--;
    10.     }
    11.     if (acc > 1.5)
    12.         score--;
    13.     if (lvglmsg.speed > 120)
    14.         score--;
    15.     oldacc = acc;
    16.     return score;
    17. }
    复制代码
    1. 21:56:00 :135600 ,latitude:2303.157471 ,longitude:11346.219727 ,speed:32.430000 ,acc_x:-0.067269 ,acc_y:0.942306 ,acc_z:-0.289605 ,gyro_x:2.837960 ,gyro_y:0.201862 ,gyro_z:0.255032 ,judge:10
    2. 21:56:01 :135601 ,latitude:2303.162109 ,longitude:11346.228516 ,speed:33.110001 ,acc_x:-0.044075 ,acc_y:0.968673 ,acc_z:-0.357965 ,gyro_x:-1.739677 ,gyro_y:0.323933 ,gyro_z:0.193996 ,judge:10
    3. 21:56:01 :135601 ,latitude:2303.162109 ,longitude:11346.228516 ,speed:33.110001 ,acc_x:-0.026497 ,acc_y:0.916916 ,acc_z:-0.331353 ,gyro_x:-5.706962 ,gyro_y:0.018757 ,gyro_z:-0.477390 ,judge:10
    4. 21:56:03 :135603 ,latitude:2303.171387 ,longitude:11346.246094 ,speed:32.830002 ,acc_x:-0.012581 ,acc_y:0.983566 ,acc_z:-0.275445 ,gyro_x:0.640694 ,gyro_y:-1.079876 ,gyro_z:-1.087742 ,judge:10
    5. 21:56:04 :135604 ,latitude:2303.175781 ,longitude:11346.254883 ,speed:31.780001 ,acc_x:0.005974 ,acc_y:0.970871 ,acc_z:-0.253228 ,gyro_x:1.128975 ,gyro_y:-0.408489 ,gyro_z:1.292629 ,judge:10
    6. 21:56:05 :135605 ,latitude:2303.180176 ,longitude:11346.262695 ,speed:31.000000 ,acc_x:-0.062142 ,acc_y:0.975753 ,acc_z:-0.346246 ,gyro_x:1.495186 ,gyro_y:-1.262981 ,gyro_z:0.804348 ,judge:10
    7. 21:56:06 :135606 ,latitude:2303.184082 ,longitude:11346.270508 ,speed:30.230000 ,acc_x:-0.063362 ,acc_y:0.989181 ,acc_z:-0.277154 ,gyro_x:3.692452 ,gyro_y:0.323933 ,gyro_z:-0.111179 ,judge:10
    8. 21:56:06 :135606 ,latitude:2303.184082 ,longitude:11346.270508 ,speed:30.230000 ,acc_x:-0.013069 ,acc_y:0.970871 ,acc_z:-0.305719 ,gyro_x:1.190010 ,gyro_y:0.018757 ,gyro_z:0.316067 ,judge:10
    9. 21:56:08 :135608 ,latitude:2303.191895 ,longitude:11346.286133 ,speed:28.850000 ,acc_x:-0.078499 ,acc_y:0.971115 ,acc_z:-0.280084 ,gyro_x:0.701729 ,gyro_y:1.117390 ,gyro_z:1.292629 ,judge:10
    10. 21:56:09 :135609 ,latitude:2303.195557 ,longitude:11346.293945 ,speed:28.230000 ,acc_x:0.001335 ,acc_y:1.002365 ,acc_z:-0.263971 ,gyro_x:1.800362 ,gyro_y:0.018757 ,gyro_z:-4.322605 ,judge:10
    11. 21:56:09 :135609 ,latitude:2303.195557 ,longitude:11346.293945 ,speed:28.230000 ,acc_x:-0.039437 ,acc_y:0.975509 ,acc_z:-0.315240 ,gyro_x:-1.251396 ,gyro_y:2.399128 ,gyro_z:-0.172215 ,judge:10
    12. 21:56:11 :135611 ,latitude:2303.202881 ,longitude:11346.308594 ,speed:26.059999 ,acc_x:-0.098763 ,acc_y:1.006759 ,acc_z:-0.239557 ,gyro_x:2.715889 ,gyro_y:2.338093 ,gyro_z:1.353664 ,judge:10
    13. 21:56:12 :135612 ,latitude:2303.206543 ,longitude:11346.314453 ,speed:24.230000 ,acc_x:-0.039193 ,acc_y:1.008224 ,acc_z:-0.315973 ,gyro_x:3.509346 ,gyro_y:2.154987 ,gyro_z:-2.552586 ,judge:10
    14. 21:56:13 :135613 ,latitude:2303.209961 ,longitude:11346.320312 ,speed:21.879999 ,acc_x:-0.020638 ,acc_y:0.885421 ,acc_z:-0.327936 ,gyro_x:-3.387626 ,gyro_y:1.605671 ,gyro_z:3.428860 ,judge:10
    15. 21:56:13 :135613 ,latitude:2303.209961 ,longitude:11346.320312 ,speed:21.879999 ,acc_x:-0.022103 ,acc_y:0.993820 ,acc_z:-0.273004 ,gyro_x:1.251046 ,gyro_y:0.568073 ,gyro_z:-1.270847 ,judge:10
    16. 21:56:15 :135615 ,latitude:2303.216797 ,longitude:11346.331055 ,speed:19.889999 ,acc_x:-0.026497 ,acc_y:0.940597 ,acc_z:-0.340875 ,gyro_x:2.105538 ,gyro_y:-0.469524 ,gyro_z:-0.538426 ,judge:10
    17. 21:56:16 :135616 ,latitude:2303.220215 ,longitude:11346.335938 ,speed:19.600000 ,acc_x:-0.053109 ,acc_y:0.885666 ,acc_z:-0.317926 ,gyro_x:4.241768 ,gyro_y:-1.507122 ,gyro_z:-0.965672 ,judge:10
    18. 21:56:17 :135617 ,latitude:2303.223877 ,longitude:11346.339844 ,speed:20.500000 ,acc_x:-0.025765 ,acc_y:0.900558 ,acc_z:-0.334283 ,gyro_x:-0.030693 ,gyro_y:1.361530 ,gyro_z:0.682278 ,judge:10
    19. 21:56:17 :135617 ,latitude:2303.223877 ,longitude:11346.339844 ,speed:20.500000 ,acc_x:-0.050667 ,acc_y:0.939132 ,acc_z:-0.320367 ,gyro_x:2.654854 ,gyro_y:1.971882 ,gyro_z:0.071926 ,judge:10
    20. 21:56:19 :135619 ,latitude:2303.231201 ,longitude:11346.349609 ,speed:20.520000 ,acc_x:-0.071907 ,acc_y:1.071457 ,acc_z:-0.265924 ,gyro_x:4.424874 ,gyro_y:2.399128 ,gyro_z:-3.468113 ,judge:10
    21. 21:56:20 :135620 ,latitude:2303.234863 ,longitude:1134635392.000000 ,speed:20.200001 ,acc_x:-0.046273 ,acc_y:0.937179 ,acc_z:-0.272516 ,gyro_x:-3.692802 ,gyro_y:3.009480 ,gyro_z:2.696438 ,judge:10
    22. 21:56:21 :135621 ,latitude:2303.238525 ,longitude:11346.358398 ,speed:19.370001 ,acc_x:0.015739 ,acc_y:0.956955 ,acc_z:-0.295465 ,gyro_x:2.166573 ,gyro_y:-1.018841 ,gyro_z:-6.580906 ,judge:10
    23. 21:56:23 :135623 ,latitude:2303.245850 ,longitude:11346.367188 ,speed:18.020000 ,acc_x:-0.020150 ,acc_y:0.856125 ,acc_z:-0.025201 ,gyro_x:-12.359795 ,gyro_y:-0.042278 ,gyro_z:-0.355320 ,judge:10
    24. 21:56:24 :135624 ,latitude:2303.249268 ,longitude:11346.371094 ,speed:17.219999 ,acc_x:-0.098519 ,acc_y:0.955734 ,acc_z:-0.188043 ,gyro_x:-3.570732 ,gyro_y:0.812214 ,gyro_z:0.438137 ,judge:10
    25. 21:56:24 :135624 ,latitude:2303.249268 ,longitude:11346.371094 ,speed:17.219999 ,acc_x:-0.014046 ,acc_y:0.978683 ,acc_z:-0.375299 ,gyro_x:0.213448 ,gyro_y:0.934284 ,gyro_z:0.926418 ,judge:10
    26. 21:56:26 :135626 ,latitude:2303.255615 ,longitude:11346.377930 ,speed:15.250000 ,acc_x:-0.093636 ,acc_y:0.840255 ,acc_z:-0.394098 ,gyro_x:-2.655204 ,gyro_y:2.216022 ,gyro_z:1.719875 ,judge:10
    27. 21:56:26 :135626 ,latitude:2303.255615 ,longitude:11346.377930 ,speed:15.250000 ,acc_x:-0.045052 ,acc_y:0.934494 ,acc_z:-0.312066 ,gyro_x:0.823799 ,gyro_y:0.629108 ,gyro_z:1.109524 ,judge:10
    28. 21:56:28 :135628 ,latitude:2303.262207 ,longitude:11346.384766 ,speed:16.420000 ,acc_x:-0.011360 ,acc_y:0.967209 ,acc_z:-0.322076 ,gyro_x:-3.204521 ,gyro_y:1.300495 ,gyro_z:1.780910 ,judge:10
    29. 21:56:28 :135628 ,latitude:2303.262207 ,longitude:11346.384766 ,speed:16.420000 ,acc_x:-0.071907 ,acc_y:0.873947 ,acc_z:-0.384332 ,gyro_x:1.678292 ,gyro_y:1.117390 ,gyro_z:0.743313 ,judge:10
    30. 21:56:30 :135630 ,latitude:2303.268555 ,longitude:11346.391602 ,speed:16.020000 ,acc_x:-0.021859 ,acc_y:0.944015 ,acc_z:-0.362359 ,gyro_x:1.800362 ,gyro_y:0.995319 ,gyro_z:1.475735 ,judge:10
    31. 21:56:30 :135630 ,latitude:2303.268555 ,longitude:11346.391602 ,speed:16.020000 ,acc_x:-0.040413 ,acc_y:0.927414 ,acc_z:-0.408502 ,gyro_x:-0.580009 ,gyro_y:0.262897 ,gyro_z:0.377102 ,judge:10
    复制代码

    三、作品实物图
    微信图片_20240116173431.jpg
    5.png
    4.png
    7.png
    6.png


    四、演示视频
    五、项目文档
    链接:https://pan.baidu.com/s/1-1XPUpYTo4-4l2V1egzBjA
    提取码:wsg6




    3.png
    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /5 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-12-24 08:44 , Processed in 0.118008 second(s), 17 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.