Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/CICID.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,22 @@ jobs:
path: |
enhance/undergraduate/hutbthesis_main.pdf

# 触发基于水下工作环境的传感器与通信链路仿真系统论文的 action
- name: Compile Comm LaTeX document
uses: xu-cheng/latex-action@v3
with:
working_directory: comm/undergraduate
root_file: hutbthesis_main.tex
texlive_version: 2023
latexmk_use_xelatex: true
# 下载安装Times New Roman字体
pre_compile: |
apk add msttcorefonts-installer fontconfig
update-ms-fonts
fc-cache -f
- uses: actions/upload-artifact@v4
with:
name: comm
path: |
comm/undergraduate/hutbthesis_main.pdf

34 changes: 34 additions & 0 deletions comm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# comm —— 基于水下工作环境的传感器与通信链路仿真系统

本模块为本科毕业设计(论文)代码与论文目录,对应题目:**基于水下工作环境的传感器与通信链路仿真系统**。

- GitHub 账号:thirtyone-o
- 搭档:joe-justin、heshuyun9
- 选题关键词:噪声、延迟、漂移、遮挡、低能见度、声呐成像;支撑算法和操作训练

## 目录结构
```
comm/
├── code/ # 仿真代码
│ ├── assets/ # 模型、配置等资源文件
│ ├── tests/ # 测试代码(功能测试、性能测试)
│ └── comm_sim.py # 模块唯一入口程序(占位,待实现)
└── undergraduate/ # 毕业论文(LaTeX)
├── hutbthesis_main.tex # 论文编译主文件
├── content/ # 章节、摘要、参考文献
└── images/ # 论文插图
```

## 环境与规范
- 仿真平台、依赖版本以仓库根目录 `requirements.txt`、`config.ini` 与导师要求为准。
- 代码中统一使用相对路径,不写绝对路径;依赖写入 `code/requirements.txt` 并指定版本。
- 所有功能须在 Town01、Town10 场景下测试通过,并经另一名同学在其电脑上运行验证、截图留档后,才可合并到主分支。
- 论文中只允许写入本人已测试通过的功能与数据;未经验证的内容不得写入。

## 参考链接(选题表 H 列)
- 示例·水域载具:https://openhutb.github.io/ros2/#water_vehicle
- 运动控制:https://mp.weixin.qq.com/s/RLZHx11olWrYezoFQ4E9lw
- 水下方向文档:https://openhutb.github.io/mujoco_plugin/underwater/
- 水下机器人仿真参考代码:https://github.com/open-airlab/UNav-Sim
- 模拟器主仓库:https://github.com/OpenHUTB/mcp
- 平台文档主页:https://openhutb.github.io/
33 changes: 33 additions & 0 deletions comm/code/comm_sim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""
基于水下工作环境的传感器与通信链路仿真系统 —— 模块入口程序

说明:
- 本文件是 comm 模块唯一的 Python 入口程序,其他功能模块在包内拆分,由本文件调度。
- 当前为开题阶段占位框架,具体仿真功能待实现;未在本地与同学电脑上测试通过的功能不要合并到主分支。
- 代码中统一使用相对路径,依赖统一写入本目录 requirements.txt 并指定版本。

运行方式(待依赖装好后):
python comm_sim.py --scene Town01
"""

import argparse
import sys


def parse_args():
parser = argparse.ArgumentParser(description="Underwater sensor and communication link simulation system")
parser.add_argument("--scene", default="Town01", help="仿真场景名称(如 Town01 / Town10)")
parser.add_argument("--config", default="../config.ini", help="配置文件路径(相对路径)")
return parser.parse_args()


def main():
args = parse_args()
print("[comm] 仿真系统入口(占位)")
print(f"[comm] 场景: {args.scene}")
print("[comm] 待实现:水下环境建模、传感器仿真、通信链路仿真、声呐成像与交互界面。")
return 0


if __name__ == "__main__":
sys.exit(main())
14 changes: 14 additions & 0 deletions comm/code/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# comm 模块依赖
# 说明:仿真平台(Carla / mujoco/muoco 等)及版本以导师要求与仓库根目录 requirements.txt 为准,
# 确认平台后再在此处补充对应依赖并锁定版本。

# 数值计算与数据处理
numpy>=1.24.0
scipy>=1.11.0

# 可视化与交互界面(仓库规范:界面统一用 pygame)
pygame>=2.5.0
matplotlib>=3.7.0

# 测试
pytest>=7.4.0
46 changes: 46 additions & 0 deletions comm/code/tests/run_all_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""
测试运行器 - 运行本模块所有测试并生成摘要

运行方式:
python tests/run_all_tests.py
"""

import sys
import time
import unittest
from pathlib import Path

# 添加父目录到路径
sys.path.insert(0, str(Path(__file__).parent.parent))


def run_tests():
"""运行所有测试"""
loader = unittest.TestLoader()
start_dir = Path(__file__).parent
suite = loader.discover(start_dir, pattern="test_*.py")

runner = unittest.TextTestRunner(verbosity=2)
start_time = time.time()
result = runner.run(suite)
elapsed_time = time.time() - start_time

print("\n" + "=" * 70)
print("测试摘要")
print("=" * 70)
print(f"运行时间: {elapsed_time:.2f} 秒")
print(f"测试总数: {result.testsRun}")
print(f"通过: {result.testsRun - len(result.failures) - len(result.errors)}")
print(f"失败: {len(result.failures)}")
print(f"错误: {len(result.errors)}")
print(f"跳过: {len(result.skipped)}")

if result.wasSuccessful():
print("\n所有测试通过!")
return 0
print("\n测试失败")
return 1


if __name__ == "__main__":
sys.exit(run_tests())
22 changes: 22 additions & 0 deletions comm/code/tests/test_smoke.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
冒烟测试占位:验证入口程序可正常解析参数并返回。
后续新增功能时,在本目录按 test_*.py 命名补充功能测试与性能测试。
"""

import sys
import unittest
from pathlib import Path

sys.path.insert(0, str(Path(__file__).parent.parent))

import comm_sim # noqa: E402


class TestSmoke(unittest.TestCase):
def test_entry_callable(self):
# 占位阶段仅验证模块可导入、入口函数存在
self.assertTrue(callable(comm_sim.main))


if __name__ == "__main__":
unittest.main()
Loading
Loading