You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/dance.rst
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
Dance
2
2
=========
3
3
4
-
在这个项目中,我们会播放一段音乐,并让Pisloth跟着音乐的节奏来跳一段舞。
4
+
In this project, we will play a piece of music and let Pisloth dance to the rhythm of the music.
5
5
6
-
You can open ``dancing.py`` in the folder of the ``example`` or directly copy the following code to the Python IDE to run.
6
+
You can open ``dancing.py`` in the folder of the ``example`` with command ``sudo pyrhon3 dancing.py`` or directly copy the following code to the Python IDE to run.
7
7
8
8
**Code**
9
9
@@ -69,23 +69,22 @@ You can open ``dancing.py`` in the folder of the ``example`` or directly copy th
69
69
70
70
**How it works?**
71
71
72
-
你可以通过导入下面的这个库来让pisloth播放音乐。
72
+
You can make Pisloth play music by importing the following library.
73
73
74
74
.. code:: python
75
75
76
76
from robot_hat importTTS, Music
77
77
78
-
播放musics目录下的背景音乐并设置音量为20。
78
+
Play the background music in the music directory and set the volume to 20.
Execute the function ``sloth.do_action(motion_name,step=1,speed=None,bpm=None)`` to let Pisloth perform the actions we set.
86
+
The bpm parameter here will affect the interval time between Pisloth's actions, the larger the value, the shorter the interval time.
87
+
When we learn about the bpm of a piece of music through some methods, you can freely match the movement of the Pisloth according to the bpm of this music to make it dance with different styles of music.
89
88
90
-
对于音乐的bmp,如果你想了解更多,可以参考:
89
+
For music bmp, if you want to know more, you can refer to:
Through the last lesson, we learned how to customize the action of Pisloth with the ``add_action`` function. In this lesson, we will directly control the four servos of the Pisloth leg through the keyboard, which allows you to
5
+
have a more intuitive understanding of Pisloth's leg servos to help you customize some more interesting actions.
6
6
7
7
**Code**
8
8
@@ -100,12 +100,9 @@ DIY Action2
100
100
101
101
**How it works?**
102
102
103
-
本程序分为两个部分,第一个部分读取按下的键盘的字符,第二部分是通过按下的键盘字符来控制四个舵机。
103
+
This program is divided into two parts. The first part reads the characters of the pressed keyboard, and the second part controls the four servos by pressing the characters of the keyboard.
``left_up_angle``, ``left_down_angle``, ``right_up_angle``, ``right_down_angle`` corresponds to the four values in the parameters of the function ``add_action``. We increase or decrease these four values by pressing the preset keyboard characters to control the rotation direction and amplitude of the four servos on the pisloth leg.
The ultrasonic module reads the distance between your hand and the Pisloth and sets the judgment condition. When the distance is less than or equal to alert_distance, Pisloth will play the audio file and do ``backward`` and ``stand`` actions.
0 commit comments