Skip to main content

PB 车辆配置/标定文件(vehicle_config.proto)反序列化校验、解析为 YAML、从 YAML 组装为 .pb.txt;含真实 pb 往返测试。V0.1.2 使用新 proto(VehicleInfo 新增 color/manufacturer 等)。

Project description

pb-calibration

当前版本:0.1.2

基于 vehicle_config.proto 的 PB 车辆配置/标定文件(.pb.txt)反序列化校验、解析为 YAML、从 YAML 按顺序组装为 .pb.txt
V0.1.2 使用新 proto 定义:VehicleInfo 新增字段 colormanufacturermanufacturer_dateengine_numtypecustomer_vehicle_id;Point3D/Quaternion 保留在单文件内,无外部 import。

环境与安装

推荐使用 Conda 环境 py310,并在该环境中安装本包及依赖:

conda activate py310
pip install -e .   # 开发安装
# 或
pip install .      # 普通安装

若仅安装不开发,也可:

pip install pb-calibration

功能

  1. 反序列化检查:检查 pb.txt 是否存在格式问题(能否正常解析)。
  2. 解析为 YAML:将 pb.txt 解析为每个单独的 yaml 文件,输出到指定目录;该目录与后续「组合」时使用的目录一致。
  3. 从 YAML 组装:按顺序将指定目录中的单独 yaml 文件组装成 pb.txt(输入目录与解析输出目录一致,可指定)。
  4. YamlConfigManager:类,存储默认 YAML 路径;不缓存 YAML 内容,每次从默认路径读取,保证多程序共同维护时数据为最新。支持 read_yaml / update_yamlread_order_manifest / update_order_manifestrescan / get_cached / get
  5. 函数式 APIread_yamlupdate_yamlread_order_manifestupdate_order_manifest(显式传路径,无状态)。

命令行

# 1. 检查 pb.txt 格式
pb-calibration check -i /path/to/vehicle_config.pb.txt

# 2. 解析 pb.txt 为 yaml,输出到指定目录(该目录即后续 build 的输入)
pb-calibration parse -i /path/to/vehicle_config.pb.txt -o /path/to/yaml_dir

# 3. 从指定目录按顺序组装为 pb.txt(目录与 parse 的 -o 一致)
pb-calibration build -i /path/to/yaml_dir -o /path/to/vehicle_config_out.pb.txt

测试

在项目根目录(V0.1.2)下执行:

conda activate py310
pip install -e .
pytest test/ -v

或单独运行:pytest test/test_roundtrip.py -vpytest test/test_api.py -vpytest test/test_yaml_manager.py -v

依赖

  • Python >= 3.10(推荐在 conda 环境 py310 下使用)
  • PyYAML >= 6.0
  • protobuf >= 4.21.0

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pb_calibration-0.1.2.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pb_calibration-0.1.2-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file pb_calibration-0.1.2.tar.gz.

File metadata

  • Download URL: pb_calibration-0.1.2.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for pb_calibration-0.1.2.tar.gz
Algorithm Hash digest
SHA256 34751de7fa6a2b8430ca9f14e5494063b33cf350ba9b2da7e38208b82cfa909f
MD5 e90f0b7d1d03162bbf5fa45b63071d0e
BLAKE2b-256 f31a8bc962b2759305fbbf58442f0571e1012753d50f5dbe199348e8c67a5bc9

See more details on using hashes here.

File details

Details for the file pb_calibration-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pb_calibration-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for pb_calibration-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 25ad92e1c3e3ea4a180fec9acddeb9168fa5d2eb1419adc3f008d209d32a352f
MD5 65a7529a48c8aa75fe6377519931102d
BLAKE2b-256 5849ab82eee901b1b96a577298027dc8815c6666c03b858fc584223702899fb2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page