Steer left and right py v2/fi: Difference between revisions

From wikiluntti
(Created page with "=== Esimerkkikoodi ===")
(Created page with "== Harjoituksia ==")
Line 42: Line 42:




== Exercises ==
== Harjoituksia ==


1. Make the robot to steer around a table or a chair. Try to stop it at the starting position
1. Make the robot to steer around a table or a chair. Try to stop it at the starting position

Revision as of 23:03, 22 September 2020

<languages />

Johdanto

Testataan, jos useita ohjauslohkoja voidaan asettaa peräkanaa; toimii täydellisesti.

Robotti

Ideat ja periaatteet toimivat lähes kaikille roboteille, mutta tämä on testattu Asimovilla.

Anturit

Ei antureita, paitsi servomoottorien.

Esimerkki

Teoriaa

Kokeillaan muutamaa .on() -funktiota peräkanaa, jos robotti kääntyy vasemmalle ja oikealle. Pidetään välissä pieni tauko.

Esimerkkikoodi

#!/usr/bin/env python3
from ev3dev2.motor import MoveSteering, OUTPUT_B, OUTPUT_C
from time import sleep

#How about move steering?
steer_pair = MoveSteering(OUTPUT_B, OUTPUT_C)
steer_pair.on(steering=-20, speed=5)
sleep(10)
#steer_pair.off()

steer_pair.on(steering=20, speed=5)
sleep(10)

steer_pair.off()


Harjoituksia

1. Make the robot to steer around a table or a chair. Try to stop it at the starting position

2. Make the robot stop

  1. After 10 seconds
  2. After 3.5 rotations of the left tire
  3. After the colour sensor finds a black tape.

3. Try different steering values:

  1. 0
  2. -50 and +50
  3. -100 and +100
  4. -110 and +110