EasyManuals Logo

Freenove ESP32 User Manual

Default Icon
159 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #123 background imageLoading...
Page #123 background image
Need support? support@freenove.com
121
Chapter 12 Basic Motion
www.freenove.com
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
Please note that the following functions are based on the premise that the robot dog has been calibrated.
If your robot dog has not been calibrated yet, calibrate before learning.
Otherwise, the steering gear may be damaged, or the machine action cannot achieve the desired purpose.
*/
void setup() {
Serial.begin(115200);
Serial.println("\n\nProgram begin ... ");
prefs.begin(NMSPC_STORAGE);
pca.begin();
pca.releaseAllServo();
getServoOffsetFromStorage();
standUp();
delay(3000);
const uint8_t repeatCounts = 3;
const int8_t acts[][2][3] = {
{ { 0, 0, 10 }, { 0, 0, -10 } }, //Rotate horizontally clockwise, counterclockwise horizontal rotation.
{ { 0, 10, 0 }, { 0, -10, 0 } }, //High on the left and low on the right, low on the left and high on the right.
{ { 10, 0, 0 }, { -10, 0, 0 } } //High at the front and low at the back, low at the front and high at the back.
};
for (uint8_t i = 0; i < sizeof(acts) / sizeof(acts[0]); i++) {
for (int k = 0; k < repeatCounts; k++) {
for (int j = 0; j < 2; j++) {
twist_any(acts[i][j][0], acts[i][j][1], acts[i][j][2]);
delay(20);
}
}
}
//Rotate horizontally clockwise, and high at the front and low at the back, low at the front and high at the
back.
int8_t x = 0, y = 0, z = 0;
for (uint8_t j = 0; j < repeatCounts; j++) {
for (int i = 0; i < 360; i += 30) {
x = 10 * sin((double)i * PI / 180);
z = 10 * cos((double)i * PI / 180);
twist_any(x, y, z);
}
}
twist_any(0, 0, 0); //Normal standing

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove ESP32 and is the answer not in the manual?

Freenove ESP32 Specifications

General IconGeneral
BrandFreenove
ModelESP32
CategoryComputer Hardware
LanguageEnglish

Related product manuals