Lecture
Adjusting the robot's movement speed is necessary for optimal Obstacle Avoidance, performing a Slalom, or Moving objects.
The first steps toward obstacle avoidance were taken in the chapter «Control Algorithms». Following a wall with small deviations is possible using a PD controller. However, the robot described will only be able to steer around walls for small deviations from a straight line. At sharp bends, the robot may lose contact with the wall and start spinning in place. This problem can be partly solved through the robot's construction.
Instead of rigidly specifying a particular speed for your robot, here we will try several different ways to adjust your robot's speed without the need to constantly upload new code.
The first way we are going to adjust the speed is to use a simple trimmer potentiometer on the breadboard.
If you prefer to simply control your robot's speed using the 4 extra buttons on the controller, this is also fairly easy to set up. First, we need to set up a global speed variable. Anywhere above the sketch's setup, add something like this:
Then, in the main loop, we can use this variable to set the motor speed, using:
Then all we need to do is increase the speed each time we press button 1, and decrease it each time we press button 3.
Open the sketch Ada_CurieBot_RC_buttonSpeed in the Arduino IDE and upload it to your robot.
the robot's speed control is handled by analog PWM, which can consume CPU resources. And the PWM output is unstable.
. Competition Conditions
1.1. In the shortest possible time, the robot must traverse the track marked by a black line, from the starting point to the finish, going around the obstacle-pins located on the line.
1.2. The robot must go around the first obstacle-pin on the left side, and thereafter go around the pins alternately on the right and left sides (the classic slalom principle).
1.3. No more than three minutes are given to complete the distance.
1.4. At the end of the distance, a gate may be set up on the track, through which the robot must pass.
1.5. Penalty points are assessed against the robot for colliding with pins or for "cutting" the route.
1.6. During the competition, team members must not touch the robots.
2. The Track
2.1. The color of the field is white.
2.2. The color of the line – black.
2.3. The width of the line is 50 mm.
2.4. The minimum radius of curvature of the line – 300 mm.
2.5. The number of pins on the track is not less than 4.
2.6. The minimum distance between pins is 75 cm.
2.7. The pins are tin cylinders made from empty standard tin beverage cans (330 ml).
2.8. The pin is covered with white drawing paper or plain paper.
2.9. The diameter of the pin is 70 mm.
2.10. The height of the pin is 120 mm.
2.11. The weight of the pin is no more than 50 g.
2.12. The width of the gate is not less than 75 cm.
2.13. The gate can be simple markings on the field in the form of small light-colored rectangles, or a structure made of thin black slats (no more than 1 cm thick).

Fig. 1. Example of a track with pins set out and a possible
trajectory of the robot's path through it
3. The Robot
3.1. The maximum width of the robot is 40 cm, length - 40 cm.
3.2. The weight of the robot must not exceed 10 kg.
3.3. The robot must be autonomous.
4. Rules for Selecting the Winner
4.1. Each team is given no fewer than two attempts to complete the distance (the exact number is determined by the judging panel on the day of the competition).
4.2. The best result counts.
4.3. If, while completing the distance, the robot loses the line for more than
10 seconds (if within 10 seconds the robot is not above the line even once), the attempt does not count.
4.4. If the robot knocks down or shifts a pin by more than 5 cm, it is assessed penalty points for each knocked-down or shifted pin (1 penalty point for
a shifted pin, 2 penalty points for a knocked-down pin).
4.5. For violating the order of passage (cutting the route or skipping pins), the robot is assessed 3 penalty points (for each violation of the order of passage).
4.6. If the robot does not pass through the finish gate at the end of the track, the attempt does not count.
4.7. The winner is declared to be the team that spends the least time covering the distance. In doing so, priority is given to the results of the teams that received the fewest penalty points.
Robot vacuum cleaners, the Curiosity rover, and futuristic micro-drones that pollinate plants instead of bees — all of them have to explore new spaces, whether that is an apartment, the fields around a farm, or the crater of another planet. Such robots must be able to independently study the terrain, build maps of it, and choose optimal routes for movement.
Comments