此更改更改了imu数据处理方式,使得静止状态yaw不会发生偏移,后续应优化陀螺仪数据处理:低通滤波会导致相位延迟、滑动窗口会导致数据有微量误差。

无法避免运动过程中的yaw偏移。
后续应在运动时也加上零漂偏移
This commit is contained in:
2026-06-23 22:34:15 +08:00
parent 630cb18277
commit b14befd1cf
29 changed files with 9433 additions and 391 deletions

44
scripts/set_volume.py Normal file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env python3
import subprocess, sys
# ============================================
# 修改下面这个数字即可调整音量,范围 0 ~ 100
# ============================================
VOLUME = 80 # 百分比
SINK = "alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo"
def run(cmd):
subprocess.run(cmd, capture_output=True, text=True)
def get_volume():
r = subprocess.run(["pactl", "get-sink-volume", SINK],
capture_output=True, text=True)
for line in r.stdout.splitlines():
if "front-left:" in line:
print(f"当前音量: {line.strip()}")
return
print(r.stdout.strip())
if len(sys.argv) > 1:
try:
v = int(sys.argv[1])
if 0 <= v <= 100:
VOLUME = v
else:
print("音量需在 0~100 之间")
sys.exit(1)
except ValueError:
print(f"用法: python3 set_volume.py [0~100]")
sys.exit(1)
print(f"设置音量为 {VOLUME}% ...")
run(["pactl", "set-sink-volume", SINK, f"{VOLUME}%"])
# 有硬件 PCM 则同步设置
r = subprocess.run(["amixer", "-c", "1", "set", "PCM", f"{VOLUME}%", "unmute"],
capture_output=True, text=True)
if r.returncode == 0:
print("已同步硬件 PCM")
get_volume()