增加high lever,待测试,待全部转换为C++版本加速,待接口与官方同步
This commit is contained in:
38
examples/example_highlevel_dance.py
Normal file
38
examples/example_highlevel_dance.py
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
"""高层表演: 跳舞 1 + 头灯炫彩."""
|
||||
import sys
|
||||
import time
|
||||
|
||||
from go1_pro_sdk import Go1, LED
|
||||
|
||||
|
||||
def main():
|
||||
print('🐕 高层示例: 跳舞 + 头灯')
|
||||
|
||||
with Go1() as dog:
|
||||
# 头灯橙黄
|
||||
dog.set_led(LED(255, 128, 0))
|
||||
|
||||
print('stand_up...')
|
||||
dog.stand_up()
|
||||
time.sleep(3)
|
||||
|
||||
print('dance_1!')
|
||||
dog.dance_1()
|
||||
|
||||
# 跳舞期间循环换色
|
||||
colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 0), (255, 0, 255)]
|
||||
for r, g, b in colors:
|
||||
dog.set_led(LED(r, g, b))
|
||||
time.sleep(2)
|
||||
|
||||
print('stand_down...')
|
||||
dog.stand_down()
|
||||
time.sleep(3)
|
||||
dog.set_led(LED(0, 0, 0))
|
||||
|
||||
print('✅ 结束')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main() or 0)
|
||||
Reference in New Issue
Block a user