[The robot dog is derived from the work of Lichuang EDA Bionic Robot Dog Training Camp]
【running result】
see attached
1. Hardware structure
1.Circuit structure
2. Wiring
2. Firmware development
1. Development environment setup
1 Introduction
The development process of Hi3861 is developed and compiled in the virtual machine Linux environment, and burned using Windows . It is developed using the Ubuntu image + Pycharm code writing + hiburn serial port burning under Windows provided by Lichuang Training Camp .
2) Install virtual machine VMware and Ubutun system (Ubutun account password: 123)
3) Clone the source code from the gitee code repository to local
git clone https://gitee.com/genkipi/ohosdog.git
Here I created a new mydog folder, opened the terminal in the mydog folder, and cloned to the folder
4) Install pycharm
Community Edition:$sudo snap install pycharm-community --classic
Professional version:$ sudo snap install pycharm-professional --classic
Educational version:$sudo snap install pycharm-education --classic
5) Use Pycharm to open the source code project and wait for the loading to complete
Right-click the directory ohosdog and select "Open with other programs" -> "Pycharm" (pycharm can be found in other programs)
6) Compile source code
Open the terminal of pycharm, enter hb set, press Enter twice, select the Yuanqipai environment, and then enter hb build to complete the compilation
7) Firmware burning
Copy the Hi3861_wifiiot_app_allinone.bin file in the directory ./ohosdoh/out/genkipi/genkipi to the Windows computer, open the hiburn serial port burning tool to complete the burning
8) Program testing
In the serial port assistant in the picture above, we can see that the serial port prints the AP information. We turn on the wifi on the computer or mobile phone, access the wireless network " itcast_d88f ", the password " 12345678 ", and then enter the IP address "192.168.10.1" to enter Chuanzhi Education has written a management webpage for us. The HTML code of this webpage is located around line 42 of genki_web_ohosdog.c. The specific location and webpage effect are as follows:
We click on the "Dog Control" text below to jump to the robot dog control interface, then click on the installation mode to check the movement of the servo, assemble the robot dog legs according to the requirements of the training camp, and then click on standing still or other actions to check Servo, verify the action of the robot dog. At this point, the hardware design, structural assembly, and basic function testing of the robot dog are completed. Next, we complete our own firmware development.
9) Improve the basic motion control of the robot dog
When we look at the source code of the above control web page, we can find that except for initialization, the data sent by other moving buttons are the same. We can see that there is a data list at the end of the web page, which contains the posture information of the robot dog. We use the official The provided gait instruction generator generates instructions for forward, backward, left, and right movements, then updates them to the source code, and recompiles and burns them.
Reference action instructions:
Steps: [74, 90, 45, 110, 45, 110, 74, 90, 150], [45, 110, 74, 90, 74, 90, 45, 110, 150]
Squat: [0, 110, 0, 110, 0, 110, 0, 110, 50],[-15, 105, -15, 105, -15, 105, -15, 105, 50],[-20 , 100, -20, 100, -20, 100, -20, 100, 50],[-25, 95, -25, 95, -25, 95, -25, 95, 50],[-30, 90 , -30, 90, -30, 90, -30, 90, 50],[-35, 85, -35, 85, -35, 85, -35, 85, 50],[-40, 80, - 40, 80, -40, 80, -40, 80, 50],[-45, 75, -45, 75, -45, 75, -45, 75, 50],[-50, 75, -50, 75, -50, 75, -50, 75, 50]
Handshake: [-50, 75, -50, 75, -50, 75, -50, 75, 50], [-50, 75, -45, 80, -45, 80, -55, 75, 50], [-50, 75, -40, 85, -40, 85, -55, 75, 50],[-50, 75, -35, 90, -35, 85, -55, 75, 50],[- 50, 75, -30, 90, -30, 90, -55, 75, 50],[-50, 75, -25, 90, -25, 90, -55, 75, 50],[-50, 75, -20, 90, -20, 90, -55, 75, 50],[-50, 75, -15, 90, -15, 90, -55, 75, 50],[-50, 75, -10, 90, -10, 90, -55, 75, 50],[-25, 90, 0, 100, 0, 100, -55, 75, 100],[-50, 75, 0, 100, 0, 100, -55, 75, 100],[-25, 90, 0, 100, 0, 100, -55, 75, 100],[-50, 75, 0, 100, 0, 100, -55 , 75, 100],[-25, 90, 0, 100, 0, 100, -55, 75, 100],[-50, 75, 0, 100, 0, 100, -55, 75, 100], [-25, 85, 0, 100, 0, 100, -25, 90, 100],[-15, 95, 0, 100, 0, 100, -15, 95, 100],[-5, 100, 0, 100, 0, 100, -5, 100, 100],[0, 100, 0, 100, 0, 100, 0, 100, 100]
Forward: [32, 75, 41, 134, 50, 130, 32, 75, 100], [31, 99, -18, 121, -6, 123, 20, 103, 100], [48, 129, 0 , 95, 11, 92, 39, 132, 100], [32, 134, 19, 89, 31, 81, 23, 136, 100], [-17, 107, 29, 121, 39, 118, -29 , 107, 100]
Backward: [78, 147, 23, 113, 34, 109, 69, 153, 100], [60, 138, -12, 125, 0, 128, 51, 142, 100], [35, 111, 53, 159, 60, 155, 24, 115, 100], [17, 117, 66, 151, 75, 145, 7, 118, 100], [23, 148, 33, 126, 43, 123, 15, 145, 100]
Turn left: [78, 147, 23, 113, 50, 130, 19, 86, 100], [60, 138, -12, 125, -6, 123, 20, 103, 100], [35, 111, 53, 159, 11, 92, 39, 132, 100], [32, 134, 19, 89, 31, 81, 23, 136, 100], [-17, 107, 29, 121, 39, 118, - 29, 107, 100]
Turn right: [32, 75, 41, 134, 34, 109, 69, 153, 100], [31, 99, -18, 121, 0, 128, 51, 142, 100], [48, 129, 0 , 95, 60, 155, 24, 115, 100], [17, 117, 66, 151, 75, 145, 7, 118, 100], [23, 148, 33, 126, 43, 123, 15, 145 , 100]