Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# IDE配置(必加)
.idea/
*.iml
*.ipr
*.iws

# 虚拟环境(必加)
.venv/
venv/
env/

# 项目无关目录(你的核心问题源)
src/V2X_edge_intelligence/src/demo_carla_data/
yolov7/

# 错误生成的文件
tatus

# Python缓存文件
__pycache__/
*.pyc
*.pyo
*.pyd

# 系统临时文件
.DS_Store
Thumbs.db
12 changes: 12 additions & 0 deletions src/V2X_edge_intelligence/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 璺晶鎰熺煡鏁版嵁闆嗛澶勭悊妯″潡锛圕arla閫傞厤锛�
## 妯″潡璇存槑
鏈ā鍧楅拡瀵笴arla妯℃嫙鍣ㄧ敓鎴愮殑杞﹁矾鍗忓悓璺晶鎰熺煡鏁版嵁锛屽疄鐜拌交閲忓寲棰勫鐞嗭紙鏁版嵁鐢熸垚銆佸寮恒€佸垝鍒嗭級锛屽叏绋嬫棤绗笁鏂逛緷璧栵紝鐩存帴杩愯鍑虹粨鏋溿€�

## 杩愯鐜
- Python 3.6+锛堟棤闇€浠讳綍绗笁鏂瑰簱锛屼粎鐢ㄥ唴缃ā鍧楋級
- 鎿嶄綔绯荤粺锛歐indows/Linux/macOS鍧囧彲

## 杩愯姝ラ
1. 杩涘叆妯″潡鐩綍锛�
```bash
cd C:\Users\21015\PycharmProjects\nn2\V2X_edge_intelligence\src
110 changes: 110 additions & 0 deletions src/V2X_edge_intelligence/src/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
璺晶鎰熺煡鏁版嵁闆嗛澶勭悊锛圕arla 0.9.10缁堟瀬閫傞厤鐗堬級
杩愯鍓嶏細鍏堝惎鍔―:\WindowsNoEditor\CarlaUE4.exe
"""
import sys
import os
import time
import json
from typing import Dict, Any

# ========== 鍔犺浇Carla egg鏂囦欢 ==========
CARLA_EGG_PATH = r"D:\WindowsNoEditor\PythonAPI\carla\dist\carla-0.9.10-py3.7-win-amd64.egg"
sys.path.append(CARLA_EGG_PATH)

# 瀵煎叆Carla骞跺閿�
try:
import carla
print(f"鉁� 鎴愬姛鍔犺浇Carla API锛�0.9.10閫傞厤鐗堬級")
except Exception as e:
print(f"鉂� 鍔犺浇Carla API澶辫触锛歿str(e)}")
sys.exit(1)

# ========== 閰嶇疆椤� ==========
CARLA_HOST = "localhost"
CARLA_PORT = 2000
TIMEOUT = 10.0
SAVE_DIR = "carla_sensor_data"

# ========== 杩炴帴妯℃嫙鍣� ==========
def connect_carla() -> carla.World:
"""杩炴帴Carla 0.9.10妯℃嫙鍣�"""
try:
client = carla.Client(CARLA_HOST, CARLA_PORT)
client.set_timeout(TIMEOUT)
world = client.get_world()
print(f"鉁� 鎴愬姛杩炴帴Carla妯℃嫙鍣細{CARLA_HOST}:{CARLA_PORT}")
return world
except Exception as e:
print(f"鉂� 杩炴帴澶辫触锛歿str(e)}")
sys.exit(1)

# ========== 鑾峰彇璺晶鏁版嵁锛堝畬鍏ㄩ€傞厤0.9.10锛� ==========
def get_roadside_data(world: carla.World) -> Dict[str, Any]:
"""鑾峰彇璺晶鎰熺煡鏁版嵁锛堥伩寮€鎵€鏈夋柊鐗圓PI锛�"""
blueprint_lib = world.get_blueprint_library()

# 1. 婵€鍏夐浄杈鹃厤缃紙浠呰缃弬鏁帮紝涓嶈幏鍙栬繑鍥炲€硷紝閬垮厤API鍐茬獊锛�
lidar_bp = blueprint_lib.find("sensor.lidar.ray_cast")
# 0.9.10浠呮敮鎸佸熀纭€鍙傛暟锛屼笖鏃犻渶鑾峰彇杩斿洖鍊�
lidar_bp.set_attribute("range", "100")
lidar_bp.set_attribute("rotation_frequency", "10")

# 2. 鎽勫儚澶撮厤缃紙鍚屾牱浠呰缃紝涓嶈幏鍙栵級
camera_bp = blueprint_lib.find("sensor.camera.rgb")
camera_bp.set_attribute("image_size_x", "1920")
camera_bp.set_attribute("image_size_y", "1080")

# 3. 杞﹁締妫€娴嬶紙0.9.10鏍稿績API鍏煎锛�
vehicles = world.get_actors().filter("vehicle.*")
vehicle_list = []
for v in vehicles:
trans = v.get_transform()
vehicle_list.append({
"id": v.id,
"model": v.type_id,
"x": float(trans.location.x),
"y": float(trans.location.y),
"z": float(trans.location.z),
"yaw": float(trans.rotation.yaw)
})

# 4. 鏁村悎鏁版嵁锛堜笉渚濊禆浼犳劅鍣ㄥ睘鎬ц幏鍙栵紝閬垮厤API閿欒锛�
return {
"timestamp": time.strftime("%Y%m%d_%H%M%S"),
"roadside_id": "RSU_001",
"lidar_config": {
"range": "100m",
"rotation_frequency": "10Hz"
},
"camera_config": {
"resolution": "1920x1080"
},
"detected_vehicles": vehicle_list,
"vehicle_count": len(vehicle_list)
}

# ========== 淇濆瓨鏁版嵁 ==========
def save_data(data: Dict[str, Any]) -> None:
"""淇濆瓨鏁版嵁鍒癑SON鏂囦欢"""
os.makedirs(SAVE_DIR, exist_ok=True)
file_name = f"roadside_data_{data['timestamp']}.json"
file_path = os.path.join(SAVE_DIR, file_name)
with open(file_path, "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=4)
print(f"鉁� 鏁版嵁宸蹭繚瀛橈細{file_path}")

# ========== 涓诲嚱鏁� ==========
def main():
print("===== Carla 0.9.10 璺晶鏁版嵁閲囬泦 =====\n")
world = connect_carla()
print("馃攳 姝e湪閲囬泦璺晶鎰熺煡鏁版嵁...")
sensor_data = get_roadside_data(world)
save_data(sensor_data)
print(f"\n馃搳 閲囬泦瀹屾垚锛佸叡妫€娴嬪埌 {sensor_data['vehicle_count']} 杈嗚溅杈�")
print("\n===== 鎿嶄綔缁撴潫 =====\n")

if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
Empty file.
54 changes: 54 additions & 0 deletions src/V2X_edge_intelligence/src/road_side_perception/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 绁炵粡缃戠粶瀹炵幇浠g悊

鍒╃敤绁炵粡缃戠粶/ROS 瀹炵幇 Carla锛堣溅杈嗐€佽浜虹殑鎰熺煡銆佽鍒掋€佹帶鍒讹級銆丄irSim銆丮ujoco 涓汉鍜岃浇鍏风殑浠g悊銆�

## 鐜閰嶇疆

* 骞冲彴锛歐indows 10/11锛孶buntu 20.04/22.04
* 杞欢锛歅ython 3.7-3.12锛堥渶鏀寔3.7锛夈€丳ytorch锛堝敖閲忎笉浣跨敤Tensorflow锛�
* 鐩稿叧杞欢涓嬭浇 [閾炬帴](https://pan.baidu.com/s/1IFhCd8X9lI24oeYQm5-Edw?pwd=hutb)

## 鍔熻兘妯″潡琛�
| 妯″潡绫诲埆 | 妯″潡鍚� | 閾炬帴 | 鍏朵粬 |
|-------------------|------------|-------------------------------------------------------------------------------|---------------------------------------------------------------------|
| 瑙勫垝 | 杞﹁締鍏ㄥ眬璺緞瑙勫垝 | [carla_slam_gmapping](https://github.com/OpenHUTB/nn/tree/main/src/carla_slam_gmapping) | - |


## 璐$尞鎸囧崡

鍑嗗鎻愪氦浠g爜涔嬪墠锛岃闃呰 [璐$尞鎸囧崡](https://github.com/OpenHUTB/.github/blob/master/CONTRIBUTING.md) 銆�
浠g爜鐨勪紭鍖栧寘鎷細娉ㄩ噴銆乕PEP 8 椋庢牸璋冩暣](https://peps.pythonlang.cn/pep-0008/) 銆佸皢绁炵粡缃戠粶搴旂敤鍒癈arla妯℃嫙鍣ㄤ腑銆佹挵鍐欏搴� [鏂囨。](https://openhutb.github.io/nn/) 銆佹坊鍔� [婧愪唬鐮佸搴旂殑鑷姩鍖栨祴璇昡(https://docs.github.com/zh/actions/use-cases-and-examples/building-and-testing/building-and-testing-python) 绛夛紙浠嶤arla鍦烘櫙涓幏鍙栫缁忕綉缁滄墍闇€鏁版嵁鎴栧皢绁炵粡缃戠粶鐨勭粨鏋滆緭鍑哄埌鍦烘櫙涓級銆�

### 绾﹀畾

* 姣忎釜妯″潡浣嶄簬`src/{妯″潡鍚峿`鐩綍涓嬶紝`妯″潡鍚峘闇€瑕佺敤2-3涓崟璇嶈〃绀猴紝棣栧瓧姣嶄笉闇€瑕佸ぇ鍐欙紝涓嬪垝绾縛_`鍒嗛殧锛屼笉鑳藉娉涳紝瓒婂叿浣撹秺濂�
* 姣忎釜妯″潡鐨勫叆鍙i』涓篳main.`寮€澶达紝姣斿锛歮ain.py銆乵ain.cpp銆乵ain.bat銆乵ain.sh绛夛紝鎻愪緵鐨凴OS鍔熻兘浠main.launch`鏂囦欢浣滀负鍚姩閰嶇疆鏂囦欢
* 姣忔pull request閮介渶瑕佷繚璇佽兘澶熼€氳繃main鑴氭湰鐩存帴杩愯鏁翠釜妯″潡锛屽湪鎻愪氦淇℃伅涓彁渚涜繍琛屽姩鍥炬垨鎴浘锛汸ull Request鐨勬爣棰樹笉鑳介殢鎰忥紝闇€瑕佹鎷叿浣撶殑淇敼鍐呭锛汻EADME.md鏂囨。涓彁渚涜繍琛岀幆澧冨拰杩愯姝ラ鐨勮鏄�
* 浠撳簱灏介噺淇濆瓨鏂囨湰鏂囦欢锛屼簩杩涘埗鏂囦欢闇€瑕佹厧閲嶏紝濡傝繍琛岄渶瑕佺ず渚嬫暟鎹紝鍙互淇濆瓨灏戦噺鏁版嵁锛屽ぇ閲忔暟鎹彲浠ラ€氳繃鎻愪緵缃戠洏閾炬帴骞惰鏄庝笅杞介摼鎺ュ拰杩愯璇存槑


### 鏂囨。鐢熸垚

娴嬭瘯鐢熸垚鐨勬枃妗o細
1. 瀹夎python 3.11锛屽苟浣跨敤浠ヤ笅鍛戒护瀹夎`mkdocs`鍜岀浉鍏充緷璧栵細
```shell
pip install mkdocs -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip install -r requirements.txt
```
锛堝彲閫夛級瀹夎瀹屾垚鍚庝娇鐢╜mkdocs --version`鏌ョ湅鏄惁瀹夎鎴愬姛銆�

2. 鍦ㄥ懡浠よ涓繘鍏nn`鐩綍涓嬶紝杩愯锛�
```shell
mkdocs build
mkdocs serve
```
鐒跺悗浣跨敤娴忚鍣ㄦ墦寮€ [http://127.0.0.1:8000](http://127.0.0.1:8000)锛屾煡鐪嬫枃妗i〉闈㈣兘鍚︽甯告樉绀恒€�

## 鍙傝€�

* [浠g悊妯℃嫙鍣ㄦ枃妗(https://openhutb.github.io)
* 宸叉湁鐩稿叧 [鏃犱汉杞(https://openhutb.github.io/doc/used_by/) 銆乕鏃犱汉鏈篯(https://openhutb.github.io/air_doc/third/used_by/) 銆乕鍏疯韩浜篯(https://openhutb.github.io/doc/pedestrian/humanoid/) 鐨勫疄鐜�
* [绁炵粡缃戠粶鍘熺悊](https://github.com/OpenHUTB/neuro)

閫氳繃缃戠洏鍒嗕韩鐨勬枃浠讹細supercombo.h5
閾炬帴: https://pan.baidu.com/s/1yYc4aPBLnXRuWXEb0hyKMA?pwd=1234 鎻愬彇鐮�: 1234
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
47 changes: 47 additions & 0 deletions src/V2X_edge_intelligence/src/road_side_perception/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
site_name: 绁炵粡缃戠粶
# 鍙傝€冮摼鎺ワ細https://blog.csdn.net/m0_63203517/article/details/129765689

#repo_url: https://github.com/carla-simulator/carla
#docs_dir: Docs
#edit_uri: 'edit/master/Docs/'


# 璁剧疆缂栬瘧椤甸潰鐨勯摼鎺ョ殑鍓嶇紑
repo_url: https://github.com/OpenHUTB/nn

# 椤甸潰鍙充笂瑙掓坊鍔犵洿鎺ョ紪杈戦〉闈㈢殑鎸夐挳
edit_uri: edit/master/docs/

theme:
name: readthedocs
sticky_navigation: True
navigation_depth: 3
features:
- search.suggest # 鍦ㄧ洰褰曟爮涓殑鎼滅储妗嗕腑杈撳叆涓€浜涘瓧姣嶆椂鎺ㄨ崘琛ュ叏鏁翠釜鍗曡瘝
extra_css: [extra.css]



# mathjax鐢ㄤ簬鍗曠嫭鍏紡灞曠ず
extra_javascript:
- extra.js
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS-MML_HTMLorMML

plugins:
# - mkdocs-video
- search:
lang: ja
separator: '[\s\-\.]+'
min_search_length: 3

extra:
generator: false

nav:
- 棣栭〉: 'index.md'


# - mdx_math 鐢ㄤ簬琛屽唴鍏紡鏄剧ず
markdown_extensions:
- admonition
- mdx_math
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Empty file.
Loading
Loading