User Manual
Table Of Contents
- 1. Premise
- 2. Raspberry Pi System Installation and Developmen
- 3 Log In to The Raspberry Pi and Install The App
- 4 Raspberry Pi Structure Assembly and Precautions
- 5 Controlling A Robot via WEB App
- 6 Common Problems and Solutions(Q&A)
- 7 Set The Program to Start Automatically
- 8 Remote Operation of Raspberry Pi Via MobaXterm
- 9 How to Control WS2812 RGB LED
- 10 How to Control The Servo
- 11 Calling the API to Control the Robot
- 12 Automatic Stabilization Function
- 13 Gait Generation Method of A Hexapod Robot
- 14 Make A Police Light or Breathing Light
- 15 Real-Time Video Transmission
- 16 Why OpenCV Uses Multi-threading to Process Vide
- 17 OpenCV Learn to Use OpenCV
- 18 Using OpenCV to Realize Color Recognition and T
- 19 Machine Line Tracking Based on OpenCV
- 20 Create A WiFi Hotspot on The Raspberry Pi
- 21 Install GUI Dependent Item under Window
- 22 How to Use GUI
- 23 Enable UART
- 24 Control Your Adeept_RaspClaws with An Android D
- Conclusion
70
11 Calling the API to Control the Robot
●For the reason that the movement and other functions of walking robots are much more complicated than
wheeled robots:
• The wheeled robot only needs to control the high and low levels of a few GPIO ports to control the
movement of the robot.
• The walking robot needs to control the angle change of a dozen servos, which involves the change of
the movement direction and the generation of gait, and it needs a lot of code to realize the movement of the
walking robot.
● If the code related to the motion control of the walking robot is written into `server.py` or `webServer.py`,
the readability of the program will become poor, so we separate the communication from the underlying motion
control program.
● The code responsible for controlling the movement of the robot is in `move.py` and `RPIservo.py` in the
`server` folder.
●If you want to change the communication method of the robot, or want to write a program to control the
robot, and do not want to reconstruct the code of the underlying motion control and gait generation, you can
refer to the API introduced in this chapter to control the robot. The content introduced in this chapter is also the
method used by our `webServer.py` or `server.py` to control the robot movement.
●First of all, your program needs to be placed in the same file directory as `move.py` and `RPIservo.py`,
and import `move.py` and `RPIservo.py`:
import move
import RPIservo
● After importing, the related thread that controls the robot's gait will be automatically opened in the
background. If there is no command, the thread will be suspended. Put all servos in the initial position in
RPIservo.py, the default is `300`, the value will change after fine adjustment of the servo position:
init_pwm0 = 300
init_pwm1 = 300
init_pwm2 = 300
init_pwm3 = 300
init_pwm4 = 300
init_pwm5 = 300
init_pwm6 = 300