When we use the run_angle() command several times in the program, it's hard to follow how many rotations the motor has made in order to set it to the proper turning angle for it to reach its next target. Which is why we also have a command known as run_target.

To access the full video please subscribe to FLLCasts.com
- #1557
- 11 Mar 2020
This command has 4 input parameters:
- The speed at which the motor turns;
- The angle which the motor has to reach;
- What type of brake the motor should use;
- Should the program wait for the command to complete its action or not.
With this command, you don't even need a positive or negative speed value. It will choose the proper direction on its own in order to reach the target angle.
Here's an example of how the robot can be programmed to turn one motor to 90 degrees with a speed of 360:
Motor(Port.B).run_angle(360, 90, Stop.COAST)
Here's the same example with a speed of -360:
Motor(Port.B).run_angle(-360, 90, Stop.COAST)
These two programs do the same thing! If this is the first line in the program and the motor is in starting position it will turn to 90 degrees in its positive direction regardless of whether the speed is 360 or -360. This is because the robot is programmed to understand that the angle will not increment if the motor moves in the opposite direction.
If the motor has turned to 200 degrees before one of these commands is called, the motor will turn backward by 110 degrees so it can reach its target of 90 degrees. This command measures the angle to which the motor is turned after the start of the program.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons

Python with LEGO Mindstorms EV3 - Level 1
The course introduces students to the programming language Python. We use LEGO Mindstorms EV3 Robots. Python is a popular programming language. It could be used for introducing students to programming, for academic studies, for developing machine learning algorithms and as a general-purpose language.
During the course, students learn how to read and how to develop Python programs. They use an Integrated Development Environment called Visual Studio Code. Robots are programmed to perform interesting and funny tasks like "bringing you water". The level ends with competition on a playing field with boxes.
- 74
- 28:18
- 114

Lesson 6 - Steering an Unmanned Vehicle
Intro
Have you heard of self-driving cars? Today we will try to create such a car. For a steering wheel, we will attach a medium motor, that will spin to turn the robot and we will program it to drive.
Before you release it onto the streets, like any good driver, it must earn its driver's license. At the end of the lesson, you will have a competition with the rest of the self-driving cars.
- 3
- 7
- 5
- 3d_rotation 1