In this lesson, we will learn the movement direction control method of the Alter robot. You need to prepare the installed Alter robot.
There is no code program in this course. We only introduce the principle and API call of the code program. The specific code program will be introduced in the following courses.
35.1 Alter Racing Car steering method
The steering method of Alter Racing Car is differential steering. When it is necessary to turn, the wheel on one side rotates forward and the wheel on the other side rotates backward, so that the robot can turn in place.
For low-level motor control, please refer to the motor control method. Here we introduce the API call method:
1. Import libraries related to control motor control.
2. Import the library that controls the time delay.
3. Initialize the GPIO for motor control.
4. Control the robot to move forward at full speed (100).
5. Move forward for two seconds and then turn left (rotate left in place).
6. The robot stops moving after one second.
35.2 Alter Classic Car and Alter Dog steering method
The steering methods of Alter Classic Car and Alter Dog are also differential steering. Because Alter Classic Car and Alter Dog need to use multithreading control, the calling method of API is different from Alter Racing Car.
The API call method here can also be used to control Alter Racing Car.
1. Import alterMove to control the robot.
2. Import the library that controls the time delay.
3. Instantiate Alter.
4. Start the thread.
5. Control the robot to move forward at full speed (100).
6. Move forward for two seconds and then turn left (rotate to the left).
7. The robot stops moving after one second.