Index>Robot Kit>Alter All in One Kit for RPi>Lesson 35 Movement Direction Control Method
No related product information!

Lesson 35 Movement Direction Control Method

955

       In this lesson, we will learn the movement direction control method of the Alter robot. You need to prepare the installed Alter robot.

image.png


    

    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.

image.png 


2. Import the library that controls the time delay.

image.png 


3. Initialize the GPIO for motor control.

image.png 


4. Control the robot to move forward at full speed (100).

image.png 


5. Move forward for two seconds and then turn left (rotate left in place).

image.png 


6. The robot stops moving after one second.

image.png



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.

image.png 


2. Import the library that controls the time delay.

image.png 


3. Instantiate Alter.

image.png 


4. Start the thread.

image.png 


5. Control the robot to move forward at full speed (100).

image.png 


6. Move forward for two seconds and then turn left (rotate to the left).

 image.png


7. The robot stops moving after one second.

image.png