juechafun/Untitled 6.md

82 lines
1.4 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
#领域/未知
#复盘/0 #临时/备忘 #状态/待处理
20260313-备忘-主题名-文件内容
## 一句话描述
[________]
---
```C
void InitializeServo()
    {
        ESP_LOGI(TAG, "=== 四足机器人向前走三步 ===");
        // 循环3次执行前进步态
        for (int step = 0; step < 5; step++)
        {
            // --- 初始准备 ---
            // 所有腿伸到最前或最后位置
            servo1_.SetAngle(30.0f);
            servo2_.SetAngle(130.0f);
            servo3_.SetAngle(130.0f);
            servo4_.SetAngle(60.0f);
            vTaskDelay(pdMS_TO_TICKS(100));
            servo1_.SetAngle(10.0f);
            servo2_.SetAngle(130.0f);
            servo3_.SetAngle(130.0f);
            servo4_.SetAngle(80.0f);
            vTaskDelay(pdMS_TO_TICKS(100));
            servo1_.SetAngle(30.0f);
            servo2_.SetAngle(170.0f);
            servo3_.SetAngle(90.0f);
            servo4_.SetAngle(80.0f);
            vTaskDelay(pdMS_TO_TICKS(100));
        }
        // --- 初始准备 ---
        // 所有腿伸到最前或最后位置
        servo1_.SetAngle(30.0f);
        servo2_.SetAngle(130.0f);
        servo3_.SetAngle(130.0f);
        servo4_.SetAngle(60.0f);
        vTaskDelay(pdMS_TO_TICKS(100));
    }
```